|  | @@ -1,32 +1,70 @@
 | 
	
		
			
				|  |  |  #!groovy
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | +pipeline {
 | 
	
		
			
				|  |  | +    agent none
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    options {
 | 
	
		
			
				|  |  | +        skipDefaultCheckout(true)
 | 
	
		
			
				|  |  | +        buildDiscarder(logRotator(daysToKeepStr: '30'))
 | 
	
		
			
				|  |  | +        timeout(time: 2, unit: 'HOURS')
 | 
	
		
			
				|  |  | +        timestamps()
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    environment {
 | 
	
		
			
				|  |  | +        TAG = tag()
 | 
	
		
			
				|  |  | +        BUILD_TAG = tag()
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    stages {
 | 
	
		
			
				|  |  | +        stage('Build test images') {
 | 
	
		
			
				|  |  | +            parallel {
 | 
	
		
			
				|  |  | +                stage('alpine') {
 | 
	
		
			
				|  |  | +                    agent {
 | 
	
		
			
				|  |  | +                        label 'ubuntu && amd64 && !zfs'
 | 
	
		
			
				|  |  | +                    }
 | 
	
		
			
				|  |  | +                    steps {
 | 
	
		
			
				|  |  | +                        buildImage('alpine')
 | 
	
		
			
				|  |  | +                    }
 | 
	
		
			
				|  |  | +                }
 | 
	
		
			
				|  |  | +                stage('debian') {
 | 
	
		
			
				|  |  | +                    agent {
 | 
	
		
			
				|  |  | +                        label 'ubuntu && amd64 && !zfs'
 | 
	
		
			
				|  |  | +                    }
 | 
	
		
			
				|  |  | +                    steps {
 | 
	
		
			
				|  |  | +                        buildImage('debian')
 | 
	
		
			
				|  |  | +                    }
 | 
	
		
			
				|  |  | +                }
 | 
	
		
			
				|  |  | +            }
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +}
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  |  def buildImage(baseImage) {
 | 
	
		
			
				|  |  | -  def image
 | 
	
		
			
				|  |  | -  wrappedNode(label: "ubuntu && amd64 && !zfs", cleanWorkspace: true) {
 | 
	
		
			
				|  |  | -    stage("build image for \"${baseImage}\"") {
 | 
	
		
			
				|  |  | -      def scmvar = checkout(scm)
 | 
	
		
			
				|  |  | -      def imageName = "dockerbuildbot/compose:${baseImage}-${scmvar.GIT_COMMIT}"
 | 
	
		
			
				|  |  | -      image = docker.image(imageName)
 | 
	
		
			
				|  |  | -      try {
 | 
	
		
			
				|  |  | -        image.pull()
 | 
	
		
			
				|  |  | -      } catch (Exception exc) {
 | 
	
		
			
				|  |  | -        sh """docker build -t ${imageName} \\
 | 
	
		
			
				|  |  | -            --target build \\
 | 
	
		
			
				|  |  | -            --build-arg BUILD_PLATFORM="${baseImage}" \\
 | 
	
		
			
				|  |  | -            --build-arg GIT_COMMIT="${scmvar.GIT_COMMIT}" \\
 | 
	
		
			
				|  |  | -            .\\
 | 
	
		
			
				|  |  | -        """
 | 
	
		
			
				|  |  | -        sh "docker push ${imageName}"
 | 
	
		
			
				|  |  | -        echo "${imageName}"
 | 
	
		
			
				|  |  | -        return imageName
 | 
	
		
			
				|  |  | -      }
 | 
	
		
			
				|  |  | +    def scmvar = checkout(scm)
 | 
	
		
			
				|  |  | +    def imageName = "dockerbuildbot/compose:${baseImage}-${scmvar.GIT_COMMIT}"
 | 
	
		
			
				|  |  | +    image = docker.image(imageName)
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    withDockerRegistry(credentialsId:'dockerbuildbot-index.docker.io') {
 | 
	
		
			
				|  |  | +        try {
 | 
	
		
			
				|  |  | +            image.pull()
 | 
	
		
			
				|  |  | +        } catch (Exception exc) {
 | 
	
		
			
				|  |  | +            ansiColor('xterm') {
 | 
	
		
			
				|  |  | +                sh """docker build -t ${imageName} \\
 | 
	
		
			
				|  |  | +                    --target build \\
 | 
	
		
			
				|  |  | +                    --build-arg BUILD_PLATFORM="${baseImage}" \\
 | 
	
		
			
				|  |  | +                    --build-arg GIT_COMMIT="${scmvar.GIT_COMMIT}" \\
 | 
	
		
			
				|  |  | +                    .\\
 | 
	
		
			
				|  |  | +                """
 | 
	
		
			
				|  |  | +                sh "docker push ${imageName}"
 | 
	
		
			
				|  |  | +            }
 | 
	
		
			
				|  |  | +            echo "${imageName}"
 | 
	
		
			
				|  |  | +            return imageName
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  | -  }
 | 
	
		
			
				|  |  | -  echo "image.id: ${image.id}"
 | 
	
		
			
				|  |  | -  return image.id
 | 
	
		
			
				|  |  |  }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -def get_versions(imageId, number) {
 | 
	
		
			
				|  |  | +def get_versions(number) {
 | 
	
		
			
				|  |  |    def docker_versions
 | 
	
		
			
				|  |  |    wrappedNode(label: "ubuntu && amd64 && !zfs") {
 | 
	
		
			
				|  |  |      docker_versions = sh(script:"""
 | 
	
	
		
			
				|  | @@ -42,7 +80,6 @@ def runTests = { Map settings ->
 | 
	
		
			
				|  |  |    def dockerVersions = settings.get("dockerVersions", null)
 | 
	
		
			
				|  |  |    def pythonVersions = settings.get("pythonVersions", null)
 | 
	
		
			
				|  |  |    def baseImage = settings.get("baseImage", null)
 | 
	
		
			
				|  |  | -  def imageName = settings.get("image", null)
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |    if (!pythonVersions) {
 | 
	
		
			
				|  |  |      throw new Exception("Need Python versions to test. e.g.: `runTests(pythonVersions: 'py37')`")
 | 
	
	
		
			
				|  | @@ -54,7 +91,8 @@ def runTests = { Map settings ->
 | 
	
		
			
				|  |  |    { ->
 | 
	
		
			
				|  |  |      wrappedNode(label: "ubuntu && amd64 && !zfs", cleanWorkspace: true) {
 | 
	
		
			
				|  |  |        stage("test python=${pythonVersions} / docker=${dockerVersions} / baseImage=${baseImage}") {
 | 
	
		
			
				|  |  | -        checkout(scm)
 | 
	
		
			
				|  |  | +        def scmvar = checkout(scm)
 | 
	
		
			
				|  |  | +        def imageName = "dockerbuildbot/compose:${baseImage}-${scmvar.GIT_COMMIT}"
 | 
	
		
			
				|  |  |          def storageDriver = sh(script: 'docker info | awk -F \': \' \'$1 == "Storage Driver" { print $2; exit }\'', returnStdout: true).trim()
 | 
	
		
			
				|  |  |          echo "Using local system's storage driver: ${storageDriver}"
 | 
	
		
			
				|  |  |          sh """docker run \\
 |