How to save Jenkins configuration?

前端 未结 3 1460
逝去的感伤
逝去的感伤 2021-01-22 00:04

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

3条回答
  •  孤城傲影
    2021-01-22 00:25

    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.

提交回复
热议问题