2

Is it possible to instruct BuildBot that a step is an "allowed failure", that is to NOT mark build as failed even if this particular step fails?

I have found a warnOnFailure parameter for a build step (would prefer "ignoreOnFailure"), but it doesn't seem to be working in my BuildBot (2.1.0, twisted 18.9.0). Even if I set it to True, the overall build is still marked as failed.

I have had success with ShellCommand's decodeRC parameter, but then I lose the indication that the step failed, so it's a sub-optimal solution.

This is how I generate the steps:

self.build.addStepsAfterCurrentStep([
    steps.ShellCommand(name=stage + ' ' + ('allowed failure' if allowed_failure(stage) else ''),
                       logEnviron=False,
                       warnOnFailure=allowed_failure(stage),  # This one would be desired but doesn't seem to work
                       command=['tox', '-e', stage],
                       env={ 'PYTHONPATH': '.' },
                       decodeRC={0:SUCCESS,1:SUCCESS})  # This one works, but marks the step as SUCCESSFUL, which I don't want
    for stage in self.extract_stages(self.observer.getStdout())
])

Please note the inline comments.

Is there a more obvious way of setting this up?

velis
  • 8,747
  • 4
  • 44
  • 64

2 Answers2

2

I've had similar issue with Buildbot. Notice i used both return code 1 and 2 as WARNINGS

  # check branch exists, only warning if it doesn't 
    SetPropertyFromCommand(name='check branch exists',
    command=['git','show-ref',util.Interpolate('origin/%(prop:branch)s')], 
    warnOnFailure=True, 
    workdir = util.Interpolate('build/%(prop:repo_name)s'),
    doStepIf= CheckBranchProperty, 
    decodeRC={0:SUCCESS,1:WARNINGS,2:WARNINGS},
    extract_fn = proc_show_ref_results ),   
  • So you're using the same approach as I am. Nice to know I didn't get dumb somewhere along the way. Seems BuildBot doesn't support the concept at all – velis Apr 03 '19 at 08:53
2

You're looking for flunkOnFailure=False (the default being True) in steps.ShellCommand's constructor. See the doc concerning common steps parameters.

Clément Hurlin
  • 440
  • 3
  • 11