0

I have a Jenkins setup running in production, I want to automate jenkins setup(installation) along with all the jobs that are setup in jenkins.
One crude way I can think of is to copy the whole jobs directory to the new Jenkins setup.

I want to know how other people in industry do deal with this problem.

Nagri
  • 3,008
  • 5
  • 34
  • 63
  • That's pretty broad.. I use one of Chef or Docker for installation (including plugins) and then JobDSL for job setup. Actual implementation of the jobs then using Jenkins Pipeline. – StephenKing Apr 30 '18 at 12:04

1 Answers1

0

I have used the plugin Thinbackup to move jobs, users, and plugins. You can make a full backup and restore it to the new server. The plugin is not perfect and is up for adoption. I had issues with the restore. I ended up using the plugin only for creating the archive, but then I copied manually the folders (users, jobs, plugins, nodes, email-templates, secrets, JENKINS_HOME files) from the archive to the new server.

Before creating the archive or copying the jobs, ensure that no more than 30 builds per job are kept, this will keep your archive small. I have seen 5000+ builds per job, which were totally unnecessary and were blocking the creation of the archive. When you create or restore the archive, or copy files, the server should be in quiet mode, no builds should be executed.

http://<jenkins.server>/quietDown

After you copy the files or restore the archive, you should restart Jenkins or even better, restart the server.

Another option is to use RSync as mentioned here. I am not sure what is the OS of your Jenkins server. If it is Linux you can check out this guide that I have written.

K. B.
  • 3,342
  • 3
  • 19
  • 32