Jenkins version upgrade from 1.613 to latest one - jenkins

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.

Related

Migrate from jenkins 1 to jenkins 2

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.

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 build history issue

I am facing a weird issue after upgrading jenkins to 1.632. After upgrade I am not able to see the build history in jenkins and surprise thing is that history is lost for few jobs. I have reverted back the jenkins but still I am not able to see the history. To make this issue more clear I am running Jenkins on tomcat and I just replace the jenkins.war file in webapps directory. I believe it should not have any impact on JENKINS_HOME location. Is there any way to restore the build history? BTW I also tried the option "reload configuration from the disk" but that is also not working. I am running jenkins on Linux box.
Any kind of help is highly appreciated.
Thanks,
Sanjiv

Downgrade Jenkins

I updated Jenkins a few days ago. But in the current Jenkins version, there are some annoying bugs. Is it possible to downgrade the version of Jenkins and if this is possible, how is it possible to do it?
I have been struggling with downgrading Jenkins as well, lately because the latest version seems to have a problem handling JDK 5 code (which I am unfortunately tied to for a little while longer)
Here's how I did my downgrade:
Locate an earlier stable version at https://updates.jenkins-ci.org/
Download the war file
Stop the Jenkins service
Replace the jenkins.war with the new.
Restart the service.
I had an additional issue with the configuration file not being compatible. E.g. In my case I had to disable matrix to get the service running. Your case may be different, so I suggest another question.
I easily rolled back to the last working version bydoing below steps:
Go to the location where jenkins is installed.
Rename jenkins.war if it exists to jenkins.war.corrupted
You would find a file jenkins.war.bak in same direcotry. Rename it to 'jenkins.war'
Downgrading should be equivalent to the upgrading process:
To upgrade from earlier versions of Jenkins, simply redeploy the WAR
file. Read this document for more about container-specific
instructions on how to do this. See this document for automation.
In my case, I followed the process below -
Download the jenkins.war file from https://updates.jenkins-ci.org
Stop the Jenkins service
Replace the jenkins.war with the new.
Restart the service.
Done
If you have upgraded from front end (i.e. Manage Jenkins > Upgrade Jenkins) Then you will get an option to Downgrade also from there (under Manage Jenkins -- restore to previous version)

Jenkins Update Loses Old Jobs

I am on a redhat linux box. I recently updated Jenkins to version 1.509 only to find that after doing so it has "forgotten" two of my jobs/projects. The jobs can still be found on my Jenkins machine under /var/lib/jenkins/jobs, but they no longer show up in the Jenkins GUI. I attempted to re-create them based off the configuration file I have, but I am not confident I have totally re-created the functionality they had.
I also tried to copy the job and or rename it hoping that would get jenkins to see it, but no luck. I had tried cp -r /var/lib/jenkins/jobs/JOB1 /var/lib/jenkins/jobs/JOB2. I also restarted the service a number of times. Finally I updated all of my plugins on the off chance that was somehow related.
So my question is "How can I get Jenkins to notice these jobs?" or failing that "can I run these jobs from in the terminal?"
NOTE: I am not discouraging others from upgrading Jenkins. After I upgraded Jenkins did complain about a number of things which I didn't pay enough attention to which I believe got me into this mess in the first place.
If I were you, I would try the Jenkins CLI (from $JENKINS_URL/cli) and use the create-job command and feed the job configuration file to the cli's stdin.
If that does not help, I would inspect Jenkins log files (you are saving stdout and stderr of Jenkins somewhere, right?) for any errors or clues. If the job failed to load because of some tag that you can guess is provided by a plugin, try to remove that part from the config file.
If that does not help, I would upgrade Jenkins. I think there might be some fixes related to this in the LTS version changelog since 1.509.
And above all... if I were you, I would start making backups of the job configuration files.
I regularly back up the global config.xml, all the job config.xml files and all the plugins. Using these I can set up my Jenkins from scratch. And I do that to set up a test instance where I try any plugin or Jenkins core upgrade. If I see no problems after running a few of the trickiest builds, I know I can upgrade the production instance with much more confidence.

Resources