best practice to backup config files Jenkins

浪子不回头ぞ 提交于 2019-12-10 08:54:00

问题


I am using Jenkins on remote Debian 7.8 . I want to update Debian 7.8 to 8.7. I tried to update and it went fine however Jenkins was broken and could not start the service. I tried everything but could find any solution. Finally I used purged command and it deleted previous configurations and builds.

Now I restore the server and want to update again but I want a complete Jenkins backup of config and builds so restore it from last running instance.

What's the best practice to backup the configs as simple as possible (with less effort and problems) and configure and then merge the backuped files.

Which data / config files I have to backup?


回答1:


The exact layout used by Jenkins is described by JENKINS_HOME directory

JENKINS_HOME
 +- config.xml     (jenkins root configuration)
 +- *.xml          (other site-wide configuration files)
 +- userContent    (files in this directory will be served under your http://server/userContent/)
 +- fingerprints   (stores fingerprint records)
 +- plugins        (stores plugins)
 +- workspace (working directory for the version control system)
     +- [JOBNAME] (sub directory for each job)
 +- jobs
     +- [JOBNAME]      (sub directory for each job)
         +- config.xml     (job configuration file)
         +- latest         (symbolic link to the last successful build)
         +- builds
             +- [BUILD_ID]     (for each build)
                 +- build.xml      (build result summary)
                 +- log            (log file)
                 +- changelog.xml  (change log)

It comes with a simple directive:

All the settings, build logs, artifact archives are stored under the JENKINS_HOME directory. Simply archive this directory to make a back up.

Back ups can be taken without stopping the server, but when you restore, please do stop the server.




回答2:


I'd suggest using the ThinBackup plugin. https://wiki.jenkins-ci.org/display/JENKINS/thinBackup

You can set it to run on a schedule using standard cron notation. There's a few configuration options, depending how extensive (large) you want your backup to be.



来源:https://stackoverflow.com/questions/43145027/best-practice-to-backup-config-files-jenkins

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!