在Jenkins DSL管道中处理异常

时间:2019-07-17 13:19:37

标签: jenkins

如何处理Jenkins DSL管道作业中的异常

我尝试过尝试catch块,但是它不起作用。

try {
    sh  "echo Status of the job: ${currentBuild.fullDisplayName} is ${currentBuild.currentResult}"
} catch (err) {
    sh " ${COMP_DIR_URL}/v1/component-version/${COMPONENT_COORDINATES}/${COMPONENT_VERSION}/update-state/${currentBuild.currentResult}"
    currentBuild.result = 'FAILURE'
  }

我有一个种子作业,该种子作业又运行DSL作业。我想将DSL(子作业)的状态更新为父种子作业。这些是我的观察: 1.通过调用currentBuild.currentResult状态的postbuild步骤更新DSL管道,并将其传递给种子。 2.使用postBuildTask将作业状态更新为种子时,需要一个PostBuildTask插件。

除了使用插件外,有人可以建议我怎么做。

0 个答案:

没有答案