Create a jenkins job from template and backup existing job using Jenkins CLI
- Add your project to the jobs.csv file (format - job_name,path_in_svn)
- Define JENKINS_HOST in generate.py scripts.
- Run generate.py script to generate a jenkins job's xml file (name : job_name.xml)
python generate.py
- Login to Jenkins CLI
java -jar jenkins-cli.jar -s JENKINS_HOST login --username YOUR_ACCOUNT_LOGIN
- Copy/paste the output of generate.py script to the console to manage the corresponding job.
By default script prints create-job instruction, replace it with update-job to overwrite existing job.
java -jar jenkins-cli.jar -s JENKINS_HOST create-job MYJOB < MYJOB.xml
java -jar jenkins-cli.jar -s JENKINS_HOST update-job MYJOB < MYJOB.xml
- Add your project to the jobs.csv file (format - job_name,path_in_svn)
- Define JENKINS_HOST in backup.py scripts.
- Run backup.py script to get the instructions
python backup.py
- Copy/paste the output of backup.py script to the console to manage the corresponding job.
java -jar jenkins-cli.jar -s JENKINS_HOST get-job MYJOB > data/MYJOB.xml
- Option -noCertificateCheck can be useful to avoid issues with specific certificates.
- Please ignore following warning, it seems not affecting the process:
Skipping HTTPS certificate checks altogether. Note that this is not secure at all. [WARN] Failed to authenticate with your SSH keys. Proceeding as anonymous