github.com/connyay/libcompose@v0.4.0/Jenkinsfile (about)

     1  
     2  wrappedNode(label: 'linux && x86_64') {
     3    deleteDir()
     4    checkout scm
     5    def image
     6    try {
     7      stage "build image"
     8      image = docker.build("dockerbuildbot/libcompose:${gitCommit()}")
     9  
    10      stage "validate"
    11      makeTask(image, "validate")
    12  
    13      stage "test"
    14      makeTask(image, "test", ["DAEMON_VERSION=all", "SHOWWARNING=false"])
    15  
    16      stage "build"
    17      makeTask(image, "cross-binary")
    18    } finally {
    19      try { archive "bundles" } catch (Exception exc) {}
    20      if (image) { sh "docker rmi ${image.id} ||:" }
    21    }
    22  }
    23  
    24  def makeTask(image, task, envVars=null) {
    25    // could send in the full list of envVars for each call or provide default env vars like this:
    26    withEnv((envVars ?: []) + ["LIBCOMPOSE_IMAGE=${image.id}"]) { // would need `def image` at top level of file instead of in the nested block
    27      withChownWorkspace {
    28        timeout(60) {
    29          sh "make -e ${task}"
    30        }
    31      }
    32    }
    33  }