Migrate from jenkins 1 to jenkins 2 - jenkins

How can we migrate our jenkins 1 instance to jenkins 2.
We know the job export plugin which can be useful for all our the jobs but is there also a way to export your general settings / security settings?

Jenkins 2 is a drop-in replacement. You can just upgrade from version 1 to 2, either by updating the server running Jenkins, or by copying the Jenkins directory.

Don't export anything. Jenkins stores EVERYTHING in 1 directory (unless you have told it not to). Copy that entire directory to a new machine. Copy the existing jar. Start up Jenkins. If it works, replace the jar with the new version. Start it up. Chances are, it will just work.

Related

Update jenkins war on one machine and then move it to another one: possible?

I have a machine with blocked outgoing connections so it is not possible to update jenkins nor install the plugins I need for my work.
My idea is the following: I download the jenkins .war on my personal laptop and complete the installation + the plugin download.
Then I just move this .war to the machine where I need jenkins to be up and running.
Is it possible? Where are the plugins/updated data stored?
Also, would it be a problem the fact that my laptop has windows as os, while the destination machine is a linux RHEL?
Your solution sounds crazy :D
This could be help you:
Update Jenkins war
If you have shell access with root privilege, there is a manual way.
Download latest war file inside your linux, using wget , curl or just upload it using winscp from your windows.
Stop jenkins
Backup EVERYTHING: linux snapshot, jenkins workspace, jenkins war file, etc
Replace the old war with new war
Start jenkins
Detailed steps in this webs:
https://mohitgoyal.co/2017/02/15/upgrade-jenkins-server-to-a-new-version/
https://www.thegeekstuff.com/2016/06/upgrade-jenkins-and-plugins/
Plugin
Jenkins has an option to install plugins called Manage Plugins
This offer two options :
(1) Install plugins using available option
For official and compatible plugins, suggested by Jenkins :
(2) Install plugins using upload option
For custom plugins or when is not available on official repositories:

Jenkins version upgrade from 1.613 to latest one

I want to upgrade my Jenkins version from 1.613 to latest one i.e 2.80 , As my current Jenkins version is 2 years old, I see My java version is 1.7 and I want to upgrade the java version as newer Jenkins version needs Java 1.8 , Is there anyway I can upgrade my Jenkins without any downtime and without a mess ..? I am afraid I cant roll back java Once I upgrade it to 1.8 and also I am afraid of all plugins. What necessary action I need to take ..? I see my Jenkins is in /var/lib
Please help me guys
Thanks
If you just keep a backup of your original war file and your entire JENKINS_HOME directory, your risk is minimal if something goes wrong.
Something like this should make it pretty easy:
Try it all on a backup server first, though this is optional:
Copy the jenkins war file and the JENKINS_HOME directory to a new machine, set the JENKINS_HOME variable to point to the place you copied JENKINS_HOME to, then start Jenkins. Make sure it all works like it should. You can even make a copy on the same machine but in a different directory if you start it up on another port. Now you can try the upgrade steps on non-production instance.
The actual upgrade should be fairly painless. Shut down Jenkins, make a backup of everything, then start Jenkins using the new war file. Log in and test. If something doesn't work, remove the JENKINS_HOME and replace with your backup. Start back up with the original war file.

How do I move Jenkins from one server to another?

I need to move Jenkins version 2.32 from Server A to Jenkins 2.72.1 Server B.
Both server have ubuntu 16.04.3
I could not install any plugin and take back up in Server A due to memory issues. Is there any way that I could achieve this?
Copy all the files in your JENKINS_HOME directory over to the new server.
Point JENKINS_HOME on the new server at the new directory.
Copy the Jenkins war file (or your servlet container setup if you have one) over to the new machine and start it up.
All Jenkins settings, jobs, plugins, config, etc. live in JENKINS_HOME. You just need a copy of it to start it elsewhere.
Following JENKINS/Administering+Jenkins, you still need to make a backup of JENKINS_HOME.
See also How to Migrate a Jenkins Job to New Jenkins Server
If you want to exclude the plugins for space issue, you can list them in a text file, and reload them with a groovy script.

Jenkins Service vs Jenkins Jar File Permission

I have Jenkins 1.6 installed as a service on a CentOS machine.
At some point in the past the service stopped/crashed/? and Jenkins was restarted from the command line, java -jar jenkins.war, as the root user.
While it was running as root some plugins were updates/installed, and jobs created created/ran. Any new files created are now owned by the root user/group and not by the jenkins user/group.
Meaning, when the service was restarted Jenkins could not read these files. Resulting in plugins not running and most jobs not being loaded.
Manually restoring the permissions(chown, chgrp) to the plugins solves the plugin related issues.
For the jobs it's easy to spot new ones and fix them. Any existing ones that were re run and created new files are more difficult to find.
Then there may be other files which the Jenkins server created, not as part of a job or plugin which need to be changed. The errors are not always obvious, and crop up slowly over time.
Am I better adding the jenkins user to the root group? could this cause issues?
Or manually changing the permissions, hope i got them all! And fix others that come up?
Any suggestions appreciated.
In the end we manually changed the file permissions back to Jenkins. There were some immediate jobs that failed in the following days. And a few which only came up a few months later.
For the most part it worked well.

All Jenkins plugins are lost when migrating to new Jenkins Server

I have a jenkins server version 1.584 which has at least 50 plugins.
I wanted to check whether i can do an update for the jenkins core, and I didn't want to do it on the original server. Therefore I copied all the folders (expect the builds and modules folders that were under jobs folder) and then started jenkins.
Now it looks like i have no plugin installed at all.
Hope to hear about some way to handle it...
Thanks.
Did you copy the plugins folder to the new Jenkins home ?
It should work.
Did you also copy those *.xml configuration files from your_old_server_jenkins_home/* into your_new_server_jenkins_home/* ?

Resources