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