-
-
Notifications
You must be signed in to change notification settings - Fork 300
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Introduce support for slim Jenkinsfile Runner packages (#449)
* Save progress * Get working classloading for slim packaging * Add Slim packaging POM * Update filters so that Winstone is retained * Add Pipeline as YAML to CWP demo * Update more CWP dependencies to get a stable image * Update Plugin Installation Manager from 2.2.0 to 2.5.0
- Loading branch information
1 parent
e0ac5b9
commit 36ccf9e
Showing
23 changed files
with
401 additions
and
58 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
41 changes: 41 additions & 0 deletions
41
...strap/src/main/java/io/jenkins/jenkinsfile/runner/bootstrap/util/OptionalClassLoader.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
package io.jenkins.jenkinsfile.runner.bootstrap.util; | ||
|
||
/** | ||
* Classloader, which might be added to the instance post-factum during the execution. | ||
* In Jenkinsfile Runner it is used to set the plugin classloader once the Jenkins instance is initialized. | ||
*/ | ||
public class OptionalClassLoader extends ClassLoader { | ||
|
||
private final ClassLoader parent; | ||
private ClassLoader optional; | ||
|
||
public OptionalClassLoader(ClassLoader parent) { | ||
this.parent = parent; | ||
} | ||
|
||
public void set(ClassLoader optional) { | ||
this.optional = optional; | ||
} | ||
|
||
@Override | ||
public Class<?> loadClass(String name) throws ClassNotFoundException { | ||
ClassNotFoundException parentException; | ||
try { | ||
return parent.loadClass(name); | ||
} catch (ClassNotFoundException ex) { | ||
parentException = ex; | ||
} | ||
|
||
ClassLoader _opt = optional; | ||
if (_opt != null) { | ||
try { | ||
return _opt.loadClass(name); | ||
} catch (ClassNotFoundException ex) { | ||
ex.addSuppressed(parentException); | ||
throw ex; | ||
} | ||
} | ||
|
||
throw parentException; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
= Jenkinsfile Runner Packaging POM - Slim Edition (Experimental) | ||
:toc: | ||
:toc-placement: preamble | ||
:toclevels: 3 | ||
|
||
This is an experimental parent POM for packaging custom Jenkinsfile Runner images. | ||
It targets slim packaging when Jenkinsfile Runner loads the WAR file and the plugins from external location. | ||
|
||
The parent POM prepares the following artifacts in `target`: | ||
|
||
* `jenkinsfile-runner.zip` Slim Jenkinsfile Runner bundle ZIP (~1.5MB). | ||
This archive needs to be unzipped, there is an executable in `bin/jenkinsfile-runner` | ||
* `war/jenkins.war` - Jenkins WAR file, based on the `jenkins.version` property. | ||
This file needs to be unzipped for consumption in the `-w` option. | ||
* `plugins` - List of plugins based on the declared dependencies. | ||
Parent POM automatically includes the minimum dependencies declared in plugin POM. | ||
== Usage in Docker | ||
|
||
See link:../packaging/docker/unix/adoptopenjdk-8-hotspot/Dockerfile-dev-slim[Dockerfile-dev-slim] for example. | ||
This example also uses additional optimization tricks. | ||
|
||
== Status | ||
|
||
The packaging tool is under active development, | ||
and it may be changed in incompatible way. |
Oops, something went wrong.