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).
I thought about:
- 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...
As you can see I'm only starting in Hudson/Jenkins (I'm using Jenkins 1.424.2.2), thanks for your help !
EDIT: I'm not admin of the Jenkins instance, so I cannot have access to global properties...
Go to your Jenkins home and navigate :
....
I eventually succeeded by:
build.properties
file in the workspace with linesname=value
(in my casessh.password=...
)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.
I can think of two approaches:
Use Global properties, found under Manage Jenkins -> Configure system. Here you can define environment variables that should be available to all jobs.
Write a small script that downloads, modifies and posts the job config:
http://[jenkinshost]/job/[jobname]/config.xml
.You can read about the api capabilities under
http://[jenkinshost]/job/[jobname]/api
, here is what it says about reading and changing config.xml: