Skip to main content
  1. Posts/

How to backup Jenkins

·214 words·2 mins· ·
Xianpeng Shen
Author
Xianpeng Shen
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.
Beijing 48 Hours — A DevOps Training Camp Experience
·1080 words·6 mins
A record of my experience attending the JFrog DevOps training camp in Beijing, sharing training content, personal feelings, and reflections on future work.
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.
Jenkins Linux agent configuration
·298 words·2 mins
Provides a step-by-step guide on how to configure a Jenkins Linux agent, including setting up the Java runtime, creating the node, and troubleshooting common issues.
Jenkins Windows agent configuration
·544 words·3 mins
Provides a step-by-step guide on how to configure a Jenkins Windows agent, including setting up the Java runtime, creating the node, and troubleshooting common issues.
Obtaining Bitbucket Repository Events in Real Time via the generic-webhook-trigger Plugin
·409 words·2 mins
This article describes how to use Jenkins’ generic-webhook-trigger plugin to obtain real-time event information from a Bitbucket repository, such as the Pull Request ID.