github.com/jfrazelle/docker@v1.1.2-0.20210712172922-bf78e25fe508/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: 'validate_force', defaultValue: false, description: 'force validation steps to be run, even if no changes were detected')
    13          booleanParam(name: 'amd64', defaultValue: true, description: 'amd64 (x86_64) Build/Test')
    14          booleanParam(name: 'rootless', defaultValue: true, description: 'amd64 (x86_64) Build/Test (Rootless mode)')
    15          booleanParam(name: 'cgroup2', defaultValue: true, description: 'amd64 (x86_64) Build/Test (cgroup v2)')
    16          booleanParam(name: 'arm64', defaultValue: true, description: 'ARM (arm64) Build/Test')
    17          booleanParam(name: 's390x', defaultValue: false, description: 'IBM Z (s390x) Build/Test')
    18          booleanParam(name: 'ppc64le', defaultValue: false, description: 'PowerPC (ppc64le) Build/Test')
    19          booleanParam(name: 'windowsRS1', defaultValue: false, description: 'Windows 2016 (RS1) Build/Test')
    20          booleanParam(name: 'windowsRS5', defaultValue: true, description: 'Windows 2019 (RS5) Build/Test')
    21          booleanParam(name: 'windows2022', defaultValue: true, description: 'Windows 2022 (SAC) Build/Test')
    22          booleanParam(name: 'windows2022containerd', defaultValue: true, description: 'Windows 2022 (SAC) with containerd Build/Test')
    23          booleanParam(name: 'dco', defaultValue: true, description: 'Run the DCO check')
    24      }
    25      environment {
    26          DOCKER_BUILDKIT     = '1'
    27          DOCKER_EXPERIMENTAL = '1'
    28          DOCKER_GRAPHDRIVER  = 'overlay2'
    29          APT_MIRROR          = 'cdn-fastly.deb.debian.org'
    30          CHECK_CONFIG_COMMIT = '2b0755b936416834e14208c6c37b36977e67ea35'
    31          TESTDEBUG           = '0'
    32          TIMEOUT             = '120m'
    33      }
    34      stages {
    35          stage('pr-hack') {
    36              when { changeRequest() }
    37              steps {
    38                  script {
    39                      echo "Workaround for PR auto-cancel feature. Borrowed from https://issues.jenkins-ci.org/browse/JENKINS-43353"
    40                      def buildNumber = env.BUILD_NUMBER as int
    41                      if (buildNumber > 1) milestone(buildNumber - 1)
    42                      milestone(buildNumber)
    43                  }
    44              }
    45          }
    46          stage('DCO-check') {
    47              when {
    48                  beforeAgent true
    49                  expression { params.dco }
    50              }
    51              agent { label 'amd64 && ubuntu-1804 && overlay2' }
    52              steps {
    53                  sh '''
    54                  docker run --rm \
    55                    -v "$WORKSPACE:/workspace" \
    56                    -e VALIDATE_REPO=${GIT_URL} \
    57                    -e VALIDATE_BRANCH=${CHANGE_TARGET} \
    58                    alpine sh -c 'apk add --no-cache -q bash git openssh-client && cd /workspace && hack/validate/dco'
    59                  '''
    60              }
    61          }
    62          stage('Build') {
    63              parallel {
    64                  stage('unit-validate') {
    65                      when {
    66                          beforeAgent true
    67                          expression { params.unit_validate }
    68                      }
    69                      agent { label 'amd64 && ubuntu-1804 && overlay2' }
    70                      environment {
    71                          // On master ("non-pull-request"), force running some validation checks (vendor, swagger),
    72                          // even if no files were changed. This allows catching problems caused by pull-requests
    73                          // that were merged out-of-sequence.
    74                          TEST_FORCE_VALIDATE = sh returnStdout: true, script: 'if [ "${BRANCH_NAME%%-*}" != "PR" ] || [ "${CHANGE_TARGET:-master}" != "master" ] || [ "${validate_force}" = "true" ]; then echo "1"; fi'
    75                      }
    76  
    77                      stages {
    78                          stage("Print info") {
    79                              steps {
    80                                  sh 'docker version'
    81                                  sh 'docker info'
    82                                  sh '''
    83                                  echo "check-config.sh version: ${CHECK_CONFIG_COMMIT}"
    84                                  curl -fsSL -o ${WORKSPACE}/check-config.sh "https://raw.githubusercontent.com/moby/moby/${CHECK_CONFIG_COMMIT}/contrib/check-config.sh" \
    85                                  && bash ${WORKSPACE}/check-config.sh || true
    86                                  '''
    87                              }
    88                          }
    89                          stage("Build dev image") {
    90                              steps {
    91                                  sh 'docker build --force-rm --build-arg APT_MIRROR --build-arg CROSS=true -t docker:${GIT_COMMIT} .'
    92                              }
    93                          }
    94                          stage("Validate") {
    95                              steps {
    96                                  sh '''
    97                                  docker run --rm -t --privileged \
    98                                    -v "$WORKSPACE/bundles:/go/src/github.com/docker/docker/bundles" \
    99                                    -v "$WORKSPACE/.git:/go/src/github.com/docker/docker/.git" \
   100                                    --name docker-pr$BUILD_NUMBER \
   101                                    -e DOCKER_EXPERIMENTAL \
   102                                    -e DOCKER_GITCOMMIT=${GIT_COMMIT} \
   103                                    -e DOCKER_GRAPHDRIVER \
   104                                    -e TEST_FORCE_VALIDATE \
   105                                    -e VALIDATE_REPO=${GIT_URL} \
   106                                    -e VALIDATE_BRANCH=${CHANGE_TARGET} \
   107                                    docker:${GIT_COMMIT} \
   108                                    hack/validate/default
   109                                  '''
   110                              }
   111                          }
   112                          stage("Docker-py") {
   113                              steps {
   114                                  sh '''
   115                                  docker run --rm -t --privileged \
   116                                    -v "$WORKSPACE/bundles:/go/src/github.com/docker/docker/bundles" \
   117                                    --name docker-pr$BUILD_NUMBER \
   118                                    -e DOCKER_EXPERIMENTAL \
   119                                    -e DOCKER_GITCOMMIT=${GIT_COMMIT} \
   120                                    -e DOCKER_GRAPHDRIVER \
   121                                    -e VALIDATE_REPO=${GIT_URL} \
   122                                    -e VALIDATE_BRANCH=${CHANGE_TARGET} \
   123                                    docker:${GIT_COMMIT} \
   124                                    hack/make.sh \
   125                                      dynbinary \
   126                                      test-docker-py
   127                                  '''
   128                              }
   129                              post {
   130                                  always {
   131                                      junit testResults: 'bundles/test-docker-py/junit-report.xml', allowEmptyResults: true
   132  
   133                                      sh '''
   134                                      echo "Ensuring container killed."
   135                                      docker rm -vf docker-pr$BUILD_NUMBER || true
   136                                      '''
   137  
   138                                      sh '''
   139                                      echo 'Chowning /workspace to jenkins user'
   140                                      docker run --rm -v "$WORKSPACE:/workspace" busybox chown -R "$(id -u):$(id -g)" /workspace
   141                                      '''
   142  
   143                                      catchError(buildResult: 'SUCCESS', stageResult: 'FAILURE', message: 'Failed to create bundles.tar.gz') {
   144                                          sh '''
   145                                          bundleName=docker-py
   146                                          echo "Creating ${bundleName}-bundles.tar.gz"
   147                                          tar -czf ${bundleName}-bundles.tar.gz bundles/test-docker-py/*.xml bundles/test-docker-py/*.log
   148                                          '''
   149  
   150                                          archiveArtifacts artifacts: '*-bundles.tar.gz', allowEmptyArchive: true
   151                                      }
   152                                  }
   153                              }
   154                          }
   155                          stage("Static") {
   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 binary
   165                                  '''
   166                              }
   167                          }
   168                          stage("Cross") {
   169                              steps {
   170                                  sh '''
   171                                  docker run --rm -t --privileged \
   172                                    -v "$WORKSPACE/bundles:/go/src/github.com/docker/docker/bundles" \
   173                                    --name docker-pr$BUILD_NUMBER \
   174                                    -e DOCKER_GITCOMMIT=${GIT_COMMIT} \
   175                                    -e DOCKER_GRAPHDRIVER \
   176                                    docker:${GIT_COMMIT} \
   177                                    hack/make.sh cross
   178                                  '''
   179                              }
   180                          }
   181                          // needs to be last stage that calls make.sh for the junit report to work
   182                          stage("Unit tests") {
   183                              steps {
   184                                  sh '''
   185                                  sudo modprobe ip6table_filter
   186                                  '''
   187                                  sh '''
   188                                  docker run --rm -t --privileged \
   189                                    -v "$WORKSPACE/bundles:/go/src/github.com/docker/docker/bundles" \
   190                                    --name docker-pr$BUILD_NUMBER \
   191                                    -e DOCKER_EXPERIMENTAL \
   192                                    -e DOCKER_GITCOMMIT=${GIT_COMMIT} \
   193                                    -e DOCKER_GRAPHDRIVER \
   194                                    -e VALIDATE_REPO=${GIT_URL} \
   195                                    -e VALIDATE_BRANCH=${CHANGE_TARGET} \
   196                                    docker:${GIT_COMMIT} \
   197                                    hack/test/unit
   198                                  '''
   199                              }
   200                              post {
   201                                  always {
   202                                      junit testResults: 'bundles/junit-report.xml', allowEmptyResults: true
   203                                  }
   204                              }
   205                          }
   206                          stage("Validate vendor") {
   207                              steps {
   208                                  sh '''
   209                                  docker run --rm -t --privileged \
   210                                    -v "$WORKSPACE/.git:/go/src/github.com/docker/docker/.git" \
   211                                    --name docker-pr$BUILD_NUMBER \
   212                                    -e DOCKER_EXPERIMENTAL \
   213                                    -e DOCKER_GITCOMMIT=${GIT_COMMIT} \
   214                                    -e DOCKER_GRAPHDRIVER \
   215                                    -e TEST_FORCE_VALIDATE \
   216                                    -e VALIDATE_REPO=${GIT_URL} \
   217                                    -e VALIDATE_BRANCH=${CHANGE_TARGET} \
   218                                    docker:${GIT_COMMIT} \
   219                                    hack/validate/vendor
   220                                  '''
   221                              }
   222                          }
   223                      }
   224  
   225                      post {
   226                          always {
   227                              sh '''
   228                              echo 'Ensuring container killed.'
   229                              docker rm -vf docker-pr$BUILD_NUMBER || true
   230                              '''
   231  
   232                              sh '''
   233                              echo 'Chowning /workspace to jenkins user'
   234                              docker run --rm -v "$WORKSPACE:/workspace" busybox chown -R "$(id -u):$(id -g)" /workspace
   235                              '''
   236  
   237                              catchError(buildResult: 'SUCCESS', stageResult: 'FAILURE', message: 'Failed to create bundles.tar.gz') {
   238                                  sh '''
   239                                  bundleName=unit
   240                                  echo "Creating ${bundleName}-bundles.tar.gz"
   241                                  tar -czvf ${bundleName}-bundles.tar.gz bundles/junit-report.xml bundles/go-test-report.json bundles/profile.out
   242                                  '''
   243  
   244                                  archiveArtifacts artifacts: '*-bundles.tar.gz', allowEmptyArchive: true
   245                              }
   246                          }
   247                          cleanup {
   248                              sh 'make clean'
   249                              deleteDir()
   250                          }
   251                      }
   252                  }
   253                  stage('amd64') {
   254                      when {
   255                          beforeAgent true
   256                          expression { params.amd64 }
   257                      }
   258                      agent { label 'amd64 && ubuntu-1804 && overlay2' }
   259  
   260                      stages {
   261                          stage("Print info") {
   262                              steps {
   263                                  sh 'docker version'
   264                                  sh 'docker info'
   265                                  sh '''
   266                                  echo "check-config.sh version: ${CHECK_CONFIG_COMMIT}"
   267                                  curl -fsSL -o ${WORKSPACE}/check-config.sh "https://raw.githubusercontent.com/moby/moby/${CHECK_CONFIG_COMMIT}/contrib/check-config.sh" \
   268                                  && bash ${WORKSPACE}/check-config.sh || true
   269                                  '''
   270                              }
   271                          }
   272                          stage("Build dev image") {
   273                              steps {
   274                                  sh '''
   275                                  # todo: include ip_vs in base image
   276                                  sudo modprobe ip_vs
   277  
   278                                  docker build --force-rm --build-arg APT_MIRROR -t docker:${GIT_COMMIT} .
   279                                  '''
   280                              }
   281                          }
   282                          stage("Run tests") {
   283                              steps {
   284                                  sh '''#!/bin/bash
   285                                  # bash is needed so 'jobs -p' works properly
   286                                  # it also accepts setting inline envvars for functions without explicitly exporting
   287                                  set -x
   288  
   289                                  run_tests() {
   290                                          [ -n "$TESTDEBUG" ] && rm= || rm=--rm;
   291                                          docker run $rm -t --privileged \
   292                                            -v "$WORKSPACE/bundles/${TEST_INTEGRATION_DEST}:/go/src/github.com/docker/docker/bundles" \
   293                                            -v "$WORKSPACE/bundles/dynbinary-daemon:/go/src/github.com/docker/docker/bundles/dynbinary-daemon" \
   294                                            -v "$WORKSPACE/.git:/go/src/github.com/docker/docker/.git" \
   295                                            --name "$CONTAINER_NAME" \
   296                                            -e KEEPBUNDLE=1 \
   297                                            -e TESTDEBUG \
   298                                            -e TESTFLAGS \
   299                                            -e TEST_SKIP_INTEGRATION \
   300                                            -e TEST_SKIP_INTEGRATION_CLI \
   301                                            -e DOCKER_GITCOMMIT=${GIT_COMMIT} \
   302                                            -e DOCKER_GRAPHDRIVER \
   303                                            -e TIMEOUT \
   304                                            -e VALIDATE_REPO=${GIT_URL} \
   305                                            -e VALIDATE_BRANCH=${CHANGE_TARGET} \
   306                                            docker:${GIT_COMMIT} \
   307                                            hack/make.sh \
   308                                              "$1" \
   309                                              test-integration
   310                                  }
   311  
   312                                  trap "exit" INT TERM
   313                                  trap 'pids=$(jobs -p); echo "Remaining pids to kill: [$pids]"; [ -z "$pids" ] || kill $pids' EXIT
   314  
   315                                  CONTAINER_NAME=docker-pr$BUILD_NUMBER
   316  
   317                                  docker run --rm -t --privileged \
   318                                    -v "$WORKSPACE/bundles:/go/src/github.com/docker/docker/bundles" \
   319                                    -v "$WORKSPACE/.git:/go/src/github.com/docker/docker/.git" \
   320                                    --name ${CONTAINER_NAME}-build \
   321                                    -e DOCKER_EXPERIMENTAL \
   322                                    -e DOCKER_GITCOMMIT=${GIT_COMMIT} \
   323                                    -e DOCKER_GRAPHDRIVER \
   324                                    docker:${GIT_COMMIT} \
   325                                    hack/make.sh \
   326                                      dynbinary
   327  
   328                                  # flaky + integration
   329                                  TEST_INTEGRATION_DEST=1 CONTAINER_NAME=${CONTAINER_NAME}-1 TEST_SKIP_INTEGRATION_CLI=1 run_tests test-integration-flaky &
   330  
   331                                  # integration-cli first set
   332                                  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 &
   333  
   334                                  # integration-cli second set
   335                                  TEST_INTEGRATION_DEST=3 CONTAINER_NAME=${CONTAINER_NAME}-3 TEST_SKIP_INTEGRATION=1 TESTFLAGS="-test.run Test(DockerSwarmSuite|DockerDaemonSuite|DockerExternalVolumeSuite)/" run_tests &
   336  
   337                                  c=0
   338                                  for job in $(jobs -p); do
   339                                          wait ${job} || c=$?
   340                                  done
   341                                  exit $c
   342                                  '''
   343                              }
   344                              post {
   345                                  always {
   346                                      junit testResults: 'bundles/**/*-report.xml', allowEmptyResults: true
   347                                  }
   348                              }
   349                          }
   350                      }
   351  
   352                      post {
   353                          always {
   354                              sh '''
   355                              echo "Ensuring container killed."
   356                              cids=$(docker ps -aq -f name=docker-pr${BUILD_NUMBER}-*)
   357                              [ -n "$cids" ] && docker rm -vf $cids || true
   358                              '''
   359  
   360                              sh '''
   361                              echo "Chowning /workspace to jenkins user"
   362                              docker run --rm -v "$WORKSPACE:/workspace" busybox chown -R "$(id -u):$(id -g)" /workspace
   363                              '''
   364  
   365                              catchError(buildResult: 'SUCCESS', stageResult: 'FAILURE', message: 'Failed to create bundles.tar.gz') {
   366                                  sh '''
   367                                  bundleName=amd64
   368                                  echo "Creating ${bundleName}-bundles.tar.gz"
   369                                  # exclude overlay2 directories
   370                                  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
   371                                  '''
   372  
   373                                  archiveArtifacts artifacts: '*-bundles.tar.gz', allowEmptyArchive: true
   374                              }
   375                          }
   376                          cleanup {
   377                              sh 'make clean'
   378                              deleteDir()
   379                          }
   380                      }
   381                  }
   382                  stage('rootless') {
   383                      when {
   384                          beforeAgent true
   385                          expression { params.rootless }
   386                      }
   387                      agent { label 'amd64 && ubuntu-1804 && overlay2' }
   388                      stages {
   389                          stage("Print info") {
   390                              steps {
   391                                  sh 'docker version'
   392                                  sh 'docker info'
   393                                  sh '''
   394                                  echo "check-config.sh version: ${CHECK_CONFIG_COMMIT}"
   395                                  curl -fsSL -o ${WORKSPACE}/check-config.sh "https://raw.githubusercontent.com/moby/moby/${CHECK_CONFIG_COMMIT}/contrib/check-config.sh" \
   396                                  && bash ${WORKSPACE}/check-config.sh || true
   397                                  '''
   398                              }
   399                          }
   400                          stage("Build dev image") {
   401                              steps {
   402                                  sh '''
   403                                  docker build --force-rm --build-arg APT_MIRROR -t docker:${GIT_COMMIT} .
   404                                  '''
   405                              }
   406                          }
   407                          stage("Integration tests") {
   408                              environment {
   409                                  DOCKER_ROOTLESS = '1'
   410                                  TEST_SKIP_INTEGRATION_CLI = '1'
   411                              }
   412                              steps {
   413                                  sh '''
   414                                  docker run --rm -t --privileged \
   415                                    -v "$WORKSPACE/bundles:/go/src/github.com/docker/docker/bundles" \
   416                                    --name docker-pr$BUILD_NUMBER \
   417                                    -e DOCKER_GITCOMMIT=${GIT_COMMIT} \
   418                                    -e DOCKER_GRAPHDRIVER \
   419                                    -e DOCKER_EXPERIMENTAL \
   420                                    -e DOCKER_ROOTLESS \
   421                                    -e TEST_SKIP_INTEGRATION_CLI \
   422                                    -e TIMEOUT \
   423                                    -e VALIDATE_REPO=${GIT_URL} \
   424                                    -e VALIDATE_BRANCH=${CHANGE_TARGET} \
   425                                    docker:${GIT_COMMIT} \
   426                                    hack/make.sh \
   427                                      dynbinary \
   428                                      test-integration
   429                                  '''
   430                              }
   431                              post {
   432                                  always {
   433                                      junit testResults: 'bundles/**/*-report.xml', allowEmptyResults: true
   434                                  }
   435                              }
   436                          }
   437                      }
   438  
   439                      post {
   440                          always {
   441                              sh '''
   442                              echo "Ensuring container killed."
   443                              docker rm -vf docker-pr$BUILD_NUMBER || true
   444                              '''
   445  
   446                              sh '''
   447                              echo "Chowning /workspace to jenkins user"
   448                              docker run --rm -v "$WORKSPACE:/workspace" busybox chown -R "$(id -u):$(id -g)" /workspace
   449                              '''
   450  
   451                              catchError(buildResult: 'SUCCESS', stageResult: 'FAILURE', message: 'Failed to create bundles.tar.gz') {
   452                                  sh '''
   453                                  bundleName=amd64-rootless
   454                                  echo "Creating ${bundleName}-bundles.tar.gz"
   455                                  # exclude overlay2 directories
   456                                  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
   457                                  '''
   458  
   459                                  archiveArtifacts artifacts: '*-bundles.tar.gz', allowEmptyArchive: true
   460                              }
   461                          }
   462                          cleanup {
   463                              sh 'make clean'
   464                              deleteDir()
   465                          }
   466                      }
   467                  }
   468  
   469                  stage('cgroup2') {
   470                      when {
   471                          beforeAgent true
   472                          expression { params.cgroup2 }
   473                      }
   474                      agent { label 'amd64 && ubuntu-2004 && cgroup2' }
   475                      stages {
   476                          stage("Print info") {
   477                              steps {
   478                                  sh 'docker version'
   479                                  sh 'docker info'
   480                              }
   481                          }
   482                          stage("Build dev image") {
   483                              steps {
   484                                  sh '''
   485                                  docker build --force-rm --build-arg APT_MIRROR --build-arg SYSTEMD=true -t docker:${GIT_COMMIT} .
   486                                  '''
   487                              }
   488                          }
   489                          stage("Integration tests") {
   490                              environment {
   491                                  DOCKER_SYSTEMD = '1' // recommended cgroup driver for v2
   492                                  TEST_SKIP_INTEGRATION_CLI = '1' // CLI tests do not support v2
   493                              }
   494                              steps {
   495                                  sh '''
   496                                  docker run --rm -t --privileged \
   497                                    -v "$WORKSPACE/bundles:/go/src/github.com/docker/docker/bundles" \
   498                                    --name docker-pr$BUILD_NUMBER \
   499                                    -e DOCKER_GITCOMMIT=${GIT_COMMIT} \
   500                                    -e DOCKER_GRAPHDRIVER \
   501                                    -e DOCKER_EXPERIMENTAL \
   502                                    -e DOCKER_SYSTEMD \
   503                                    -e TEST_SKIP_INTEGRATION_CLI \
   504                                    -e TIMEOUT \
   505                                    -e VALIDATE_REPO=${GIT_URL} \
   506                                    -e VALIDATE_BRANCH=${CHANGE_TARGET} \
   507                                    docker:${GIT_COMMIT} \
   508                                    hack/make.sh \
   509                                      dynbinary \
   510                                      test-integration
   511                                  '''
   512                              }
   513                              post {
   514                                  always {
   515                                      junit testResults: 'bundles/**/*-report.xml', allowEmptyResults: true
   516                                  }
   517                              }
   518                          }
   519                      }
   520  
   521                      post {
   522                          always {
   523                              sh '''
   524                              echo "Ensuring container killed."
   525                              docker rm -vf docker-pr$BUILD_NUMBER || true
   526                              '''
   527  
   528                              sh '''
   529                              echo "Chowning /workspace to jenkins user"
   530                              docker run --rm -v "$WORKSPACE:/workspace" busybox chown -R "$(id -u):$(id -g)" /workspace
   531                              '''
   532  
   533                              catchError(buildResult: 'SUCCESS', stageResult: 'FAILURE', message: 'Failed to create bundles.tar.gz') {
   534                                  sh '''
   535                                  bundleName=amd64-cgroup2
   536                                  echo "Creating ${bundleName}-bundles.tar.gz"
   537                                  # exclude overlay2 directories
   538                                  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
   539                                  '''
   540  
   541                                  archiveArtifacts artifacts: '*-bundles.tar.gz', allowEmptyArchive: true
   542                              }
   543                          }
   544                          cleanup {
   545                              sh 'make clean'
   546                              deleteDir()
   547                          }
   548                      }
   549                  }
   550  
   551  
   552                  stage('s390x') {
   553                      when {
   554                          beforeAgent true
   555                          // Skip this stage on PRs unless the checkbox is selected
   556                          anyOf {
   557                              not { changeRequest() }
   558                              expression { params.s390x }
   559                          }
   560                      }
   561                      agent { label 's390x-ubuntu-2004' }
   562  
   563                      stages {
   564                          stage("Print info") {
   565                              steps {
   566                                  sh 'docker version'
   567                                  sh 'docker info'
   568                                  sh '''
   569                                  echo "check-config.sh version: ${CHECK_CONFIG_COMMIT}"
   570                                  curl -fsSL -o ${WORKSPACE}/check-config.sh "https://raw.githubusercontent.com/moby/moby/${CHECK_CONFIG_COMMIT}/contrib/check-config.sh" \
   571                                  && bash ${WORKSPACE}/check-config.sh || true
   572                                  '''
   573                              }
   574                          }
   575                          stage("Build dev image") {
   576                              steps {
   577                                  sh '''
   578                                  docker build --force-rm --build-arg APT_MIRROR -t docker:${GIT_COMMIT} .
   579                                  '''
   580                              }
   581                          }
   582                          stage("Unit tests") {
   583                              steps {
   584                                  sh '''
   585                                  sudo modprobe ip6table_filter
   586                                  '''
   587                                  sh '''
   588                                  docker run --rm -t --privileged \
   589                                    -v "$WORKSPACE/bundles:/go/src/github.com/docker/docker/bundles" \
   590                                    --name docker-pr$BUILD_NUMBER \
   591                                    -e DOCKER_EXPERIMENTAL \
   592                                    -e DOCKER_GITCOMMIT=${GIT_COMMIT} \
   593                                    -e DOCKER_GRAPHDRIVER \
   594                                    -e VALIDATE_REPO=${GIT_URL} \
   595                                    -e VALIDATE_BRANCH=${CHANGE_TARGET} \
   596                                    docker:${GIT_COMMIT} \
   597                                    hack/test/unit
   598                                  '''
   599                              }
   600                              post {
   601                                  always {
   602                                      junit testResults: 'bundles/junit-report.xml', allowEmptyResults: true
   603                                  }
   604                              }
   605                          }
   606                          stage("Integration tests") {
   607                              environment { TEST_SKIP_INTEGRATION_CLI = '1' }
   608                              steps {
   609                                  sh '''
   610                                  docker run --rm -t --privileged \
   611                                    -v "$WORKSPACE/bundles:/go/src/github.com/docker/docker/bundles" \
   612                                    --name docker-pr$BUILD_NUMBER \
   613                                    -e DOCKER_EXPERIMENTAL \
   614                                    -e DOCKER_GITCOMMIT=${GIT_COMMIT} \
   615                                    -e DOCKER_GRAPHDRIVER \
   616                                    -e TESTDEBUG \
   617                                    -e TEST_SKIP_INTEGRATION_CLI \
   618                                    -e TIMEOUT \
   619                                    -e VALIDATE_REPO=${GIT_URL} \
   620                                    -e VALIDATE_BRANCH=${CHANGE_TARGET} \
   621                                    docker:${GIT_COMMIT} \
   622                                    hack/make.sh \
   623                                      dynbinary \
   624                                      test-integration
   625                                  '''
   626                              }
   627                              post {
   628                                  always {
   629                                      junit testResults: 'bundles/**/*-report.xml', allowEmptyResults: true
   630                                  }
   631                              }
   632                          }
   633                      }
   634  
   635                      post {
   636                          always {
   637                              sh '''
   638                              echo "Ensuring container killed."
   639                              docker rm -vf docker-pr$BUILD_NUMBER || true
   640                              '''
   641  
   642                              sh '''
   643                              echo "Chowning /workspace to jenkins user"
   644                              docker run --rm -v "$WORKSPACE:/workspace" busybox chown -R "$(id -u):$(id -g)" /workspace
   645                              '''
   646  
   647                              catchError(buildResult: 'SUCCESS', stageResult: 'FAILURE', message: 'Failed to create bundles.tar.gz') {
   648                                  sh '''
   649                                  bundleName=s390x-integration
   650                                  echo "Creating ${bundleName}-bundles.tar.gz"
   651                                  # exclude overlay2 directories
   652                                  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
   653                                  '''
   654  
   655                                  archiveArtifacts artifacts: '*-bundles.tar.gz', allowEmptyArchive: true
   656                              }
   657                          }
   658                          cleanup {
   659                              sh 'make clean'
   660                              deleteDir()
   661                          }
   662                      }
   663                  }
   664                  stage('s390x integration-cli') {
   665                      when {
   666                          beforeAgent true
   667                          not { changeRequest() }
   668                          expression { params.s390x }
   669                      }
   670                      agent { label 's390x-ubuntu-2004' }
   671  
   672                      stages {
   673                          stage("Print info") {
   674                              steps {
   675                                  sh 'docker version'
   676                                  sh 'docker info'
   677                                  sh '''
   678                                  echo "check-config.sh version: ${CHECK_CONFIG_COMMIT}"
   679                                  curl -fsSL -o ${WORKSPACE}/check-config.sh "https://raw.githubusercontent.com/moby/moby/${CHECK_CONFIG_COMMIT}/contrib/check-config.sh" \
   680                                  && bash ${WORKSPACE}/check-config.sh || true
   681                                  '''
   682                              }
   683                          }
   684                          stage("Build dev image") {
   685                              steps {
   686                                  sh '''
   687                                  docker build --force-rm --build-arg APT_MIRROR -t docker:${GIT_COMMIT} .
   688                                  '''
   689                              }
   690                          }
   691                          stage("Integration-cli tests") {
   692                              environment { TEST_SKIP_INTEGRATION = '1' }
   693                              steps {
   694                                  sh '''
   695                                  docker run --rm -t --privileged \
   696                                    -v "$WORKSPACE/bundles:/go/src/github.com/docker/docker/bundles" \
   697                                    --name docker-pr$BUILD_NUMBER \
   698                                    -e DOCKER_GITCOMMIT=${GIT_COMMIT} \
   699                                    -e DOCKER_GRAPHDRIVER \
   700                                    -e TEST_SKIP_INTEGRATION \
   701                                    -e TIMEOUT \
   702                                    -e VALIDATE_REPO=${GIT_URL} \
   703                                    -e VALIDATE_BRANCH=${CHANGE_TARGET} \
   704                                    docker:${GIT_COMMIT} \
   705                                    hack/make.sh \
   706                                      dynbinary \
   707                                      test-integration
   708                                  '''
   709                              }
   710                              post {
   711                                  always {
   712                                      junit testResults: 'bundles/**/*-report.xml', allowEmptyResults: true
   713                                  }
   714                              }
   715                          }
   716                      }
   717  
   718                      post {
   719                          always {
   720                              sh '''
   721                              echo "Ensuring container killed."
   722                              docker rm -vf docker-pr$BUILD_NUMBER || true
   723                              '''
   724  
   725                              sh '''
   726                              echo "Chowning /workspace to jenkins user"
   727                              docker run --rm -v "$WORKSPACE:/workspace" busybox chown -R "$(id -u):$(id -g)" /workspace
   728                              '''
   729  
   730                              catchError(buildResult: 'SUCCESS', stageResult: 'FAILURE', message: 'Failed to create bundles.tar.gz') {
   731                                  sh '''
   732                                  bundleName=s390x-integration-cli
   733                                  echo "Creating ${bundleName}-bundles.tar.gz"
   734                                  # exclude overlay2 directories
   735                                  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
   736                                  '''
   737  
   738                                  archiveArtifacts artifacts: '*-bundles.tar.gz', allowEmptyArchive: true
   739                              }
   740                          }
   741                          cleanup {
   742                              sh 'make clean'
   743                              deleteDir()
   744                          }
   745                      }
   746                  }
   747                  stage('ppc64le') {
   748                      when {
   749                          beforeAgent true
   750                          // Skip this stage on PRs unless the checkbox is selected
   751                          anyOf {
   752                              not { changeRequest() }
   753                              expression { params.ppc64le }
   754                          }
   755                      }
   756                      agent { label 'ppc64le-ubuntu-1604' }
   757                      // ppc64le machines run on Docker 18.06, and buildkit has some
   758                      // bugs on that version. Build and use buildx instead.
   759                      environment {
   760                          USE_BUILDX      = '1'
   761                          DOCKER_BUILDKIT = '0'
   762                      }
   763  
   764                      stages {
   765                          stage("Print info") {
   766                              steps {
   767                                  sh 'docker version'
   768                                  sh 'docker info'
   769                                  sh '''
   770                                  echo "check-config.sh version: ${CHECK_CONFIG_COMMIT}"
   771                                  curl -fsSL -o ${WORKSPACE}/check-config.sh "https://raw.githubusercontent.com/moby/moby/${CHECK_CONFIG_COMMIT}/contrib/check-config.sh" \
   772                                  && bash ${WORKSPACE}/check-config.sh || true
   773                                  '''
   774                              }
   775                          }
   776                          stage("Build dev image") {
   777                              steps {
   778                                  sh '''
   779                                  make bundles/buildx
   780                                  bundles/buildx build --load --force-rm --build-arg APT_MIRROR -t docker:${GIT_COMMIT} .
   781                                  '''
   782                              }
   783                          }
   784                          stage("Unit tests") {
   785                              steps {
   786                                  sh '''
   787                                  sudo modprobe ip6table_filter
   788                                  '''
   789                                  sh '''
   790                                  docker run --rm -t --privileged \
   791                                    -v "$WORKSPACE/bundles:/go/src/github.com/docker/docker/bundles" \
   792                                    --name docker-pr$BUILD_NUMBER \
   793                                    -e DOCKER_EXPERIMENTAL \
   794                                    -e DOCKER_GITCOMMIT=${GIT_COMMIT} \
   795                                    -e DOCKER_GRAPHDRIVER \
   796                                    -e VALIDATE_REPO=${GIT_URL} \
   797                                    -e VALIDATE_BRANCH=${CHANGE_TARGET} \
   798                                    docker:${GIT_COMMIT} \
   799                                    hack/test/unit
   800                                  '''
   801                              }
   802                              post {
   803                                  always {
   804                                      junit testResults: 'bundles/junit-report.xml', allowEmptyResults: true
   805                                  }
   806                              }
   807                          }
   808                          stage("Integration tests") {
   809                              environment { TEST_SKIP_INTEGRATION_CLI = '1' }
   810                              steps {
   811                                  sh '''
   812                                  docker run --rm -t --privileged \
   813                                    -v "$WORKSPACE/bundles:/go/src/github.com/docker/docker/bundles" \
   814                                    --name docker-pr$BUILD_NUMBER \
   815                                    -e DOCKER_EXPERIMENTAL \
   816                                    -e DOCKER_GITCOMMIT=${GIT_COMMIT} \
   817                                    -e DOCKER_GRAPHDRIVER \
   818                                    -e TESTDEBUG \
   819                                    -e TEST_SKIP_INTEGRATION_CLI \
   820                                    -e TIMEOUT \
   821                                    -e VALIDATE_REPO=${GIT_URL} \
   822                                    -e VALIDATE_BRANCH=${CHANGE_TARGET} \
   823                                    docker:${GIT_COMMIT} \
   824                                    hack/make.sh \
   825                                      dynbinary \
   826                                      test-integration
   827                                  '''
   828                              }
   829                              post {
   830                                  always {
   831                                      junit testResults: 'bundles/**/*-report.xml', allowEmptyResults: true
   832                                  }
   833                              }
   834                          }
   835                      }
   836  
   837                      post {
   838                          always {
   839                              sh '''
   840                              echo "Ensuring container killed."
   841                              docker rm -vf docker-pr$BUILD_NUMBER || true
   842                              '''
   843  
   844                              sh '''
   845                              echo "Chowning /workspace to jenkins user"
   846                              docker run --rm -v "$WORKSPACE:/workspace" busybox chown -R "$(id -u):$(id -g)" /workspace
   847                              '''
   848  
   849                              catchError(buildResult: 'SUCCESS', stageResult: 'FAILURE', message: 'Failed to create bundles.tar.gz') {
   850                                  sh '''
   851                                  bundleName=ppc64le-integration
   852                                  echo "Creating ${bundleName}-bundles.tar.gz"
   853                                  # exclude overlay2 directories
   854                                  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
   855                                  '''
   856  
   857                                  archiveArtifacts artifacts: '*-bundles.tar.gz', allowEmptyArchive: true
   858                              }
   859                          }
   860                          cleanup {
   861                              sh 'make clean'
   862                              deleteDir()
   863                          }
   864                      }
   865                  }
   866                  stage('ppc64le integration-cli') {
   867                      when {
   868                          beforeAgent true
   869                          not { changeRequest() }
   870                          expression { params.ppc64le }
   871                      }
   872                      agent { label 'ppc64le-ubuntu-1604' }
   873                      // ppc64le machines run on Docker 18.06, and buildkit has some
   874                      // bugs on that version. Build and use buildx instead.
   875                      environment {
   876                          USE_BUILDX      = '1'
   877                          DOCKER_BUILDKIT = '0'
   878                      }
   879  
   880                      stages {
   881                          stage("Print info") {
   882                              steps {
   883                                  sh 'docker version'
   884                                  sh 'docker info'
   885                                  sh '''
   886                                  echo "check-config.sh version: ${CHECK_CONFIG_COMMIT}"
   887                                  curl -fsSL -o ${WORKSPACE}/check-config.sh "https://raw.githubusercontent.com/moby/moby/${CHECK_CONFIG_COMMIT}/contrib/check-config.sh" \
   888                                  && bash ${WORKSPACE}/check-config.sh || true
   889                                  '''
   890                              }
   891                          }
   892                          stage("Build dev image") {
   893                              steps {
   894                                  sh '''
   895                                  make bundles/buildx
   896                                  bundles/buildx build --load --force-rm --build-arg APT_MIRROR -t docker:${GIT_COMMIT} .
   897                                  '''
   898                              }
   899                          }
   900                          stage("Integration-cli tests") {
   901                              environment { TEST_SKIP_INTEGRATION = '1' }
   902                              steps {
   903                                  sh '''
   904                                  docker run --rm -t --privileged \
   905                                    -v "$WORKSPACE/bundles:/go/src/github.com/docker/docker/bundles" \
   906                                    --name docker-pr$BUILD_NUMBER \
   907                                    -e DOCKER_GITCOMMIT=${GIT_COMMIT} \
   908                                    -e DOCKER_GRAPHDRIVER \
   909                                    -e TEST_SKIP_INTEGRATION \
   910                                    -e TIMEOUT \
   911                                    -e VALIDATE_REPO=${GIT_URL} \
   912                                    -e VALIDATE_BRANCH=${CHANGE_TARGET} \
   913                                    docker:${GIT_COMMIT} \
   914                                    hack/make.sh \
   915                                      dynbinary \
   916                                      test-integration
   917                                  '''
   918                              }
   919                              post {
   920                                  always {
   921                                      junit testResults: 'bundles/**/*-report.xml', allowEmptyResults: true
   922                                  }
   923                              }
   924                          }
   925                      }
   926  
   927                      post {
   928                          always {
   929                              sh '''
   930                              echo "Ensuring container killed."
   931                              docker rm -vf docker-pr$BUILD_NUMBER || true
   932                              '''
   933  
   934                              sh '''
   935                              echo "Chowning /workspace to jenkins user"
   936                              docker run --rm -v "$WORKSPACE:/workspace" busybox chown -R "$(id -u):$(id -g)" /workspace
   937                              '''
   938  
   939                              catchError(buildResult: 'SUCCESS', stageResult: 'FAILURE', message: 'Failed to create bundles.tar.gz') {
   940                                  sh '''
   941                                  bundleName=ppc64le-integration-cli
   942                                  echo "Creating ${bundleName}-bundles.tar.gz"
   943                                  # exclude overlay2 directories
   944                                  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
   945                                  '''
   946  
   947                                  archiveArtifacts artifacts: '*-bundles.tar.gz', allowEmptyArchive: true
   948                              }
   949                          }
   950                          cleanup {
   951                              sh 'make clean'
   952                              deleteDir()
   953                          }
   954                      }
   955                  }
   956                  stage('arm64') {
   957                      when {
   958                          beforeAgent true
   959                          expression { params.arm64 }
   960                      }
   961                      agent { label 'arm64 && ubuntu-2004' }
   962                      environment {
   963                          TEST_SKIP_INTEGRATION_CLI = '1'
   964                      }
   965  
   966                      stages {
   967                          stage("Print info") {
   968                              steps {
   969                                  sh 'docker version'
   970                                  sh 'docker info'
   971                                  sh '''
   972                                  echo "check-config.sh version: ${CHECK_CONFIG_COMMIT}"
   973                                  curl -fsSL -o ${WORKSPACE}/check-config.sh "https://raw.githubusercontent.com/moby/moby/${CHECK_CONFIG_COMMIT}/contrib/check-config.sh" \
   974                                  && bash ${WORKSPACE}/check-config.sh || true
   975                                  '''
   976                              }
   977                          }
   978                          stage("Build dev image") {
   979                              steps {
   980                                  sh 'docker build --force-rm --build-arg APT_MIRROR -t docker:${GIT_COMMIT} .'
   981                              }
   982                          }
   983                          stage("Unit tests") {
   984                              steps {
   985                                  sh '''
   986                                  sudo modprobe ip6table_filter
   987                                  '''
   988                                  sh '''
   989                                  docker run --rm -t --privileged \
   990                                    -v "$WORKSPACE/bundles:/go/src/github.com/docker/docker/bundles" \
   991                                    --name docker-pr$BUILD_NUMBER \
   992                                    -e DOCKER_EXPERIMENTAL \
   993                                    -e DOCKER_GITCOMMIT=${GIT_COMMIT} \
   994                                    -e DOCKER_GRAPHDRIVER \
   995                                    -e VALIDATE_REPO=${GIT_URL} \
   996                                    -e VALIDATE_BRANCH=${CHANGE_TARGET} \
   997                                    docker:${GIT_COMMIT} \
   998                                    hack/test/unit
   999                                  '''
  1000                              }
  1001                              post {
  1002                                  always {
  1003                                      junit testResults: 'bundles/junit-report.xml', allowEmptyResults: true
  1004                                  }
  1005                              }
  1006                          }
  1007                          stage("Integration tests") {
  1008                              environment { TEST_SKIP_INTEGRATION_CLI = '1' }
  1009                              steps {
  1010                                  sh '''
  1011                                  docker run --rm -t --privileged \
  1012                                    -v "$WORKSPACE/bundles:/go/src/github.com/docker/docker/bundles" \
  1013                                    --name docker-pr$BUILD_NUMBER \
  1014                                    -e DOCKER_EXPERIMENTAL \
  1015                                    -e DOCKER_GITCOMMIT=${GIT_COMMIT} \
  1016                                    -e DOCKER_GRAPHDRIVER \
  1017                                    -e TESTDEBUG \
  1018                                    -e TEST_SKIP_INTEGRATION_CLI \
  1019                                    -e TIMEOUT \
  1020                                    -e VALIDATE_REPO=${GIT_URL} \
  1021                                    -e VALIDATE_BRANCH=${CHANGE_TARGET} \
  1022                                    docker:${GIT_COMMIT} \
  1023                                    hack/make.sh \
  1024                                      dynbinary \
  1025                                      test-integration
  1026                                  '''
  1027                              }
  1028                              post {
  1029                                  always {
  1030                                      junit testResults: 'bundles/**/*-report.xml', allowEmptyResults: true
  1031                                  }
  1032                              }
  1033                          }
  1034                      }
  1035  
  1036                      post {
  1037                          always {
  1038                              sh '''
  1039                              echo "Ensuring container killed."
  1040                              docker rm -vf docker-pr$BUILD_NUMBER || true
  1041                              '''
  1042  
  1043                              sh '''
  1044                              echo "Chowning /workspace to jenkins user"
  1045                              docker run --rm -v "$WORKSPACE:/workspace" busybox chown -R "$(id -u):$(id -g)" /workspace
  1046                              '''
  1047  
  1048                              catchError(buildResult: 'SUCCESS', stageResult: 'FAILURE', message: 'Failed to create bundles.tar.gz') {
  1049                                  sh '''
  1050                                  bundleName=arm64-integration
  1051                                  echo "Creating ${bundleName}-bundles.tar.gz"
  1052                                  # exclude overlay2 directories
  1053                                  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
  1054                                  '''
  1055  
  1056                                  archiveArtifacts artifacts: '*-bundles.tar.gz', allowEmptyArchive: true
  1057                              }
  1058                          }
  1059                          cleanup {
  1060                              sh 'make clean'
  1061                              deleteDir()
  1062                          }
  1063                      }
  1064                  }
  1065                  stage('win-RS1') {
  1066                      when {
  1067                          beforeAgent true
  1068                          // Skip this stage on PRs unless the windowsRS1 checkbox is selected
  1069                          anyOf {
  1070                              not { changeRequest() }
  1071                              expression { params.windowsRS1 }
  1072                          }
  1073                      }
  1074                      environment {
  1075                          DOCKER_BUILDKIT        = '0'
  1076                          DOCKER_DUT_DEBUG       = '1'
  1077                          SKIP_VALIDATION_TESTS  = '1'
  1078                          SOURCES_DRIVE          = 'd'
  1079                          SOURCES_SUBDIR         = 'gopath'
  1080                          TESTRUN_DRIVE          = 'd'
  1081                          TESTRUN_SUBDIR         = "CI"
  1082                          WINDOWS_BASE_IMAGE     = 'mcr.microsoft.com/windows/servercore'
  1083                          WINDOWS_BASE_IMAGE_TAG = 'ltsc2016'
  1084                      }
  1085                      agent {
  1086                          node {
  1087                              customWorkspace 'd:\\gopath\\src\\github.com\\docker\\docker'
  1088                              label 'windows-2016'
  1089                          }
  1090                      }
  1091                      stages {
  1092                          stage("Print info") {
  1093                              steps {
  1094                                  sh 'docker version'
  1095                                  sh 'docker info'
  1096                              }
  1097                          }
  1098                          stage("Run tests") {
  1099                              steps {
  1100                                  powershell '''
  1101                                  $ErrorActionPreference = 'Stop'
  1102                                  [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
  1103                                  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
  1104                                  ./hack/ci/windows.ps1
  1105                                  exit $LastExitCode
  1106                                  '''
  1107                              }
  1108                          }
  1109                      }
  1110                      post {
  1111                          always {
  1112                              junit testResults: 'bundles/junit-report-*.xml', allowEmptyResults: true
  1113                              catchError(buildResult: 'SUCCESS', stageResult: 'FAILURE', message: 'Failed to create bundles.tar.gz') {
  1114                                  powershell '''
  1115                                  cd $env:WORKSPACE
  1116                                  $bundleName="windowsRS1-integration"
  1117                                  Write-Host -ForegroundColor Green "Creating ${bundleName}-bundles.zip"
  1118  
  1119                                  # archiveArtifacts does not support env-vars to , so save the artifacts in a fixed location
  1120                                  Compress-Archive -Path "bundles/CIDUT.out", "bundles/CIDUT.err", "bundles/junit-report-*.xml" -CompressionLevel Optimal -DestinationPath "${bundleName}-bundles.zip"
  1121                                  '''
  1122  
  1123                                  archiveArtifacts artifacts: '*-bundles.zip', allowEmptyArchive: true
  1124                              }
  1125                          }
  1126                          cleanup {
  1127                              sh 'make clean'
  1128                              deleteDir()
  1129                          }
  1130                      }
  1131                  }
  1132                  stage('win-RS5') {
  1133                      when {
  1134                          beforeAgent true
  1135                          expression { params.windowsRS5 }
  1136                      }
  1137                      environment {
  1138                          DOCKER_BUILDKIT        = '0'
  1139                          DOCKER_DUT_DEBUG       = '1'
  1140                          SKIP_VALIDATION_TESTS  = '1'
  1141                          SOURCES_DRIVE          = 'd'
  1142                          SOURCES_SUBDIR         = 'gopath'
  1143                          TESTRUN_DRIVE          = 'd'
  1144                          TESTRUN_SUBDIR         = "CI"
  1145                          WINDOWS_BASE_IMAGE     = 'mcr.microsoft.com/windows/servercore'
  1146                          WINDOWS_BASE_IMAGE_TAG = 'ltsc2019'
  1147                      }
  1148                      agent {
  1149                          node {
  1150                              customWorkspace 'd:\\gopath\\src\\github.com\\docker\\docker'
  1151                              label 'windows-2019'
  1152                          }
  1153                      }
  1154                      stages {
  1155                          stage("Print info") {
  1156                              steps {
  1157                                  sh 'docker version'
  1158                                  sh 'docker info'
  1159                              }
  1160                          }
  1161                          stage("Run tests") {
  1162                              steps {
  1163                                  powershell '''
  1164                                  $ErrorActionPreference = 'Stop'
  1165                                  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
  1166                                  ./hack/ci/windows.ps1
  1167                                  exit $LastExitCode
  1168                                  '''
  1169                              }
  1170                          }
  1171                      }
  1172                      post {
  1173                          always {
  1174                              junit testResults: 'bundles/junit-report-*.xml', allowEmptyResults: true
  1175                              catchError(buildResult: 'SUCCESS', stageResult: 'FAILURE', message: 'Failed to create bundles.tar.gz') {
  1176                                  powershell '''
  1177                                  cd $env:WORKSPACE
  1178                                  $bundleName="windowsRS5-integration"
  1179                                  Write-Host -ForegroundColor Green "Creating ${bundleName}-bundles.zip"
  1180  
  1181                                  # archiveArtifacts does not support env-vars to , so save the artifacts in a fixed location
  1182                                  Compress-Archive -Path "bundles/CIDUT.out", "bundles/CIDUT.err", "bundles/junit-report-*.xml" -CompressionLevel Optimal -DestinationPath "${bundleName}-bundles.zip"
  1183                                  '''
  1184  
  1185                                  archiveArtifacts artifacts: '*-bundles.zip', allowEmptyArchive: true
  1186                              }
  1187                          }
  1188                          cleanup {
  1189                              sh 'make clean'
  1190                              deleteDir()
  1191                          }
  1192                      }
  1193                  }
  1194                  stage('win-2022') {
  1195                      when {
  1196                          beforeAgent true
  1197                          expression { params.windows2022 }
  1198                      }
  1199                      environment {
  1200                          DOCKER_BUILDKIT        = '0'
  1201                          DOCKER_DUT_DEBUG       = '1'
  1202                          SKIP_VALIDATION_TESTS  = '1'
  1203                          SOURCES_DRIVE          = 'd'
  1204                          SOURCES_SUBDIR         = 'gopath'
  1205                          TESTRUN_DRIVE          = 'd'
  1206                          TESTRUN_SUBDIR         = "CI"
  1207                          // TODO switch to mcr.microsoft.com/windows/servercore:2022 once published
  1208                          WINDOWS_BASE_IMAGE     = 'mcr.microsoft.com/windows/servercore/insider'
  1209                          WINDOWS_BASE_IMAGE_TAG = '10.0.20295.1'
  1210                      }
  1211                      agent {
  1212                          node {
  1213                              customWorkspace 'd:\\gopath\\src\\github.com\\docker\\docker'
  1214                              label 'windows-2022'
  1215                          }
  1216                      }
  1217                      stages {
  1218                          stage("Print info") {
  1219                              steps {
  1220                                  sh 'docker version'
  1221                                  sh 'docker info'
  1222                              }
  1223                          }
  1224                          stage("Run tests") {
  1225                              steps {
  1226                                  powershell '''
  1227                                  $ErrorActionPreference = 'Stop'
  1228                                  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
  1229                                  ./hack/ci/windows.ps1
  1230                                  exit $LastExitCode
  1231                                  '''
  1232                              }
  1233                          }
  1234                      }
  1235                      post {
  1236                          always {
  1237                              junit testResults: 'bundles/junit-report-*.xml', allowEmptyResults: true
  1238                              catchError(buildResult: 'SUCCESS', stageResult: 'FAILURE', message: 'Failed to create bundles.zip') {
  1239                                  powershell '''
  1240                                  cd $env:WORKSPACE
  1241                                  $bundleName="win-2022-integration"
  1242                                  Write-Host -ForegroundColor Green "Creating ${bundleName}-bundles.zip"
  1243  
  1244                                  # archiveArtifacts does not support env-vars to , so save the artifacts in a fixed location
  1245                                  Compress-Archive -Path "bundles/CIDUT.out", "bundles/CIDUT.err", "bundles/junit-report-*.xml" -CompressionLevel Optimal -DestinationPath "${bundleName}-bundles.zip"
  1246                                  '''
  1247  
  1248                                  archiveArtifacts artifacts: '*-bundles.zip', allowEmptyArchive: true
  1249                              }
  1250                          }
  1251                          cleanup {
  1252                              sh 'make clean'
  1253                              deleteDir()
  1254                          }
  1255                      }
  1256                  }
  1257                  stage('win-2022-c8d') {
  1258                      when {
  1259                          beforeAgent true
  1260                          expression { params.windows2022containerd }
  1261                      }
  1262                      environment {
  1263                          DOCKER_BUILDKIT        = '0'
  1264                          DOCKER_DUT_DEBUG       = '1'
  1265                          SKIP_VALIDATION_TESTS  = '1'
  1266                          SOURCES_DRIVE          = 'd'
  1267                          SOURCES_SUBDIR         = 'gopath'
  1268                          TESTRUN_DRIVE          = 'd'
  1269                          TESTRUN_SUBDIR         = "CI"
  1270                          // TODO switch to mcr.microsoft.com/windows/servercore:2022 once published
  1271                          WINDOWS_BASE_IMAGE     = 'mcr.microsoft.com/windows/servercore/insider'
  1272                          // Available tags can be found at https://mcr.microsoft.com/v2/windows/servercore/insider/tags/list
  1273                          WINDOWS_BASE_IMAGE_TAG = '10.0.20295.1'
  1274                          DOCKER_WINDOWS_CONTAINERD_RUNTIME = '1'
  1275                      }
  1276                      agent {
  1277                          node {
  1278                              customWorkspace 'd:\\gopath\\src\\github.com\\docker\\docker'
  1279                              label 'windows-2022'
  1280                          }
  1281                      }
  1282                      stages {
  1283                          stage("Print info") {
  1284                              steps {
  1285                                  sh 'docker version'
  1286                                  sh 'docker info'
  1287                              }
  1288                          }
  1289                          stage("Run tests") {
  1290                              steps {
  1291                                  powershell '''
  1292                                  $ErrorActionPreference = 'Stop'
  1293                                  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
  1294                                  ./hack/ci/windows.ps1
  1295                                  exit $LastExitCode
  1296                                  '''
  1297                              }
  1298                          }
  1299                      }
  1300                      post {
  1301                          always {
  1302                              junit testResults: 'bundles/junit-report-*.xml', allowEmptyResults: true
  1303                              catchError(buildResult: 'SUCCESS', stageResult: 'FAILURE', message: 'Failed to create bundles.zip') {
  1304                                  powershell '''
  1305                                  cd $env:WORKSPACE
  1306                                  $bundleName="win-2022-c8d-integration"
  1307                                  Write-Host -ForegroundColor Green "Creating ${bundleName}-bundles.zip"
  1308  
  1309                                  # archiveArtifacts does not support env-vars to , so save the artifacts in a fixed location
  1310                                  Compress-Archive -Path "bundles/CIDUT.out", "bundles/CIDUT.err", "bundles/junit-report-*.xml" -CompressionLevel Optimal -DestinationPath "${bundleName}-bundles.zip"
  1311                                  '''
  1312  
  1313                                  archiveArtifacts artifacts: '*-bundles.zip', allowEmptyArchive: true
  1314                              }
  1315                          }
  1316                          cleanup {
  1317                              sh 'make clean'
  1318                              deleteDir()
  1319                          }
  1320                      }
  1321                  }
  1322              }
  1323          }
  1324      }
  1325  }