0

I need to Implement multiple Jenkins Servers with same configs and builds. All Jenkins server should have same builds and same configs.

When ever i change any configuration or add new build it should replicate with all Jenkin servers.

All Jenkins servers have common nfs share.

Please advice easy and best way to implement this.

All Jenkins servers are running in Linux servers.

Why I am implementing multiple Jenkins servers we have different regions.

we do not have Connectivity to servers and application between regions.

Any other solution would be fine.

abc
  • 155
  • 1
  • 9
  • Are you saying you'd like all the Jenkins servers to be identical? What happens if two people make different changes to the same job on two different servers? How would you like this conflict to be reconciled? – pcjr Mar 19 '18 at 17:15
  • I can't believe you are thinking about replication without having connectivity. Looks like you have to raise this concern with your network admin. – pat Mar 20 '18 at 08:16

1 Answers1

0

I can't give a perfect solution but I can give you a solution that might work if you do it good. There is no direct plugin to do this. So that's why I am giving you my solution. But this a little complex to be built.

First of all Setup a Jenkins server with good and updated configuration. Now make a zip file of ~/.jenkins folder. So now please replace the ~/.jenkins folder of all the other jenkins server instances with this configured jenkins instance zip file. This is just for the initial set up.

Use this plugin to watch the file system changes of job config's. Create a job for this. And in the build step, create a zip file having all the changed config files and info file having where to place where file i.e. changed_configs.json ( [file_name_in_zip_file, location_to_be_pasted] ).

After this has been done, Please save this zip file in the nfs share. Please use the same plugin task for checking whether is there any change in the nfs share location. If any change, that means that job config has been updated. So now using that changed_configs.json file do the replacement of configs and now all are in sync with the other.

By the way each server will be having two jobs to do this. one will check for job config changes and make a zip file. Other will be checking for zip files change in the nfs share location.

Configure these two jobs also while making instance zip file. Now please use this to change the configuration in running instance. Manage Jenkins => Reload Configuration from Disk use this option to reload config from the xml files again. Make it in the build step itself after replacing the changed configs. It will be quick and don't need the restart of your jenkins. Hope this helps. This is complex but can be useful in your case as there are no inbetween applications or connectivity between servers.

Some urls you can look into are:

How to move Jenkins from one PC to another?

https://staxmanade.com/2015/01/how-to-migrate-a-jenkins-job-to-new-jenkins-server/

https://wiki.jenkins.io/display/JENKINS/Job+Import+Plugin

SV Madhava Reddy
  • 1,530
  • 2
  • 11
  • 28