Is there any way to save a pipeline configuration or an item configuration in Git or anywhere else, so that when my Jenkins machine is crashed, i can migrate the saved configur
I would ( as a start ) get yourself - https://wiki.jenkins.io/display/JENKINS/JobConfigHistory+Plugin which keeps history of all Changes made to Jobs , System config etc - has saved me multiple times.
Also , you could setup a cron job outside Jenkins to git push your Job config.
I setup to push the Jobs folder content ( including Build history - but you could exclude that - Correctly ignore all files recursively under a specific folder except for a specific file type ref ) .
My script ( i had SSH stuff previously setup )
cd /this/that/other/jenkins_data/jobs/
NOW=$(date +"%m-%d-%Y-%r")
git add .
git commit -m "Jenkins Backup $NOW"
git push -u origin jenkins-backup
This way gives me piece of mind , I have RSYNC to another box and I also have a Backup plugin running too... ( i was stung once - not again! )
Hope this helps.
All your jobs is stored in config.xml
files inside $JENKINS_HOME/jobs/<path_to_your_job>
folders. So, you can just backup these config.xml
files (or you can backup all Jenkins configuration by saving full $JENKINS_HOME
folder).
Hi you can write the pipeline script in file and publish that file into the git.
After that just create the pipeline job in the jenkins and use Pipeline script from SCM
option for pipeline script.
The other option is take backup of Jenkins home directory to external hard disk(keep project workspace outside the jenkins home to reduce backup size).