This page documents how to pull copies of Jenkins job config.xml files to your local machine, make changes, and push them back to Jenkins.
The tool used for this is a maven mojo called hudson-job-sync
As documented here, there are a number of steps to using this tool.
-
Clone the sources
-
Build the maven mojo
-
Configure usage for your Jenkins machine. For example, create a pom file like this one in which you set defaults for:
-
viewFilter, regexFilter
-
hudsonURL, username, password
-
Once you have the above steps completed, you can run the mojo as a push (from local to remote server) or pull (from remote server to local) operation.
Here are a couple of shell scripts to make that easier. You’ll have to adjust them to match your own paths on disk where you have your config.xml files checked out.
Some examples:
# to pull jobs matching /.*servertools.*/
. ~/bin/hudpull-eclipseJIPP.sh -DhudsonURL=https://ci.eclipse.org/webtools/ \
-DviewFilter=view/webtools_R3_10/ -DregexFilter=servertools
# make changes locally, then push back to server
. ~/bin/hudpush-eclipseJIPP.sh -DhudsonURL=https://ci.eclipse.org/webtools/ \
-DviewFilter=view/webtools_R3_10/ -DregexFilter=servertools
# or, for a different view filter:
. ~/bin/hudpull-eclipseJIPP.sh -DhudsonURL=https://ci.eclipse.org/webtools/ \
-DviewFilter=view/gerrit/ -DregexFilter=jsdt
# make changes locally, then push back to server:
. ~/bin/hudpush-eclipseJIPP.sh -DhudsonURL=https://ci.eclipse.org/webtools/ \
-DviewFilter=view/gerrit/ -DregexFilter=jsdt
Note that using no viewFilter will default to whatever value is set in your pom.xml.
If you want to match on all configs in the view, use .*
After confirming your changes are pushed to the remote server, and didn’t break anything, you can commit the same changes to your local config.xml cache for storage/versioning.