github.com/devdivbcp/moby@v17.12.0-ce-rc1.0.20200726071732-2d4bfdc789ad+incompatible/Jenkinsfile (about)

     1  #!groovy
     2  pipeline {
     3      agent none
     4  
     5      options {
     6          buildDiscarder(logRotator(daysToKeepStr: '30'))
     7          timeout(time: 2, unit: 'HOURS')
     8          timestamps()
     9      }
    10      parameters {
    11          booleanParam(name: 'unit_validate', defaultValue: true, description: 'amd64 (x86_64) unit tests and vendor check')
    12          booleanParam(name: 'amd64', defaultValue: true, description: 'amd64 (x86_64) Build/Test')
    13          booleanParam(name: 's390x', defaultValue: true, description: 'IBM Z (s390x) Build/Test')
    14          booleanParam(name: 'ppc64le', defaultValue: true, description: 'PowerPC (ppc64le) Build/Test')
    15          booleanParam(name: 'windowsRS1', defaultValue: false, description: 'Windows 2016 (RS1) Build/Test')
    16          booleanParam(name: 'windowsRS5', defaultValue: true, description: 'Windows 2019 (RS5) Build/Test')
    17          booleanParam(name: 'skip_dco', defaultValue: false, description: 'Skip the DCO check')
    18      }
    19      environment {
    20          DOCKER_BUILDKIT     = '1'
    21          DOCKER_EXPERIMENTAL = '1'
    22          DOCKER_GRAPHDRIVER  = 'overlay2'
    23          APT_MIRROR          = 'cdn-fastly.deb.debian.org'
    24          CHECK_CONFIG_COMMIT = '78405559cfe5987174aa2cb6463b9b2c1b917255'
    25          TESTDEBUG           = '0'
    26          TIMEOUT             = '120m'
    27      }
    28      stages {
    29          stage('pr-hack') {
    30              when { changeRequest() }
    31              steps {
    32                  script {
    33                      echo "Workaround for PR auto-cancel feature. Borrowed from https://issues.jenkins-ci.org/browse/JENKINS-43353"
    34                      def buildNumber = env.BUILD_NUMBER as int
    35                      if (buildNumber > 1) milestone(buildNumber - 1)
    36                      milestone(buildNumber)
    37                  }
    38              }
    39          }
    40          stage('DCO-check') {
    41              when {
    42                  beforeAgent true
    43                  expression { !params.skip_dco }
    44              }
    45              agent { label 'amd64 && ubuntu-1804 && overlay2' }
    46              steps {
    47                  sh '''
    48                  docker run --rm \
    49                    -v "$WORKSPACE:/workspace" \
    50                    -e VALIDATE_REPO=${GIT_URL} \
    51                    -e VALIDATE_BRANCH=${CHANGE_TARGET} \
    52                    alpine sh -c 'apk add --no-cache -q bash git openssh-client && cd /workspace && hack/validate/dco'
    53                  '''
    54              }
    55          }
    56          stage('Build') {
    57              parallel {
    58                  stage('unit-validate') {
    59                      when {
    60                          beforeAgent true
    61                          expression { params.unit_validate }
    62                      }
    63                      agent { label 'amd64 && ubuntu-1804 && overlay2' }
    64  
    65                      stages {
    66                          stage("Print info") {
    67                              steps {
    68                                  sh 'docker version'
    69                                  sh 'docker info'
    70                                  sh '''
    71                                  echo "check-config.sh version: ${CHECK_CONFIG_COMMIT}"
    72                                  curl -fsSL -o ${WORKSPACE}/check-config.sh "https://raw.githubusercontent.com/moby/moby/${CHECK_CONFIG_COMMIT}/contrib/check-config.sh" \
    73                                  && bash ${WORKSPACE}/check-config.sh || true
    74                                  '''
    75                              }
    76                          }
    77                          stage("Build dev image") {
    78                              steps {
    79                                  sh 'docker build --force-rm --build-arg APT_MIRROR -t docker:${GIT_COMMIT} .'
    80                              }
    81                          }
    82                          stage("Validate") {
    83                              steps {
    84                                  sh '''
    85                                  docker run --rm -t --privileged \
    86                                    -v "$WORKSPACE/bundles:/go/src/github.com/docker/docker/bundles" \
    87                                    -v "$WORKSPACE/.git:/go/src/github.com/docker/docker/.git" \
    88                                    --name docker-pr$BUILD_NUMBER \
    89                                    -e DOCKER_EXPERIMENTAL \
    90                                    -e DOCKER_GITCOMMIT=${GIT_COMMIT} \
    91                                    -e DOCKER_GRAPHDRIVER \
    92                                    -e VALIDATE_REPO=${GIT_URL} \
    93                                    -e VALIDATE_BRANCH=${CHANGE_TARGET} \
    94                                    docker:${GIT_COMMIT} \
    95                                    hack/validate/default
    96                                  '''
    97                              }
    98                          }
    99                          stage("Docker-py") {
   100                              steps {
   101                                  sh '''
   102                                  docker run --rm -t --privileged \
   103                                    -v "$WORKSPACE/bundles:/go/src/github.com/docker/docker/bundles" \
   104                                    --name docker-pr$BUILD_NUMBER \
   105                                    -e DOCKER_EXPERIMENTAL \
   106                                    -e DOCKER_GITCOMMIT=${GIT_COMMIT} \
   107                                    -e DOCKER_GRAPHDRIVER \
   108                                    -e VALIDATE_REPO=${GIT_URL} \
   109                                    -e VALIDATE_BRANCH=${CHANGE_TARGET} \
   110                                    docker:${GIT_COMMIT} \
   111                                    hack/make.sh \
   112                                      dynbinary-daemon \
   113                                      test-docker-py
   114                                  '''
   115                              }
   116                              post {
   117                                  always {
   118                                      junit testResults: 'bundles/test-docker-py/junit-report.xml', allowEmptyResults: true
   119  
   120                                      sh '''
   121                                      echo "Ensuring container killed."
   122                                      docker rm -vf docker-pr$BUILD_NUMBER || true
   123                                      '''
   124  
   125                                      sh '''
   126                                      echo 'Chowning /workspace to jenkins user'
   127                                      docker run --rm -v "$WORKSPACE:/workspace" busybox chown -R "$(id -u):$(id -g)" /workspace
   128                                      '''
   129  
   130                                      catchError(buildResult: 'SUCCESS', stageResult: 'FAILURE', message: 'Failed to create bundles.tar.gz') {
   131                                          sh '''
   132                                          bundleName=docker-py
   133                                          echo "Creating ${bundleName}-bundles.tar.gz"
   134                                          tar -czf ${bundleName}-bundles.tar.gz bundles/test-docker-py/*.xml bundles/test-docker-py/*.log
   135                                          '''
   136  
   137                                          archiveArtifacts artifacts: '*-bundles.tar.gz', allowEmptyArchive: true
   138                                      }
   139                                  }
   140                              }
   141                          }
   142                          stage("Static") {
   143                              steps {
   144                                  sh '''
   145                                  docker run --rm -t --privileged \
   146                                    -v "$WORKSPACE/bundles:/go/src/github.com/docker/docker/bundles" \
   147                                    --name docker-pr$BUILD_NUMBER \
   148                                    -e DOCKER_GITCOMMIT=${GIT_COMMIT} \
   149                                    -e DOCKER_GRAPHDRIVER \
   150                                    docker:${GIT_COMMIT} \
   151                                    hack/make.sh binary-daemon
   152                                  '''
   153                              }
   154                          }
   155                          stage("Cross") {
   156                              steps {
   157                                  sh '''
   158                                  docker run --rm -t --privileged \
   159                                    -v "$WORKSPACE/bundles:/go/src/github.com/docker/docker/bundles" \
   160                                    --name docker-pr$BUILD_NUMBER \
   161                                    -e DOCKER_GITCOMMIT=${GIT_COMMIT} \
   162                                    -e DOCKER_GRAPHDRIVER \
   163                                    docker:${GIT_COMMIT} \
   164                                    hack/make.sh cross
   165                                  '''
   166                              }
   167                          }
   168                          // needs to be last stage that calls make.sh for the junit report to work
   169                          stage("Unit tests") {
   170                              steps {
   171                                  sh '''
   172                                  docker run --rm -t --privileged \
   173                                    -v "$WORKSPACE/bundles:/go/src/github.com/docker/docker/bundles" \
   174                                    --name docker-pr$BUILD_NUMBER \
   175                                    -e DOCKER_EXPERIMENTAL \
   176                                    -e DOCKER_GITCOMMIT=${GIT_COMMIT} \
   177                                    -e DOCKER_GRAPHDRIVER \
   178                                    -e VALIDATE_REPO=${GIT_URL} \
   179                                    -e VALIDATE_BRANCH=${CHANGE_TARGET} \
   180                                    docker:${GIT_COMMIT} \
   181                                    hack/test/unit
   182                                  '''
   183                              }
   184                              post {
   185                                  always {
   186                                      junit testResults: 'bundles/junit-report.xml', allowEmptyResults: true
   187                                  }
   188                              }
   189                          }
   190                          stage("Validate vendor") {
   191                              steps {
   192                                  sh '''
   193                                  docker run --rm -t --privileged \
   194                                    -v "$WORKSPACE/.git:/go/src/github.com/docker/docker/.git" \
   195                                    --name docker-pr$BUILD_NUMBER \
   196                                    -e DOCKER_EXPERIMENTAL \
   197                                    -e DOCKER_GITCOMMIT=${GIT_COMMIT} \
   198                                    -e DOCKER_GRAPHDRIVER \
   199                                    -e VALIDATE_REPO=${GIT_URL} \
   200                                    -e VALIDATE_BRANCH=${CHANGE_TARGET} \
   201                                    docker:${GIT_COMMIT} \
   202                                    hack/validate/vendor
   203                                  '''
   204                              }
   205                          }
   206                          stage("Build e2e image") {
   207                              steps {
   208                                  sh '''
   209                                  echo "Building e2e image"
   210                                  docker build --build-arg DOCKER_GITCOMMIT=${GIT_COMMIT} -t moby-e2e-test -f Dockerfile.e2e .
   211                                  '''
   212                              }
   213                          }
   214                      }
   215  
   216                      post {
   217                          always {
   218                              sh '''
   219                              echo 'Ensuring container killed.'
   220                              docker rm -vf docker-pr$BUILD_NUMBER || true
   221                              '''
   222  
   223                              sh '''
   224                              echo 'Chowning /workspace to jenkins user'
   225                              docker run --rm -v "$WORKSPACE:/workspace" busybox chown -R "$(id -u):$(id -g)" /workspace
   226                              '''
   227  
   228                              catchError(buildResult: 'SUCCESS', stageResult: 'FAILURE', message: 'Failed to create bundles.tar.gz') {
   229                                  sh '''
   230                                  bundleName=unit
   231                                  echo "Creating ${bundleName}-bundles.tar.gz"
   232                                  tar -czvf ${bundleName}-bundles.tar.gz bundles/junit-report.xml bundles/go-test-report.json bundles/profile.out
   233                                  '''
   234  
   235                                  archiveArtifacts artifacts: '*-bundles.tar.gz', allowEmptyArchive: true
   236                              }
   237                          }
   238                          cleanup {
   239                              sh 'make clean'
   240                              deleteDir()
   241                          }
   242                      }
   243                  }
   244                  stage('amd64') {
   245                      when {
   246                          beforeAgent true
   247                          expression { params.amd64 }
   248                      }
   249                      agent { label 'amd64 && ubuntu-1804 && overlay2' }
   250  
   251                      stages {
   252                          stage("Print info") {
   253                              steps {
   254                                  sh 'docker version'
   255                                  sh 'docker info'
   256                                  sh '''
   257                                  echo "check-config.sh version: ${CHECK_CONFIG_COMMIT}"
   258                                  curl -fsSL -o ${WORKSPACE}/check-config.sh "https://raw.githubusercontent.com/moby/moby/${CHECK_CONFIG_COMMIT}/contrib/check-config.sh" \
   259                                  && bash ${WORKSPACE}/check-config.sh || true
   260                                  '''
   261                              }
   262                          }
   263                          stage("Build dev image") {
   264                              steps {
   265                                  sh '''
   266                                  # todo: include ip_vs in base image
   267                                  sudo modprobe ip_vs
   268  
   269                                  docker build --force-rm --build-arg APT_MIRROR -t docker:${GIT_COMMIT} .
   270                                  '''
   271                              }
   272                          }
   273                          stage("Run tests") {
   274                              steps {
   275                                  sh '''#!/bin/bash
   276                                  # bash is needed so 'jobs -p' works properly
   277                                  # it also accepts setting inline envvars for functions without explicitly exporting
   278                                  set -x
   279  
   280                                  run_tests() {
   281                                          [ -n "$TESTDEBUG" ] && rm= || rm=--rm;
   282                                          docker run $rm -t --privileged \
   283                                            -v "$WORKSPACE/bundles/${TEST_INTEGRATION_DEST}:/go/src/github.com/docker/docker/bundles" \
   284                                            -v "$WORKSPACE/bundles/dynbinary-daemon:/go/src/github.com/docker/docker/bundles/dynbinary-daemon" \
   285                                            -v "$WORKSPACE/.git:/go/src/github.com/docker/docker/.git" \
   286                                            --name "$CONTAINER_NAME" \
   287                                            -e KEEPBUNDLE=1 \
   288                                            -e TESTDEBUG \
   289                                            -e TESTFLAGS \
   290                                            -e TEST_SKIP_INTEGRATION \
   291                                            -e TEST_SKIP_INTEGRATION_CLI \
   292                                            -e DOCKER_GITCOMMIT=${GIT_COMMIT} \
   293                                            -e DOCKER_GRAPHDRIVER \
   294                                            -e TIMEOUT \
   295                                            -e VALIDATE_REPO=${GIT_URL} \
   296                                            -e VALIDATE_BRANCH=${CHANGE_TARGET} \
   297                                            docker:${GIT_COMMIT} \
   298                                            hack/make.sh \
   299                                              "$1" \
   300                                              test-integration
   301                                  }
   302  
   303                                  trap "exit" INT TERM
   304                                  trap 'pids=$(jobs -p); echo "Remaining pids to kill: [$pids]"; [ -z "$pids" ] || kill $pids' EXIT
   305  
   306                                  CONTAINER_NAME=docker-pr$BUILD_NUMBER
   307  
   308                                  docker run --rm -t --privileged \
   309                                    -v "$WORKSPACE/bundles:/go/src/github.com/docker/docker/bundles" \
   310                                    -v "$WORKSPACE/.git:/go/src/github.com/docker/docker/.git" \
   311                                    --name ${CONTAINER_NAME}-build \
   312                                    -e DOCKER_EXPERIMENTAL \
   313                                    -e DOCKER_GITCOMMIT=${GIT_COMMIT} \
   314                                    -e DOCKER_GRAPHDRIVER \
   315                                    docker:${GIT_COMMIT} \
   316                                    hack/make.sh \
   317                                      dynbinary-daemon
   318  
   319                                  # flaky + integration
   320                                  TEST_INTEGRATION_DEST=1 CONTAINER_NAME=${CONTAINER_NAME}-1 TEST_SKIP_INTEGRATION_CLI=1 run_tests test-integration-flaky &
   321  
   322                                  # integration-cli first set
   323                                  TEST_INTEGRATION_DEST=2 CONTAINER_NAME=${CONTAINER_NAME}-2 TEST_SKIP_INTEGRATION=1 TESTFLAGS="-test.run Test(DockerSuite|DockerNetworkSuite|DockerHubPullSuite|DockerRegistrySuite|DockerSchema1RegistrySuite|DockerRegistryAuthTokenSuite|DockerRegistryAuthHtpasswdSuite)/" run_tests &
   324  
   325                                  # integration-cli second set
   326                                  TEST_INTEGRATION_DEST=3 CONTAINER_NAME=${CONTAINER_NAME}-3 TEST_SKIP_INTEGRATION=1 TESTFLAGS="-test.run Test(DockerSwarmSuite|DockerDaemonSuite|DockerExternalVolumeSuite)/" run_tests &
   327  
   328                                  c=0
   329                                  for job in $(jobs -p); do
   330                                          wait ${job} || c=$?
   331                                  done
   332                                  exit $c
   333                                  '''
   334                              }
   335                              post {
   336                                  always {
   337                                      junit testResults: 'bundles/**/*-report.xml', allowEmptyResults: true
   338                                  }
   339                              }
   340                          }
   341                      }
   342  
   343                      post {
   344                          always {
   345                              sh '''
   346                              echo "Ensuring container killed."
   347                              cids=$(docker ps -aq -f name=docker-pr${BUILD_NUMBER}-*)
   348                              [ -n "$cids" ] && docker rm -vf $cids || true
   349                              '''
   350  
   351                              sh '''
   352                              echo "Chowning /workspace to jenkins user"
   353                              docker run --rm -v "$WORKSPACE:/workspace" busybox chown -R "$(id -u):$(id -g)" /workspace
   354                              '''
   355  
   356                              catchError(buildResult: 'SUCCESS', stageResult: 'FAILURE', message: 'Failed to create bundles.tar.gz') {
   357                                  sh '''
   358                                  bundleName=amd64
   359                                  echo "Creating ${bundleName}-bundles.tar.gz"
   360                                  # exclude overlay2 directories
   361                                  find bundles -path '*/root/*overlay2' -prune -o -type f \\( -name '*-report.json' -o -name '*.log' -o -name '*.prof' -o -name '*-report.xml' \\) -print | xargs tar -czf ${bundleName}-bundles.tar.gz
   362                                  '''
   363  
   364                                  archiveArtifacts artifacts: '*-bundles.tar.gz', allowEmptyArchive: true
   365                              }
   366                          }
   367                          cleanup {
   368                              sh 'make clean'
   369                              deleteDir()
   370                          }
   371                      }
   372                  }
   373                  stage('s390x') {
   374                      when {
   375                          beforeAgent true
   376                          expression { params.s390x }
   377                      }
   378                      agent { label 's390x-ubuntu-1804' }
   379  
   380                      stages {
   381                          stage("Print info") {
   382                              steps {
   383                                  sh 'docker version'
   384                                  sh 'docker info'
   385                                  sh '''
   386                                  echo "check-config.sh version: ${CHECK_CONFIG_COMMIT}"
   387                                  curl -fsSL -o ${WORKSPACE}/check-config.sh "https://raw.githubusercontent.com/moby/moby/${CHECK_CONFIG_COMMIT}/contrib/check-config.sh" \
   388                                  && bash ${WORKSPACE}/check-config.sh || true
   389                                  '''
   390                              }
   391                          }
   392                          stage("Build dev image") {
   393                              steps {
   394                                  sh '''
   395                                  docker build --force-rm --build-arg APT_MIRROR -t docker:${GIT_COMMIT} .
   396                                  '''
   397                              }
   398                          }
   399                          stage("Unit tests") {
   400                              steps {
   401                                  sh '''
   402                                  docker run --rm -t --privileged \
   403                                    -v "$WORKSPACE/bundles:/go/src/github.com/docker/docker/bundles" \
   404                                    --name docker-pr$BUILD_NUMBER \
   405                                    -e DOCKER_EXPERIMENTAL \
   406                                    -e DOCKER_GITCOMMIT=${GIT_COMMIT} \
   407                                    -e DOCKER_GRAPHDRIVER \
   408                                    -e VALIDATE_REPO=${GIT_URL} \
   409                                    -e VALIDATE_BRANCH=${CHANGE_TARGET} \
   410                                    docker:${GIT_COMMIT} \
   411                                    hack/test/unit
   412                                  '''
   413                              }
   414                              post {
   415                                  always {
   416                                      junit testResults: 'bundles/junit-report.xml', allowEmptyResults: true
   417                                  }
   418                              }
   419                          }
   420                          stage("Integration tests") {
   421                              environment { TEST_SKIP_INTEGRATION_CLI = '1' }
   422                              steps {
   423                                  sh '''
   424                                  docker run --rm -t --privileged \
   425                                    -v "$WORKSPACE/bundles:/go/src/github.com/docker/docker/bundles" \
   426                                    --name docker-pr$BUILD_NUMBER \
   427                                    -e DOCKER_EXPERIMENTAL \
   428                                    -e DOCKER_GITCOMMIT=${GIT_COMMIT} \
   429                                    -e DOCKER_GRAPHDRIVER \
   430                                    -e TESTDEBUG \
   431                                    -e TEST_SKIP_INTEGRATION_CLI \
   432                                    -e TIMEOUT \
   433                                    -e VALIDATE_REPO=${GIT_URL} \
   434                                    -e VALIDATE_BRANCH=${CHANGE_TARGET} \
   435                                    docker:${GIT_COMMIT} \
   436                                    hack/make.sh \
   437                                      dynbinary \
   438                                      test-integration
   439                                  '''
   440                              }
   441                              post {
   442                                  always {
   443                                      junit testResults: 'bundles/**/*-report.xml', allowEmptyResults: true
   444                                  }
   445                              }
   446                          }
   447                      }
   448  
   449                      post {
   450                          always {
   451                              sh '''
   452                              echo "Ensuring container killed."
   453                              docker rm -vf docker-pr$BUILD_NUMBER || true
   454                              '''
   455  
   456                              sh '''
   457                              echo "Chowning /workspace to jenkins user"
   458                              docker run --rm -v "$WORKSPACE:/workspace" busybox chown -R "$(id -u):$(id -g)" /workspace
   459                              '''
   460  
   461                              catchError(buildResult: 'SUCCESS', stageResult: 'FAILURE', message: 'Failed to create bundles.tar.gz') {
   462                                  sh '''
   463                                  bundleName=s390x-integration
   464                                  echo "Creating ${bundleName}-bundles.tar.gz"
   465                                  # exclude overlay2 directories
   466                                  find bundles -path '*/root/*overlay2' -prune -o -type f \\( -name '*-report.json' -o -name '*.log' -o -name '*.prof' -o -name '*-report.xml' \\) -print | xargs tar -czf ${bundleName}-bundles.tar.gz
   467                                  '''
   468  
   469                                  archiveArtifacts artifacts: '*-bundles.tar.gz', allowEmptyArchive: true
   470                              }
   471                          }
   472                          cleanup {
   473                              sh 'make clean'
   474                              deleteDir()
   475                          }
   476                      }
   477                  }
   478                  stage('s390x integration-cli') {
   479                      when {
   480                          beforeAgent true
   481                          not { changeRequest() }
   482                          expression { params.s390x }
   483                      }
   484                      agent { label 's390x-ubuntu-1804' }
   485  
   486                      stages {
   487                          stage("Print info") {
   488                              steps {
   489                                  sh 'docker version'
   490                                  sh 'docker info'
   491                                  sh '''
   492                                  echo "check-config.sh version: ${CHECK_CONFIG_COMMIT}"
   493                                  curl -fsSL -o ${WORKSPACE}/check-config.sh "https://raw.githubusercontent.com/moby/moby/${CHECK_CONFIG_COMMIT}/contrib/check-config.sh" \
   494                                  && bash ${WORKSPACE}/check-config.sh || true
   495                                  '''
   496                              }
   497                          }
   498                          stage("Build dev image") {
   499                              steps {
   500                                  sh '''
   501                                  docker build --force-rm --build-arg APT_MIRROR -t docker:${GIT_COMMIT} .
   502                                  '''
   503                              }
   504                          }
   505                          stage("Integration-cli tests") {
   506                              environment { TEST_SKIP_INTEGRATION = '1' }
   507                              steps {
   508                                  sh '''
   509                                  docker run --rm -t --privileged \
   510                                    -v "$WORKSPACE/bundles:/go/src/github.com/docker/docker/bundles" \
   511                                    --name docker-pr$BUILD_NUMBER \
   512                                    -e DOCKER_GITCOMMIT=${GIT_COMMIT} \
   513                                    -e DOCKER_GRAPHDRIVER \
   514                                    -e TEST_SKIP_INTEGRATION \
   515                                    -e TIMEOUT \
   516                                    -e VALIDATE_REPO=${GIT_URL} \
   517                                    -e VALIDATE_BRANCH=${CHANGE_TARGET} \
   518                                    docker:${GIT_COMMIT} \
   519                                    hack/make.sh \
   520                                      dynbinary \
   521                                      test-integration
   522                                  '''
   523                              }
   524                              post {
   525                                  always {
   526                                      junit testResults: 'bundles/**/*-report.xml', allowEmptyResults: true
   527                                  }
   528                              }
   529                          }
   530                      }
   531  
   532                      post {
   533                          always {
   534                              sh '''
   535                              echo "Ensuring container killed."
   536                              docker rm -vf docker-pr$BUILD_NUMBER || true
   537                              '''
   538  
   539                              sh '''
   540                              echo "Chowning /workspace to jenkins user"
   541                              docker run --rm -v "$WORKSPACE:/workspace" busybox chown -R "$(id -u):$(id -g)" /workspace
   542                              '''
   543  
   544                              catchError(buildResult: 'SUCCESS', stageResult: 'FAILURE', message: 'Failed to create bundles.tar.gz') {
   545                                  sh '''
   546                                  bundleName=s390x-integration-cli
   547                                  echo "Creating ${bundleName}-bundles.tar.gz"
   548                                  # exclude overlay2 directories
   549                                  find bundles -path '*/root/*overlay2' -prune -o -type f \\( -name '*-report.json' -o -name '*.log' -o -name '*.prof' -o -name '*-report.xml' \\) -print | xargs tar -czf ${bundleName}-bundles.tar.gz
   550                                  '''
   551  
   552                                  archiveArtifacts artifacts: '*-bundles.tar.gz', allowEmptyArchive: true
   553                              }
   554                          }
   555                          cleanup {
   556                              sh 'make clean'
   557                              deleteDir()
   558                          }
   559                      }
   560                  }
   561                  stage('ppc64le') {
   562                      when {
   563                          beforeAgent true
   564                          expression { params.ppc64le }
   565                      }
   566                      agent { label 'ppc64le-ubuntu-1604' }
   567                      // ppc64le machines run on Docker 18.06, and buildkit has some bugs on that version
   568                      environment { DOCKER_BUILDKIT = '0' }
   569  
   570                      stages {
   571                          stage("Print info") {
   572                              steps {
   573                                  sh 'docker version'
   574                                  sh 'docker info'
   575                                  sh '''
   576                                  echo "check-config.sh version: ${CHECK_CONFIG_COMMIT}"
   577                                  curl -fsSL -o ${WORKSPACE}/check-config.sh "https://raw.githubusercontent.com/moby/moby/${CHECK_CONFIG_COMMIT}/contrib/check-config.sh" \
   578                                  && bash ${WORKSPACE}/check-config.sh || true
   579                                  '''
   580                              }
   581                          }
   582                          stage("Build dev image") {
   583                              steps {
   584                                  sh 'docker build --force-rm --build-arg APT_MIRROR -t docker:${GIT_COMMIT} .'
   585                              }
   586                          }
   587                          stage("Unit tests") {
   588                              steps {
   589                                  sh '''
   590                                  docker run --rm -t --privileged \
   591                                    -v "$WORKSPACE/bundles:/go/src/github.com/docker/docker/bundles" \
   592                                    --name docker-pr$BUILD_NUMBER \
   593                                    -e DOCKER_EXPERIMENTAL \
   594                                    -e DOCKER_GITCOMMIT=${GIT_COMMIT} \
   595                                    -e DOCKER_GRAPHDRIVER \
   596                                    -e VALIDATE_REPO=${GIT_URL} \
   597                                    -e VALIDATE_BRANCH=${CHANGE_TARGET} \
   598                                    docker:${GIT_COMMIT} \
   599                                    hack/test/unit
   600                                  '''
   601                              }
   602                              post {
   603                                  always {
   604                                      junit testResults: 'bundles/junit-report.xml', allowEmptyResults: true
   605                                  }
   606                              }
   607                          }
   608                          stage("Integration tests") {
   609                              environment { TEST_SKIP_INTEGRATION_CLI = '1' }
   610                              steps {
   611                                  sh '''
   612                                  docker run --rm -t --privileged \
   613                                    -v "$WORKSPACE/bundles:/go/src/github.com/docker/docker/bundles" \
   614                                    --name docker-pr$BUILD_NUMBER \
   615                                    -e DOCKER_EXPERIMENTAL \
   616                                    -e DOCKER_GITCOMMIT=${GIT_COMMIT} \
   617                                    -e DOCKER_GRAPHDRIVER \
   618                                    -e TESTDEBUG \
   619                                    -e TEST_SKIP_INTEGRATION_CLI \
   620                                    -e TIMEOUT \
   621                                    -e VALIDATE_REPO=${GIT_URL} \
   622                                    -e VALIDATE_BRANCH=${CHANGE_TARGET} \
   623                                    docker:${GIT_COMMIT} \
   624                                    hack/make.sh \
   625                                      dynbinary \
   626                                      test-integration
   627                                  '''
   628                              }
   629                              post {
   630                                  always {
   631                                      junit testResults: 'bundles/**/*-report.xml', allowEmptyResults: true
   632                                  }
   633                              }
   634                          }
   635                      }
   636  
   637                      post {
   638                          always {
   639                              sh '''
   640                              echo "Ensuring container killed."
   641                              docker rm -vf docker-pr$BUILD_NUMBER || true
   642                              '''
   643  
   644                              sh '''
   645                              echo "Chowning /workspace to jenkins user"
   646                              docker run --rm -v "$WORKSPACE:/workspace" busybox chown -R "$(id -u):$(id -g)" /workspace
   647                              '''
   648  
   649                              catchError(buildResult: 'SUCCESS', stageResult: 'FAILURE', message: 'Failed to create bundles.tar.gz') {
   650                                  sh '''
   651                                  bundleName=ppc64le-integration
   652                                  echo "Creating ${bundleName}-bundles.tar.gz"
   653                                  # exclude overlay2 directories
   654                                  find bundles -path '*/root/*overlay2' -prune -o -type f \\( -name '*-report.json' -o -name '*.log' -o -name '*.prof' -o -name '*-report.xml' \\) -print | xargs tar -czf ${bundleName}-bundles.tar.gz
   655                                  '''
   656  
   657                                  archiveArtifacts artifacts: '*-bundles.tar.gz', allowEmptyArchive: true
   658                              }
   659                          }
   660                          cleanup {
   661                              sh 'make clean'
   662                              deleteDir()
   663                          }
   664                      }
   665                  }
   666                  stage('ppc64le integration-cli') {
   667                      when {
   668                          beforeAgent true
   669                          not { changeRequest() }
   670                          expression { params.ppc64le }
   671                      }
   672                      agent { label 'ppc64le-ubuntu-1604' }
   673                      // ppc64le machines run on Docker 18.06, and buildkit has some bugs on that version
   674                      environment { DOCKER_BUILDKIT = '0' }
   675  
   676                      stages {
   677                          stage("Print info") {
   678                              steps {
   679                                  sh 'docker version'
   680                                  sh 'docker info'
   681                                  sh '''
   682                                  echo "check-config.sh version: ${CHECK_CONFIG_COMMIT}"
   683                                  curl -fsSL -o ${WORKSPACE}/check-config.sh "https://raw.githubusercontent.com/moby/moby/${CHECK_CONFIG_COMMIT}/contrib/check-config.sh" \
   684                                  && bash ${WORKSPACE}/check-config.sh || true
   685                                  '''
   686                              }
   687                          }
   688                          stage("Build dev image") {
   689                              steps {
   690                                  sh 'docker build --force-rm --build-arg APT_MIRROR -t docker:${GIT_COMMIT} .'
   691                              }
   692                          }
   693                          stage("Integration-cli tests") {
   694                              environment { TEST_SKIP_INTEGRATION = '1' }
   695                              steps {
   696                                  sh '''
   697                                  docker run --rm -t --privileged \
   698                                    -v "$WORKSPACE/bundles:/go/src/github.com/docker/docker/bundles" \
   699                                    --name docker-pr$BUILD_NUMBER \
   700                                    -e DOCKER_GITCOMMIT=${GIT_COMMIT} \
   701                                    -e DOCKER_GRAPHDRIVER \
   702                                    -e TEST_SKIP_INTEGRATION \
   703                                    -e TIMEOUT \
   704                                    -e VALIDATE_REPO=${GIT_URL} \
   705                                    -e VALIDATE_BRANCH=${CHANGE_TARGET} \
   706                                    docker:${GIT_COMMIT} \
   707                                    hack/make.sh \
   708                                      dynbinary \
   709                                      test-integration
   710                                  '''
   711                              }
   712                              post {
   713                                  always {
   714                                      junit testResults: 'bundles/**/*-report.xml', allowEmptyResults: true
   715                                  }
   716                              }
   717                          }
   718                      }
   719  
   720                      post {
   721                          always {
   722                              sh '''
   723                              echo "Ensuring container killed."
   724                              docker rm -vf docker-pr$BUILD_NUMBER || true
   725                              '''
   726  
   727                              sh '''
   728                              echo "Chowning /workspace to jenkins user"
   729                              docker run --rm -v "$WORKSPACE:/workspace" busybox chown -R "$(id -u):$(id -g)" /workspace
   730                              '''
   731  
   732                              catchError(buildResult: 'SUCCESS', stageResult: 'FAILURE', message: 'Failed to create bundles.tar.gz') {
   733                                  sh '''
   734                                  bundleName=ppc64le-integration-cli
   735                                  echo "Creating ${bundleName}-bundles.tar.gz"
   736                                  # exclude overlay2 directories
   737                                  find bundles -path '*/root/*overlay2' -prune -o -type f \\( -name '*-report.json' -o -name '*.log' -o -name '*.prof' -o -name '*-report.xml' \\) -print | xargs tar -czf ${bundleName}-bundles.tar.gz
   738                                  '''
   739  
   740                                  archiveArtifacts artifacts: '*-bundles.tar.gz', allowEmptyArchive: true
   741                              }
   742                          }
   743                          cleanup {
   744                              sh 'make clean'
   745                              deleteDir()
   746                          }
   747                      }
   748                  }
   749                  stage('win-RS1') {
   750                      when {
   751                          beforeAgent true
   752                          // Skip this stage on PRs unless the windowsRS1 checkbox is selected
   753                          anyOf {
   754                              not { changeRequest() }
   755                              expression { params.windowsRS1 }
   756                          }
   757                      }
   758                      environment {
   759                          DOCKER_BUILDKIT        = '0'
   760                          DOCKER_DUT_DEBUG       = '1'
   761                          SKIP_VALIDATION_TESTS  = '1'
   762                          SOURCES_DRIVE          = 'd'
   763                          SOURCES_SUBDIR         = 'gopath'
   764                          TESTRUN_DRIVE          = 'd'
   765                          TESTRUN_SUBDIR         = "CI"
   766                          WINDOWS_BASE_IMAGE     = 'mcr.microsoft.com/windows/servercore'
   767                          WINDOWS_BASE_IMAGE_TAG = 'ltsc2016'
   768                      }
   769                      agent {
   770                          node {
   771                              customWorkspace 'd:\\gopath\\src\\github.com\\docker\\docker'
   772                              label 'windows-2016'
   773                          }
   774                      }
   775                      stages {
   776                          stage("Print info") {
   777                              steps {
   778                                  sh 'docker version'
   779                                  sh 'docker info'
   780                              }
   781                          }
   782                          stage("Run tests") {
   783                              steps {
   784                                  powershell '''
   785                                  $ErrorActionPreference = 'Stop'
   786                                  [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
   787                                  Invoke-WebRequest https://github.com/moby/docker-ci-zap/blob/master/docker-ci-zap.exe?raw=true -OutFile C:/Windows/System32/docker-ci-zap.exe
   788                                  ./hack/ci/windows.ps1
   789                                  exit $LastExitCode
   790                                  '''
   791                              }
   792                          }
   793                      }
   794                      post {
   795                          always {
   796                              catchError(buildResult: 'SUCCESS', stageResult: 'FAILURE', message: 'Failed to create bundles.tar.gz') {
   797                                  powershell '''
   798                                  $bundleName="windowsRS1-integration"
   799                                  Write-Host -ForegroundColor Green "Creating ${bundleName}-bundles.zip"
   800  
   801                                  # archiveArtifacts does not support env-vars to , so save the artifacts in a fixed location
   802                                  Compress-Archive -Path "${env:TEMP}/CIDUT.out", "${env:TEMP}/CIDUT.err" -CompressionLevel Optimal -DestinationPath "${bundleName}-bundles.zip"
   803                                  '''
   804  
   805                                  archiveArtifacts artifacts: '*-bundles.zip', allowEmptyArchive: true
   806                              }
   807                          }
   808                          cleanup {
   809                              sh 'make clean'
   810                              deleteDir()
   811                          }
   812                      }
   813                  }
   814                  stage('win-RS5') {
   815                      when {
   816                          beforeAgent true
   817                          expression { params.windowsRS5 }
   818                      }
   819                      environment {
   820                          DOCKER_BUILDKIT        = '0'
   821                          DOCKER_DUT_DEBUG       = '1'
   822                          SKIP_VALIDATION_TESTS  = '1'
   823                          SOURCES_DRIVE          = 'd'
   824                          SOURCES_SUBDIR         = 'gopath'
   825                          TESTRUN_DRIVE          = 'd'
   826                          TESTRUN_SUBDIR         = "CI"
   827                          WINDOWS_BASE_IMAGE     = 'mcr.microsoft.com/windows/servercore'
   828                          WINDOWS_BASE_IMAGE_TAG = 'ltsc2019'
   829                      }
   830                      agent {
   831                          node {
   832                              customWorkspace 'd:\\gopath\\src\\github.com\\docker\\docker'
   833                              label 'windows-2019'
   834                          }
   835                      }
   836                      stages {
   837                          stage("Print info") {
   838                              steps {
   839                                  sh 'docker version'
   840                                  sh 'docker info'
   841                              }
   842                          }
   843                          stage("Run tests") {
   844                              steps {
   845                                  powershell '''
   846                                  $ErrorActionPreference = 'Stop'
   847                                  Invoke-WebRequest https://github.com/moby/docker-ci-zap/blob/master/docker-ci-zap.exe?raw=true -OutFile C:/Windows/System32/docker-ci-zap.exe
   848                                  ./hack/ci/windows.ps1
   849                                  exit $LastExitCode
   850                                  '''
   851                              }
   852                          }
   853                      }
   854                      post {
   855                          always {
   856                              catchError(buildResult: 'SUCCESS', stageResult: 'FAILURE', message: 'Failed to create bundles.tar.gz') {
   857                                  powershell '''
   858                                  $bundleName="windowsRS5-integration"
   859                                  Write-Host -ForegroundColor Green "Creating ${bundleName}-bundles.zip"
   860  
   861                                  # archiveArtifacts does not support env-vars to , so save the artifacts in a fixed location
   862                                  Compress-Archive -Path "${env:TEMP}/CIDUT.out", "${env:TEMP}/CIDUT.err" -CompressionLevel Optimal -DestinationPath "${bundleName}-bundles.zip"
   863                                  '''
   864  
   865                                  archiveArtifacts artifacts: '*-bundles.zip', allowEmptyArchive: true
   866                              }
   867                          }
   868                          cleanup {
   869                              sh 'make clean'
   870                              deleteDir()
   871                          }
   872                      }
   873                  }
   874              }
   875          }
   876      }
   877  }