As we know Jenkins is one of the most used opensource automation tools. Since it is highly reliable and stable, it is highly recommended for enterprise CICD and another automation purpose. Although it is highly reliable and stable, we need to be careful when we upgrade Jenkins to new versions of Jenkins. Especially, when we have a big set of plugins, we should take care of the stability of Jenkins. So, in this article, we will discuss Upgrading Jenkins and Post Upgrade Activities.
Table of Contents
Step by Step Upgrading Jenkins.
Just simply follow the following steps to upgrading Jenkins for respective Operating system.
For Linux Based Operation system.
Step 1: Check the current version of your Jenkins:
Go to your Jenkins URL and scroll down to the right bottom corner to see the current version of your Jenkins.
Or
Simply run the following command on your Jenkins’ server to check your Jenkins Version
java -jar jenkins-cli.jar -s http://localhost:8080/ version
Step 2: Get the downloadable war file:
Go to Your Jenkins Home. Then, Go to Manage Jenkins and there you will see the new version notification with the download button as shown in the screenshot.
So, we have the version 2.222.1 to upgrade your Jenkins. Simply click the download button and get the war file or copy the link of the war file (Right-click and “Copy link address”). Then Run wget command to download the content.
mkdir ~/temp_path
cd ~/temp_path
wget http://updates.jenkins-ci.org/download/war/2.222.1/jenkins.war
Step 3: Update the Jenkins libs and binaries
If you have installed the Jenkins with Yum, just run
sudo yum update jenkins
If the Jenkins were installed with apt, then run
sudo apt-get update jenkins.
So, what ever package manager you used to install, just update once with the file.
Step 4: Find the Path of the executable-war file.
To know the path of Jenkins’s executable-war file, go to Jenkins Home, then, Click Manage Jenkins, Then, click System Information. Then, you will see the path of an executable war file as shown in the below screenshot.
Step 5: Replace the newly downloaded war file.
Take a backup of the jenkins.war file from the executable-war path.
cp /usr/lib/jenkins/jenkins.war /temp_path/jenkins.war.backup
Now just replace the newly downloaded war file from the executable-war file path.
cp /temp_path/jenkins.war /usr/lib/jenkins/
Step 6: Gracefully restart the Jenkins
Now, simply restart the Jenkins to complete the upgrading process by running following command.
java -jar jenkins-cli.jar -s http://localhost:8080/ restart
That’s is, Now the Jenkins is upgraded to the newer version. You can check it by the cli.jar command as per the Step 1.
For Windows Based Operating system
In windows. Upgrading Jenkins is simple. Most of the time, you will see the button right next to the New version notification on Manage Jenkins page. Just click it to Upgrade. But sometime, the button will not be available. In that case, just follow the following steps.
- Check the executable-war file path as per Step 4 of the Linux process.
- Take back up of war file from the executable-war file path.
- Download and copy the new jenkins.war file there.
- Restart the Jenkins Service.
- Then visit the Jenkins Home page to finish the Upgrade process.
For MacOS.
In MacOS, it is exactly same as Linux based OS. In simple steps
- Download jenkins.war file from Manage Jenkins page.
- Find the executable-war file path.
- Take back up of existing war file
- Replace the newly downloaded jenkins.war file.
- Restart the service.
Now, we should take care of some activities to ensure the stability and reliability of your Jenkins.
Post Upgrade Activates.
We might not need all the following activities need to be done but do check all the listed activities after the upgrade of Jenkins.
- Update all the installed plugins. To do so, Go to Manage Jenkins, then, click Manage Plugins, then, click “updates” Tab. Then Select plugins that need to be upgraded and then click “Download now and install after restart” button.
- Check the Connection to the Jenkins Slaves. To check this, Go to Manage Jenkins, Then Click Manage Nodes then check the slaves. If any of your slaves is offline, Then Make it online.
- Examine Agent to Master Security subsystem. For this, Go to Manage Jenkins, Then Click Configure global security then, go to Plugin Manager Section and check in the “Enable Slave -> Master Access Control”.
- Manage Old Data. Sometimes, The Format of data stored inside Jenkins will vary for certain Jenkins versions. This needs to be properly addressed. To do so, click the Manage Jenkins. Then, click Manage Old Data then, check for the old data. If it is available, then you can always change it back to when you Downgrade your Jenkins with the backup war file, we have taken in Step 5. If you do not have any problem after the Upgrade, no need to change the version here.
These are the major activities that need to be verified right after upgrading Jenkins. Once after verifying all the above activities, you can say that you upgrade process is successful.
Conclusion
In this article, we have discussed the process of Upgrading Jenkins and some Post Upgrade tasks on various operating system. There are always corner cases and exceptional situations which might block our upgrade process. As we already discussed, Jenkins is the most popular opensource automation tool and we have huge community to support Jenkins issues. If you couldn’t find answers, Comment below your situation and DigitalVarys will try to help you in that. Stay tuned and subscribe DigitalVarys for more articles and study materials on DevOps, Agile, DevSecOps and App Development.
Certified Cloud Automation Architect and DevSecOps expert, skilled in optimizing IT workflows with Six Sigma and Value Stream Management. Proficient in both technical and leadership roles, I deliver robust solutions and lead teams to success.