Page MenuHomePhabricator

Port existing `differential-docker-test` job to Jenkinsfile/Groovy
Closed, ResolvedPublic


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.

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: ''
        if (! fileExists('')) {
            error('No found in repo root!')

    stage('Build') {
        jobImg ="${jobName}", '-f .')

    stage('Test') {
        sh "docker run --rm -t ${jobName}"


The default 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:

thcipriani claimed this task. 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.