Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

best practice to backup config files Jenkins

Tags:

jenkins

debian

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?

like image 456
user1154390 Avatar asked Mar 31 '17 16:03

user1154390


2 Answers

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.

like image 104
VonC Avatar answered Oct 11 '22 17:10

VonC


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.

like image 34
Kendall Trego Avatar answered Oct 11 '22 17:10

Kendall Trego