【问题标题】:BuildBot: allowed failuresBuildBot:允许的失败
【发布时间】:2019-03-22 09:04:41
【问题描述】:

是否可以指示 BuildBot 某个步骤是“允许的失败”,即即使该特定步骤失败也不将构建标记为失败?

我为构建步骤找到了 warnOnFailure 参数(更喜欢“ignoreOnFailure”),但它似乎在我的 BuildBot(2.1.0,扭曲 18.9.0)中不起作用。即使我将它设置为 True,整个构建仍然被标记为失败。

我已经成功使用 ShellCommand 的 decodeRC 参数,但随后我失去了步骤失败的指示,因此这是一个次优解决方案。

这就是我生成步骤的方式:

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())
])

请注意内联 cmets。

有没有更明显的设置方法?

【问题讨论】:

    标签: buildbot


    【解决方案1】:

    您正在steps.ShellCommand 的构造函数中寻找flunkOnFailure=False(默认为True)。见the doc concerning common steps parameters

    【讨论】:

      【解决方案2】:

      我在 Buildbot 上遇到过类似的问题。请注意,我同时使用了返回码 1 和 2 作为警告

        # 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 ),   
      

      【讨论】:

      • 所以您使用的方法与我相同。很高兴知道我一路上没有在某个地方变得愚蠢。似乎 BuildBot 根本不支持这个概念
      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-06-19
      • 1970-01-01
      相关资源
      最近更新 更多