Created
April 16, 2019 08:35
-
-
Save wheelq/4a477926d7fcaf6040909f91d10ce5a2 to your computer and use it in GitHub Desktop.
Export Jenkins jobs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#######Export###### | |
java -jar jenkins-cli.jar -s http://server get-job myjob > myjob.xml | |
curl -s http://OLD_JENKINS/job/JOBNAME/config.xml | |
#Local export | |
/var/lib/jenkins/jobs/-the-project-name-/config.xml | |
################### | |
####export/import#### | |
curl -s http://OLD_JENKINS/job/JOBNAME/config.xml | curl -X POST 'http://NEW_JENKINS/createItem?name=JOBNAME' --header "Content-Type: application/xml" -d @- | |
#with authentication: | |
curl -s http:///<USER>:<API_TOKEN>@OLD_JENKINS/job/JOBNAME/config.xml | curl -X POST 'http:///<USER>:<API_TOKEN>@NEW_JENKINS/createItem?name=JOBNAME' --header "Content-Type: application/xml" -d @ | |
##################### | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment