Problem with Jenkins plugins when moving to a new computer - jenkins

After moving Jenkins to a new computer I cannot upgrade plugins since it thinks the new version is older than the installer.
I get the following message:
Some plugins could not be loaded due to unsatisfied dependencies. Fix these issues and restart Jenkins to re-enable these plugins.
Dependency errors:
Static Analysis Utilities (1.96)
Update required: Maven Integration plugin (2.12.1) to be updated to 2.17 or higher
Update required: Matrix Project Plugin (1.6) to be updated to 1.7.1 or higher
Update required: OWASP Markup Formatter Plugin (1.3) to be updated to 1.5 or higher
and several more.
I then try to upgarde Maven INtegration polugin (and alla others) it looks like the are installed and Jenkins is restarted. But I get the same error again.
When looking in the plugin folder I see that I have several version of the plugin. I try to remove the different folders and then detect that the old verision is still used even if the new version is available in the folder.
In the pluginmanager/installed the Maven Integration plugin is listed as version 2.12.1 and the possibility to DOWNGRADE to 3.8. 3.8 is the version that I upgrade to.
My conclusion is that during the move of the .jenkins folder to the new computer the dates of the old plugins are getting new values which confuses Jenkins. Is that a correct conclusion? How can I correct it?

Since the folder dates were changed long ago at the old computer I was not able to zip the old .jenkins folder with "correct" dates
However, I found a way forward anyway. I did like this:
Started with a newly installed Jenkins version.
Made sure I had all necessary plugins in the new Jenkins installation
Copied the following folders from the old computers .jenkins zip file:
jobs
nodes
secrets
users
workspace
Then I also moved the files in the .jenkins folder

Related

Some plugins could not be loaded due to unsatisfied dependencies. Fix these issues and restart Jenkins

I was working on jenkins and working fine but i don't know what happened Jenkins shows following errors and no jobs are visible to me after that:
I am new in jenkins please help me to solve this.
As I understand the problem it could happened in cause of downgrading jenkins version or updating plugins "Pipeline: Node and Processes".
You need to restore previous jenkins version or downgrade plugin.
Additionally you can configure jenkins to get plugins' versions which fit your jenkins version in "Manage Jenkins" -> "Manage plugins" -> "Advanced" -> "Update site" and set the version you are currently using (for example https://updates.jenkins.io/stable-2.176/update-center.json)
Jenkins plugins are dependent on Jenkins LTS versions in use. Best way is while installing the Jenkins take latest (but stable) version of plugins.
Since you are using 1.176 version and trying to upgrade the plugins, the latest plugins do not support the older version of Jenkins (since Jenkins follow Parallel incremental development).
You can resolve the problem in 2 ways.
1. Downgrade the plugins and keep the LTS Jenkins version as it is. (not preferred solution since you will not be able to use latest functionality of the plugins and using old plugins is not secured).
Downgrade of plugins will also be suggested by Manage Jenkins --> Manage Plugins --> Installed
2. Upgrade Jenkins version (LTS 2.24x.x)
It is time taking option, but if you are heavely using jenkins for your work it is more suggested to upgrade the version. Besides new plugins have more secured and vast functionalities.
You can check the Changelog and can decided which version is good for you.
Take a reference of Upgrading Jenkins link.
To understand plugins and Jenkins LTS version dependency, use Jenkins wiki(Confluence Page).
e.g. Pipeline:Node and Processes plugin wiki indicates that for version 2.29 you need to have Jenkins version 1.150.1 or higher.
Note: Latest Jenkins version supports HTTPS instead of HTTP URL for advanced proxy options under Manager Jenkins.

How to install jenkins offline?

