Jenkins:在MultiJob中共享变量 [英] Jenkins: Sharing variables in MultiJob

查看:656
本文介绍了Jenkins:在MultiJob中共享变量的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我将Jenkins用于测试/构建目的,因此我使用以下配置创建了一个MultiJob项目:

I'm using Jenkins for testing/build purposes, so I created a MultiJob project with this configuration:

  1. 测试工作
  2. 建立工作
  3. 安装作业

MultiJob是从Master Jenkins启动的,但是其他作业是从其他Node启动的. 生成作业执行创建BUILD_ID的Shell脚本. 现在,我希望将BUILD_ID作为参数传递给安装作业. 我怎样才能做到这一点?我唯一的选择是使用属性文件?

The MultiJob is launched from the Master Jenkins, but other jobs are launched from other Nodes. The Build Job executes a shell script which creates the BUILD_ID. Now, I want the BUILD_ID to be passed as parameter to the Install Job. How can I do that? My only choice is to use a property file?

非常感谢

推荐答案

要使用我将要描述的建议,您将需要

To use the suggestion i am going to describe, you will need Parameterized Trigger plugin. One way to pass custom parameter to a downstream job is by storing the key & value pair (key=value) in a file and specifying the same file by selecting Parameters from properties file option while calling downstream (in this example, job B) job. Refer the screenshot below:

现在,您可以使用$BUILD_ID访问下游作业"B"中的变量.您还希望启用选项Don't trigger if any files are missing.

Now you can access the variable in downstream job 'B' by using $BUILD_ID. You would also like to enable the option Don't trigger if any files are missing.

这篇关于Jenkins:在MultiJob中共享变量的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