We've talked about experimenting with the Jenkins Pipeline DSL for driving the new release pipeline. Let's find out if it's viable by attempting to port the existing differential-docker-test job to use it. If successful, it may prove a good starting point for the rest of the Build PoC.
Description
Status | Subtype | Assigned | Task | ||
---|---|---|---|---|---|
Resolved | thcipriani | T161661 Install Jenkins Pipeline Plugin for ci-staging and verify its basic functionality | |||
Resolved | thcipriani | T161659 Port existing `differential-docker-test` job to Jenkinsfile/Groovy |
Event Timeline
Looks like there's a Docker Pipeline plugin that might provide what we need for this.
I played with this a bit today, needs some more refinement but the Dockerfile plugin made it pretty easy. The docker pipeline plugin also supports pushing to private registries which we could add as a stage in the pipeline.
Here's what I got working:
node { def jobName = "${JOB_NAME}:${BUILD_ID}".toLowerCase() def jobImg stage('Setup') { git url: 'https://github.com/wikimedia/scap' if (! fileExists('Dockerfile.ci')) { error('No Dockerfile.ci found in repo root!') } } stage('Build') { jobImg = docker.build("${jobName}", '-f Dockerfile.ci .') } stage('Test') { sh "docker run --rm -t ${jobName}" } }
The default jobImg.run() uses docker run -d so you don't see the shell output. I suppose this mostly leaves the phab wrangling to replace differential-docker-test.
You can see the job in action here: http://ci-staging-jenkins.wmflabs.org/ci/job/Jenkinsfile.docker/
http://ci-staging-jenkins.wmflabs.org/ci/job/Jenkinsfile.docker/ does the same thing as the differential-docker-test job.
There is probably no need to port this work over to production jenkins, but it was a good initial PoC for learning Jenkinsfile format and Docker pipeline formatting.