哈德森/詹金斯:在多个工作之间共享参数 [英] Hudson / Jenkins: share parameters between several jobs
问题描述
我大约有20个使用通用参数(用户,密码)的作业,有时密码已过期...所以我必须在所有作业上更改它,这确实很耗时(而且容易出错,我可能会忘记一个)
I have about 20 jobs using common parameters (user, password), and sometimes the password expires... So I have to change it on all jobs, which is really time consuming (and error prone, I may forget one).
我想到了:
- 使用一种魔术属性文件(如果存在的话)直接将诸如KEY,VALUE之类的行添加到作业参数中
- 直接在
build.xml
内部添加相同类型的KEY,VALUE对,但是在哪里?而且真的很丑...也许在build.xml
中嵌入了专用XML? - 调用一个从属作业,该作业将(如何?)将所需值推向父级...
- using a kind of magic property file if that exists to have directly lines like KEY, VALUE added into job parameters
- adding the same kind of KEY, VALUE pair directly inside
build.xml
, but where ? And it's really ugly... Maybe with a dedicated XML embedded into thebuild.xml
? - calling a slave job that would (how ?) push up to the parent one the desired values...
如您所见,我只是从Hudson/Jenkins开始(我使用的是Jenkins 1.424.2.2),谢谢您的帮助!
As you can see I'm only starting in Hudson/Jenkins (I'm using Jenkins 1.424.2.2), thanks for your help !
编辑:我不是Jenkins实例的管理员,所以我无法访问全局属性...
I'm not admin of the Jenkins instance, so I cannot have access to global properties...
推荐答案
我最终通过:
- 在网页中保存加密的凭据
- 借助Shell脚本(wget)在Hudson中检索它们,解密它们,并在工作区中用
name=value
行(在我的情况下为ssh.password=...
)创建一个build.properties
文件
- keeping encrypted credentials in a web page
- retrieving them in Hudson thanks to a shell script (wget), decrypt them, and creating a
build.properties
file in the workspace with linesname=value
(in my casessh.password=...
)
之所以可行,是因为Ant的构建步骤会检测到该文件,并将内部变量传递到其上下文中.因此,我可以集中我的凭据.
This works, because Ant build steps detect this file and pass the variables inside into their context. Thanks to that I could centralize my credentials.
这篇关于哈德森/詹金斯:在多个工作之间共享参数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!