Skip to main content
  1. Posts/

How to backup Jenkins

·214 words·2 mins· ·
Xianpeng Shen
Author
Xianpeng Shen
DevOps & Build Engineer | Python Enthusiast | Open Source Maintainer
Table of Contents

I believe most of you have used the Jenkins configuration as code principle, so you build/test/release process will be described in code.

It looks like all is good, but not all of the configuration is in code, same of the Jenkins system configuration is store in the Jenkins service, so we also need to backup Jenkins in case of any disaster.

There are two ways to backup Jenkins, one used Jenkins plugin, the other is create shell scripts.

Using plug-in backup
#

I used the ThinBackup plugin, here is my thinBackup configuration.

ThinBackup Configuration

  • backup to a folder which user jenkins has permission to write. this is important.

    Previously I backup Jenkins to a mount folder, but it doesn’t work recently. so I use user jenkins to log in on the Jenkins server and found my jenkins can’t access the directory, but I personal user can.

  • I will daily backup my Jenkins server, from Monday to Saturday.

  • Fo me max number of backup sets is 3, because every backup archive more than 400 MB.

  • Others check boxs

    • Backup build results
    • Backup ‘userContent’ folder
    • Backup next build number file
    • Backup plugins archives
    • Move old backups to ZIP files

Using shell script backup
#

Here is a popular repository and code for your reference.

Related

Jenkins Top 3 best practice

·906 words·5 mins
Discusses three best practices for Jenkins: Configuration as Code, Shared Libraries, and Multi-Branch Pipeline, highlighting their benefits in terms of transparency, traceability, and self-service builds.

Jenkins Multibranch Pipeline

·405 words·2 mins
Discusses the use of Jenkins Multibranch Pipeline to manage multiple branches in a project, enabling parallel builds for pull requests and efficient code review processes.