This directory contains resources demonstrating the use of Configuration-as-Code with jenkinsfile-runner.
The provided Jenkinsfile
reads an environment variable that is defined via
JCasC in config/jenkins.yaml
. The config
directory is mounted in the
Docker image to /usr/share/jenkins/ref/casc
, where it is recognized by
Jenkins. Note that this does not need to be a single file, but can be
split up into multiple YAMLs.
When launched, the Pipeline will print the variable that was set via JCasC. Execution log output:
...
[Pipeline] echo
An environment variable configured via JCasC: a value configured via JCasC
...
Once you build the repository, launch the following command in bash:
CASC_JENKINS_CONFIG=config/jenkins.yaml ../../app/target/appassembler/bin/jenkinsfile-runner \
-w ../../vanilla-package/target/war -p ../../vanilla-package/target/plugins/ -f .
docker run --rm -v $PWD:/workspace -v $PWD/config:/usr/share/jenkins/ref/casc ghcr.io/jenkinsci/jenkinsfile-runner:latest