0

In BuildBot, I'd like a step to not execute if a previous step failed.

For instance, in the following class, if test_package() fails, I don't want install() to execute.

class Sage(Project):
    distros = [RHEL7()]
    tests = [SageTest()]

    def test_package(self, f, dist):
        HaltOnFailure=True
        set_properties = {
            'package_file_name': util.Property('package_file_name'),
            'master_dir': dist.master_dir()
        }
        if isinstance(dist, RHEL7):
            f.addStep(steps.Trigger(
                schedulerNames=['sage-rhel7-sage-test'],
                doStepIf=partial(do_step, 'sage-rhel7-sage-test'),
                    waitForFinish=True,
                    set_properties=set_properties))   

    def install(self, f, dist):
        super(Sage, self).install(f, dist)

How can I inform install() that test_package() failed?

boardrider
  • 5,882
  • 7
  • 49
  • 86

2 Answers2

1

Try to use some common steps parameters: 2.5.9.1. Common Parameters

For example, haltOnFailure:

f.addStep(steps.Trigger(
    schedulerNames=['sage-rhel7-sage-test'],
    doStepIf=partial(do_step, 'sage-rhel7-sage-test'),
        waitForFinish=True,
        set_properties=set_properties,
        haltOnFailure=True))

You can also try various combinations of doStepIf, hideStepIf, alwaysRun, haltOnFailure, flunkOnWarnings, flunkOnFailure, warnOnWarnings, warnOnFailure for your purposes

But may be it could be better to refactor your code to use install function in separate step and build you solution, as a sequence of steps with a certain conditions.

-1

BuildStep is super class of all build steps so followig kwargs are available to all subclasses

name, description, descriptionDone, descriptionSuffix, locks, haltOnFailure,
flunkOnWarnings, flunkOnFailure, warnOnWarnings, warnOnFailure, alwaysRun,
progressMetrics, useProgress, doStepIf, hideStepIf

Reference

Rajat
  • 2,467
  • 2
  • 29
  • 38