This project aims to demonstrate how to execute pipeline-like Jenkins jobs represented in a JSON structure.
Item | Type | Product Referece | Project Ref |
---|---|---|---|
make | script | https://www.gnu.org/s/make/manual/make.html | MakeFile |
docker | platform service | https://www.docker.com/ | Dockerfiles |
docker-compose | tool | https://docs.docker.com/compose/ | docker-compose.yml |
jenkins | ci/cd | https://jenkins.io/ | |
dsl | script | https://jenkins.io/doc/book/pipeline/syntax/ | jsonPipeline.groovy |
groovy | language | https://groovy-lang.org/documentation.html | nopipeline |
python | language | https://docs.python.org/3/ |
Following a resemblance of the 3musketeers pattern Makefile is used to build and run Jenkins locally, but also enable executing from CI tools that integrate with Docker and make.
make run-jenkins
Using the credentials below for http://localhost:8080
- user
admin
- password
admin
Find the Jenkins job json-nopipeline and click Build Now
. Access the jenkins build console to see the output.
Backup /var/jenkins_home and update plugins.txt.
make stop-jenkins
The JSON noPipeline implements a lightweight Jenkins scripted pipeline that includes a Jenkins shared library. The jsonPipeline interprets the JSON to dynamically execute pipeline-like stages.
// include the shared library
jsl = library(
identifier: "jsl@master",
retriever: modernSCM([
$class: 'GitSCMSource',
remote: 'https://github.com/iscooter/nopipeline-jsl.git'
])
)
// start the pipeline
wrapper(
pipeline: "json",
library: jsl,
json: "hello-world"
)
The functional container integration is coming soon. The hello-world.json is available to the pipeline as a resource in one of the Jenkins shared libraries.
{
"DockerContainer": "amazonlinux",
"Pipeline": {
"Stage1": {
"State": "Enabled",
"LogLevel": "INFO",
"Payload": {
"arg1": "hello-world"
}
}
}
}
- jenkinsci/docker for jenkins/jenkins:lts
- foxylion/docker-jenkins for default-user.groovy, slave Dockerfile/slave.py