This project offers environment for running Jenkinsfile instances from ci.jenkins.io locally. It is powered by Jenkinsfile Runner and Custom WAR Packager. If you want a classic runtime Jenkins master with agents, checkout my Jenkins Configuration-as-code demo.
The runner can execute buildPlugin()
builds and some other commands from
the Jenkins Pipeline Library.
In particular, it is possible to run builds against multiple JDK and Jenkins core version combinations.
See the Limitations section below for some of known limitations.
- Checkout this repo
- Run
make docker
to build the base image - Run
make clean build
to build the Jenkinsfile Runner image - Run
make run
to run a simple demo - Run
make demo-plugin
to run a demo of the plugin build
The runner can be invoked against a workspace which contains a Jenkinsfile
and, if needed, the project's sourcecode.
docker run --rm -v maven-repo:/root/.m2 \
-v $(pwd)/demo/locale-plugin/:/workspace/ \
onenashev/ci.jenkins.io-runner
Jenkins Pipeline library may be passed from a volume so that it is possible to test a local snapshot.
docker run --rm -v maven-repo:/root/.m2 \
-v ${MY_PIPELINE_LIBRARY_DIR}:/var/jenkins_home/pipeline-library \
-v $(pwd)/demo/locale-plugin/:/workspace/ \
onenashev/ci.jenkins.io-runner
Current versions of Custom WAR Packager are not good at preventing
upper bound conflicts between plugins (JENKINS-51068).
In order to work it around, this repository uses pom.xml
as an input instead of defining plugins in YAML directly.
So it is possible to ensure that the plugin set is OK just by running mvn clean verify
.
As a second advantage, usage of pom.xml allows using Dependabot to track dependencies and to propose updates. This dependency management is quite dangerous, because there is no CI created for this repository so far.
To debug the execution, you can pass the JFR_LOCAL_WORKSPACE=true
environment variable to the image.
It will make the builder to execute Pipeline directly
This project has just started, so it has some downsides being compared to the runtime Pipeline Development instance here. All of the limitations below can be improved in the future.
- A custom fork of Jenkins Pipeline Library is needed to run it
ci.jenkins.io-runner
is a single-container package with only 1 executor- Only JDK8 and JDK11 are provided in the image
- Windows steps are not supported
- Docker-in-Docker is not supported. Steps like
runATH()
andrunPCT()
will not work - The runner uses the recent Debian version, and hence it is affected by SUREFIRE-1588. Plugin POM 3.28 or above should be used to run the build successfully
- Docker image is pretty big. It bundles two versions of JDK for starters, but it needs some optimization in any case.