简体   繁体   English

如何在 Jenkins MultiJob 中将下游作业的描述传递给上游作业

[英]How to pass Description of downstream job to upstream job in Jenkins MultiJob

We've job to run concurrent jobs in parallel using Jenkins MultiJob plugin .我们已经使用 Jenkins MultiJob 插件并行运行并发作业。 We are using Description Setter plugin to update the description for failed jobs in all downstream and upstream jobs.我们正在使用Description Setter 插件来更新所有下游和上游作业中失败作业的描述。 How can I update the description of Upstream job with reason of failure in the downstream job.如何使用下游作业失败的原因更新上游作业的描述。

在此处输入图像描述

Is there any way to get the Description from downstream job to Upstream job using a plugin or a groovy script?有没有办法使用插件或 groovy 脚本从下游作业到上游作业获取描述? Can somebody help me.有人可以帮助我吗?

There is a description URL for each of your jobs. 每个工作都有一个描述URL。 You could have your downstream jobs POST form data with a "description" parameter to set the description. 您可以使用“ description”参数让下游作业POST表单数据来设置描述。

I found this info under (jenkins server)/job/(job)/api/ 我在(jenkins服务器)/ job /(job)/ api /下找到了此信息

Fetch/Update job description 提取/更新作业描述

You can use Groovy Postbuild plugin to execute groovy script after the downstream job gets done.您可以使用 Groovy Postbuild 插件在下游作业完成后执行 groovy 脚本。 The advantage of the groovy script that it gives you access to Jenkins environment, you can access any data from anywhere as far as I know (but not so sure about it). groovy 脚本的优点是它可以让您访问 Jenkins 环境,据我所知,您可以从任何地方访问任何数据(但不太确定)。 Execute the the script bellow, it should work.执行下面的脚本,它应该可以工作。 Handle exception, if needed.如果需要,处理异常。

def build_number= 12
def job = jenkins.model.Jenkins.instance.getItem("upstream_job")
def upstream_build = job.builds.find {it.number == build_number}
upstream_build.description = "New description"

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

相关问题 如何将上游作业构建参数传递给在MultiJob阶段中配置的下游作业? - How to Pass Upstream Job Build Parameters to Downstream Jobs configured in a MultiJob Phase? Jenkins的上游和下游工作 - Upstream and DownStream Job on Jenkins Jenkins-如何将参数从下游作业传递到其父上游? - Jenkins - How to pass parameters from a downstream job to its parent upstream? 如何在詹金斯中将参数作为环境变量从上游作业传递到下游作业? 无需对下游工作进行参数化 - How to pass parameter as environment variable from upstream job to downstream job in jenkins? without downstream jobs being parametrized 无论上游作业状态如何,如何触发 jenkins 下游作业 - how to trigger jenkins downstream job irrespective upstream job status 如何根据上游作业状态码跳过下游 jenkins 作业 - How to skip downstream jenkins job based on upstream job status code 如何将文件传递给阻止上游作业的下游作业? - How to pass file to downstream job which blocks upstream job? 如何在不构建上游作业的情况下将参数从上游作业传递给下游作业 - how to pass parmeter to downstream job from upstream job without building upstream job 如何将文件传递给 Jenkins 中的下游作业 - How to Pass Files to downstream Job in Jenkins 詹金斯-下游提交触发上游工作 - Jenkins - downstream commit triggers upstream job
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM