Backup and Restore jobs and plugins in Jenkins

Preconditions

Jenkins Installation

  • Install Jenkins windows installer from below link  (Jenkins for Windows)
  • Complete installation and Login with Admin user

Required Plugins

  1. After Successful installation of Jenkins, Login as Admin
  2. Click on “Manage Jenkins” from left menumanage-jenkins
  3. From List, Select “Manage Plugins
  4. Select “Available Tab”
  5. Click on Filter Text-box to Search required plugins
  6. Search for (Do not press enter button after searching from in Filter Text-box)
    1. thinBackup
  7. Select “Install without restart option” for plugin 
  8.  Install required plugin one by one.
  9. After installation of last plugin select “Restart Jenkins” option and wait till Jenkins Restarts

thinBackup plugin configuration

  1. Navigate to “Manage Jenkins” -> “ThinBackup
  2. Click on “Settings” of ThinBackup
  3. Create a backup folder on Jenkins master machine and provide path of the same in Backup Directory field. Change other settings as per below screenshot and click on “Save”

thin-backup-configuration-jenkins

How to Export / Backup

Components which will be Exported/Backed up

  1. Jenkins Master Configuration
  2. List of Installed Plugins
  3. Configuration of Plugins
  4. Configuration of all Jobs

Manual steps to be followed before Exporting/Backing up Jobs

  1. Create a document with below details of all used slaves/Nodes and copy in backup folder
    1. Name of Slaves
    2. No of executors (If used)
    3. Labels of Slaves
    4. Usage (If not changed anything, we can skip)
    5. Launch Method (Details of Launch option selected from dropdown based on OS)
    6. Availability (If not changed anything, we can skip

How to Export/Backup Jobs

  1. Navigate to Dashboard
  2. Select “Manage Jenkins” from Left menu
  3. Select “ThinBackup” from list (mostly at bottom of list)
  4. Click on “Backup Now”
  5. Wait till backup process complete
    • Note: Progress bar will not display so user needs to wait for 45 to 60 seconds
  6. Navigate to Backup Directory path mention during setup of thinback (For example: c:/JenkinsBackup)
  7. New folder with “FULL-YYYY-MM-DD_HH-MM” should be created

How to Restore Jobs

Configuration required before restoring Jobs/Backup

Create Slaves by following below steps with name, Label and IP

Note: You need to use same details which where capture manually during backup of Jobs. IP can be change

  1. Navigate Manage Jenkins screen
  2. Select “Manage Nodes” from list
  1. Select “New Node” from left menu
  2. Provide appropriate Slave name and Check “Permanent Agent” option
  3. Click on Ok button
  4. Add values for “Remote root directory, Labels, Launch method
  5. Add credentials details of Linux Slave machine (Make sure linux machine have JAVA 7 or Above installed)
  6. Click on Save button
  7. Wait for few seconds
  8. Slave will be listed with system details

Restore with Plugins

  1. Navigate to Dashboard
  2. Select “Manage Jenkins” from Left menu
  3. Click on “Restore”
  4. Select backup files name “Restore Backup from Dropdown”
  5. Check “Restore plugins” option
  6. Click on Restore button
  7. Wait for 45 to 60 seconds
  8. Restart Jenkins service from Services
  9. Wait for 45 to 60 seconds
  10. Navigate to Dashboard to confirm Backed up Jobs
  11. Navigate to Manage Plugins – Installed Tab to Confirm Backed up Plugins

You may also like...

Leave a Reply

Your email address will not be published. Required fields are marked *

Subscribe For Latest Updates

Signup for our newsletter and get notified when we publish new articles for free!