Table of Contents
Introduction
In this tutorial, How to Import Export jobs, Jenkins. It is easy to import and export Jenkins jobs and plugin when you migrate Jenkins jobs to a new server. I use Butler CLI. Jenkins the essential for DevOps Roles.
To get butler package for your system Linux. Link butler download.
Install butler
wget https://s3.us-east-1.amazonaws.com/butlercli/1.0.0/linux/butler chmod +x butler mv butler /usr/local/bin/
To verify the Bulter
/usr/local/bin/butler help
Import Export Jobs Jenkins
OLD SERVER
To export Jenkins plugins
/usr/local/bin/butler plugins export --server localhost:8080 --username admin --password admin
Butler will dump a list of plugins installed to new file “plugins.txt”
To export Jenkins jobs
/usr/local/bin/butler jobs export --server localhost:8080 --username admin --password admin
A new directory “jobs” will be created with every job in Jenkins. Each job it owns configure file config.xml
NEW SERVER
To import Jenkins plugins
/usr/local/bin/butler plugins import --server localhost:8080 --username admin --password admin
To import Jenkins jobs
/usr/local/bin/butler jobs import --server localhost:8080 --username admin --password admin
Another method, you can refer to from StackOverflow
- Jenkins CLI
- Copy the jobs directory
- Jenkins Remote API
- Jenkins Job Import Plugin
Conclusion
Throughout the article, you can use “Import Export Jobs Jenkins” as mentioned above. I hope this will be helpful to you. Thank you for reading the DevopsRoles page!