This project offers environment for running Jenkinsfile instances from ci.jenkins.io locally. It is powered by Jenkinsfile Runner and the experimental JFR Maven packaging flow introduced in 1.0-beta-16. 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.
make docker
to build the base imagemake run
to run a simple demomake demo-plugin
to run a demo of the plugin buildThe 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
This repository uses Dependabot to track dependencies and to propose updates. Many plugin and library dependencies actually come from Bills of Materials supplied by the JFR packaging parent POM: Jenkins Core BOM and Jenkins Plugin BOM. It reduces the number of moving parts by consuming the cross-verified plugin versions.
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.
It is also possible to debug Jenkinsfile Runner and Groovy init hooks by passing the remote debug options and exposing the debug port:
docker run --rm -v maven-repo:/root/.m2 \
-v $(pwd)/demo/locale-plugin/:/workspace/ \
-p 5005:5005 -e JAVA_OPTS="-agentlib:jdwp=transport=dt_socket,server=y,address=5005,suspend=y" \
onenashev/ci.jenkins.io-runner
This repository supports profiling of Jenkinsfile Runner with Java Flight Recorder. Due to performance reasons, profiling happens on a local machine instead of the Docker containers.
To run profiling on a Unix machine:
mvn clean package
make jfr-profile
and wait till completiondemo/locale-plugin/work/recording.jfr
file with Java Flight Recorder dumpThis 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.
ci.jenkins.io-runner
is a single-container package with only 1 executor