詹金斯在失败的阶段继续管道

Jenkins continue pipeline on failed stage

我有一个带有一堆管道的 jenkins 设置。 我写了一个可以同时启动所有管道的新管道。 我想建立其他阶段,即使其中一个失败。

脚本目前看起来像这样

stage 'CentOS6'
build 'centos6.testing'

stage 'CentOS7'
build 'centos7.testing'

stage 'Debian7'
build 'debian7-x64.testing'

stage 'Debian8'
build 'debian8-x64.testing'

构建脚本本身包含它们应该运行的节点。

即使其中一个阶段失败,脚本如何继续执行以下阶段。

干杯

如果它们应该 运行 在一个序列中,你可以这样做:

def buildResult= 'success'
try{
  build 'centos6.testing'
}catch(e){
   buildResult = 'failure'
}
currentBuild.result = buildResult

如果他们应该 运行 并行,你只是 运行 他们: https://www.cloudbees.com/blog/parallelism-and-distributed-builds-jenkins

如果您使用 parallel 步骤,默认情况下这应该会按预期工作,因为 failFast 选项会在任何并行分支失败时中止作业,默认为 false.

例如:

parallel(
    centos6: { build 'centos6.testing' },
    centos7: { build 'centos7.testing' },
    debian7: { build 'debian7-x64.testing' },
    debian8: { build 'debian8-x64.testing' }
)

对我有用的:

    'Task' : {
        build( job : "DemoJob-2", wait: false )
        build( job : "DemoJob-3", wait: false )
    }