简体   繁体   English

我正在使用带有参数的构建管道作业来调用 Jenkins 中的下游作业; 如何在帖子块中打印主要作业名称?

[英]I'm using a build pipeline job with parameters to call a downstream job in Jenkins; how do I print the main job name in the post block?

I'm using a build pipeline job with parameters to call a downstream job in Jenkins;我正在使用带有参数的构建管道作业来调用 Jenkins 中的下游作业; how do I print the job name in the post block?如何在帖子块中打印作业名称? I know how to print the job name if the downstream job is executed, but how do I print the build job name that is triggering the downstream job in post block?如果执行了下游作业,我知道如何打印作业名称,但是如何在 post 块中打印触发下游作业的构建作业名称?

In downstream job, you can use:在下游工作中,您可以使用:

    def upstreamCause = currentBuild.rawBuild.getCause(hudson.model.Cause$UpstreamCause)
    if (upstreamCause) {
        // search for name, build number, etc. in upstreamCause object
    }

The Javadoc for UpstreamCause class is here . UpstreamCause class 的 Javadoc 在这里

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何通过上游作业打印下游作业中的参数? - How to print parameters in downstream job by upstream job? 使用Build Pipeline Jenkins插件将参数传递给下游作业 - Pass parameter to downstream job using Build Pipeline Jenkins plugin 如果新构建在管道中等待,如何强制Jenkins跳过下游作业? - How to force Jenkins to skip a downstream job if a new build is waiting in the pipeline? 如何将Jenkins 1中的作业的构建参数远程添加到Jenkins 2中的另一作业? - How do i add build parameters of a job in Jenkins 1 remotely to another job in Jenkins 2? 如何在声明性管道中获取下游作业的 build_number? - How do I get the build_number of a downstream job in a declarative pipeline? 在管道作业中,如何使用他们选择的参数构建自由式下游作业? - In pipeline job how to build freestyle downstream jobs with their choice parameters? 如何获取上游作业在管道中的下游作业中运行的节点名称 - How can I get the node name where the upstream job has run in the downstream job in pipeline 当jenkins管道作业触发时,如何使用作业dsl获取文件数组? - how do i get an array of files using job dsl when triggered by a jenkins pipeline job? Jenkins预定义参数和下游作业 - Jenkins predefined parameters and downstream job 如何延迟触发 Jenkins 下游构建作业? - How to trigger Jenkins downstream build job with a delay?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM