Skip to content

Commit

Permalink
[FIXED JENKINS-32765] Allow the directory that plugins are exploded i…
Browse files Browse the repository at this point in the history
…nto to be changed

- This really has to be controlled by either a system property or a CLI parameter as we cannot guarantee that any path
  specified in a configuration file in JENKINS_HOME will be valid on another machine where the JENKINS_HOME is mounted
- Obviously Jenkins does not currently support fully starting two Jenkins instances on the same JENKINS_HOME, so this
  fix is to assist in Disaster Recovery (or semi-higher availability) sceanarios where the backup node is being brought
  up. In such cases, the node that failed may not have correctly released all its file handles in the backing NFS share
  and thus could be blocking the recovery node from starting up.
- An additional use case is where the JENKINS_HOME is stored on a remote disk, e.g. a SAN, etc. and the user wants to
  take advantage of the faster local disk to serve the resources from both plugins and Jenkins core. Without this change
  only Jenkins core can be relocated outside of JENKINS_HOME (using the '--webroot=...' command line option).
- Ideally we would introduce this into the extras-executable-war module once the system property has had time to soak
  (although in an ideal world that module would be agnostic of Jenkins and thus it might not be appropriate there)
  • Loading branch information
stephenc committed Feb 4, 2016
1 parent dc2c64e commit d27cff8
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion core/src/main/java/hudson/ClassicPluginStrategy.java
Expand Up @@ -88,6 +88,12 @@ public boolean accept(File dir,String name) {
}
};

/**
* If set this should be the absolute file path to the the base directory for all exploded .hpi/.jpi plugins.
* If {@literal null} then plugins will be exploded into {@literal JENKINS_HOME/plugins}.
*/
private static final String WORK_DIR = System.getProperty(ClassicPluginStrategy.class.getName() + ".WORK_DIR");

private PluginManager pluginManager;

/**
Expand Down Expand Up @@ -162,7 +168,10 @@ private static Manifest loadLinkedManifest(File archive) throws IOException {
if (archive.isDirectory()) {// already expanded
expandDir = archive;
} else {
expandDir = new File(archive.getParentFile(), getBaseName(archive.getName()));
expandDir = WORK_DIR == null
? new File(archive.getParentFile(), getBaseName(archive.getName()))
: new File(WORK_DIR, getBaseName(archive.getName()));
;
explode(archive, expandDir);
}

Expand Down

0 comments on commit d27cff8

Please sign in to comment.