I could successfully install the jenkins online over my laptop. But while trying to install the jenkins offline (on my office workstation which cannot be connected to internet) the hell breaks loose.
After running the jenkins.war over command line although the jenkins was successfully installed yet some of the plugins were missing.I managed to get some help from the post How to install a plugin in Jenkins manually?
But then each of the plugins have to be individually downloaded and then copied over to my offline machine. So I had a trick.
I copied all the folders under .jenkins directory (in my online installation machine) and then copied them to my offline machine. Whoa!
It worked!
But I still get one single error:
Maven Integration Plugin V2.16 .javadoc 1.0 is missing. To fix, install v1.0 or later
So is there a way/website/pdf/repository which is a one stop solution/steps to smoothly install (read has all the required dependencies as a zip) Jenkins in offline mode. (If not, to the creators of Jenkins: Would it be a good idea to have one?)
I'm also searching for an easy way to manage the dependencies between the plugins but as far as I know there is no official tool for that.
Either you have a .zip file with all the plugins which you prepare one time or you fix the errors manually.
For your problem it should be enough to install the following .hpi file: https://updates.jenkins-ci.org/latest/javadoc.hpi (javadoc has no dependencies to other plugins)
You can download the .hpi version of plugins required and paste them in plugins folder at jenkins_home and then restart the jenkins,then you can able to use those plugins.

Jenkins plugin upgrade

I have a large fleet of Jenkins instances running in a cluster, all having the LDAP plugin version 1.6 (Jenkins version 1.611). I want to fleet-upgrade the LDAP plugin version to 1.7 (to incorporate environment variables in my plugin configuration). How do I achieve this without manually uploading 1.7 version through UI for each Jenkins instance?
I tried writing a script which basically performs these operations for each Jenkins instance:
Replace the existing .jpi/.hpi file in $JENKINS_HOME/plugins for ldap plugin with the correct .hpi file (of the 1.7 version)
Edit config.xml under $JENKINS_HOME which has the version number
Safe restart Jenkins
It works fine till step 2 but as soon as I perform safe restart, Jenkins magically puts in the original .jpi/.hpi file (the 1.6 version file) back inside $JENKINS_HOME/plugins. Jenkins instance has the 1.6 plugin version again in the UI. Is there a better way to perform fleet plugin upgrades in general? I want to mention that I want the 1.7 plugin version, not the latest
How do I fix this? I even tried using curl (mentioned at https://stackoverflow.com/a/20848745/1746529) but didn't help.
Got a working answer on Google groups.
"As you are on 1.x create an empty ldap.jpi.pinned file as a sibling and that marker will instruct Jenkins not to replace with the bundled plugin."
Came across the documentation for it as well - https://wiki.jenkins-ci.org/display/JENKINS/Pinned+Plugins

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)

What is difference between .hpi and .jpi of Jenkins plugins?

I have installed Jenkins plugins in two ways i.e. manually keeping the .hpi file in Jenkins home directory, and installing from Jenkins front-end (Manage Jenkins > Manage Plugins).
What I notice here is when I install the plugin manually (downloaded as .hpi file) it installed with extension .hpi and while installing the plugin through Jenkins front-end I notice that plugin again installed as .jpi.
But why? What is going on in the background? I know functionality won't change but it looks interesting to know.
Both are supposed to be identical to that extend that Jenkins is renaming hpi to jpi when you install it manually as you said.
The reason why you see both in your JENKINS_HOME is the order in which plugins are loaded when Jenkins boots up: plugin.jpi gets precedence over plugin.hpi in case both are present. This is the way the upload installation makes sure the uploaded version will override the existing one after the restart.
Well I think its because Jenkins forked from Hudson so that is the 'H' in hpi. The J is obviously a change to that.
In terms of technology, the jpi plugins are generated using the gradle plugin architecture and hpi plugins are generated with the Maven architecture
Ultimately, as you have found both produce plugins which Jenkins can use. The vast majority are built using Maven but I am a fan of Gradle as it links nicely in with developing plugins in Groovy. You can also build in Groovy using Maven
Plugins as present in $JENKINS_HOME/plugins/ should always be using the .jpi suffix (with the basename being the plugin identifier). Normally Jenkins will enforce this naming pattern even when uploading a plugin manually, regardless of what filename you used for the upload, so I am not sure how you came to have a *.hpi file here, unless you directly copied it into this filesystem location.

Resources