Issue
-
I am trying to upgrade my controller war version using a cluster operation and it is failing with the following error:
[ERROR] Jenkins upgrade not supported in this running mode
Resolution
The cluster operation used to upgrade the war file, takes advantage of the public method canRewriteHudsonWar()
included in the Lifecycle.java
class in the Jenkins core code (class code in main)
If this method returns false, that means that upgrading the war is not possible and thus the cluster operation will fail.
You can use the script below to get additional details on your controller instance that can help you understand why the method is returning a false value.
In the controller where the cluster operation is failing, go to Manage Jenkins->Script Console and run the script shown below:
import java.io.File; //this is the condition that has to be true for the war to be rewritten println "Can this war be upgraded using a cluster operation? "+ hudson.lifecycle.Lifecycle.get().canRewriteHudsonWar() //To get this condition, you need the path to the war if (System.getProperty("executable-war")!= null) println "War Location: "+System.getProperty("executable-war") // You also need the file (it cannot be null) java.io.File f= new java.io.File(System.getProperty("executable-war")) //You need write permissions on the parent file java.io.File parent= f.getParentFile() println "Do we have write permission in the parent folder of the war? "+parent.canWrite()
Once that you determine why the method is returning false you will be in the position to determine where the limitation is coming from, and if it is coming from a lack of permissions, correct it and run the cluster operation successfully.