[英]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 /下找到了此信息
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.