Jenkins作业DSL在postBuildScripts shell中获取当前生成结果

Jenkins作业DSL在postBuildScripts shell中获取当前生成结果,jenkins,jenkins-job-dsl,Jenkins,Jenkins Job Dsl,我需要在Jenkins DSL脚本中的postBuildScripts shell调用中获取当前构建执行的结果。类似于Jenkins管道中的${currentBuild.currentResult},其值为:成功、不稳定或失败 我已经搜索了DSL文档,但还没有找到任何解决方案 我的代码是这样的: postBuildScripts { steps { shell("""echo \$CURRENT_BUILD_STATUS""") } } 那么如何以最简单的方式获取此$CURRE

我需要在Jenkins DSL脚本中的postBuildScripts shell调用中获取当前构建执行的结果。类似于Jenkins管道中的
${currentBuild.currentResult}
,其值为:成功、不稳定或失败

我已经搜索了DSL文档,但还没有找到任何解决方案

我的代码是这样的:

postBuildScripts {
  steps {
    shell("""echo \$CURRENT_BUILD_STATUS""")
  }
}

那么如何以最简单的方式获取此
$CURRENT\u BUILD\u STATUS

不幸的是,PostBuildScript插件的文档缺少一些有趣的部分

job('example') {
  publishers {
    postBuildScripts {
      steps {
        shell('echo $BUILD_RESULT')
      }
    }
  }
}