github.com/afbjorklund/moby@v20.10.5+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: true, description: 'IBM Z (s390x) Build/Test')
    18          booleanParam(name: 'ppc64le', defaultValue: true, 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                          expression { params.s390x }
   551                      }
   552                      agent { label 's390x-ubuntu-1804' }
   553  
   554                      stages {
   555                          stage("Print info") {
   556                              steps {
   557                                  sh 'docker version'
   558                                  sh 'docker info'
   559                                  sh '''
   560                                  echo "check-config.sh version: ${CHECK_CONFIG_COMMIT}"
   561                                  curl -fsSL -o ${WORKSPACE}/check-config.sh "https://raw.githubusercontent.com/moby/moby/${CHECK_CONFIG_COMMIT}/contrib/check-config.sh" \
   562                                  && bash ${WORKSPACE}/check-config.sh || true
   563                                  '''
   564                              }
   565                          }
   566                          stage("Build dev image") {
   567                              steps {
   568                                  sh '''
   569                                  docker build --force-rm --build-arg APT_MIRROR -t docker:${GIT_COMMIT} .
   570                                  '''
   571                              }
   572                          }
   573                          stage("Unit tests") {
   574                              steps {
   575                                  sh '''
   576                                  docker run --rm -t --privileged \
   577                                    -v "$WORKSPACE/bundles:/go/src/github.com/docker/docker/bundles" \
   578                                    --name docker-pr$BUILD_NUMBER \
   579                                    -e DOCKER_EXPERIMENTAL \
   580                                    -e DOCKER_GITCOMMIT=${GIT_COMMIT} \
   581                                    -e DOCKER_GRAPHDRIVER \
   582                                    -e VALIDATE_REPO=${GIT_URL} \
   583                                    -e VALIDATE_BRANCH=${CHANGE_TARGET} \
   584                                    docker:${GIT_COMMIT} \
   585                                    hack/test/unit
   586                                  '''
   587                              }
   588                              post {
   589                                  always {
   590                                      junit testResults: 'bundles/junit-report.xml', allowEmptyResults: true
   591                                  }
   592                              }
   593                          }
   594                          stage("Integration tests") {
   595                              environment { TEST_SKIP_INTEGRATION_CLI = '1' }
   596                              steps {
   597                                  sh '''
   598                                  docker run --rm -t --privileged \
   599                                    -v "$WORKSPACE/bundles:/go/src/github.com/docker/docker/bundles" \
   600                                    --name docker-pr$BUILD_NUMBER \
   601                                    -e DOCKER_EXPERIMENTAL \
   602                                    -e DOCKER_GITCOMMIT=${GIT_COMMIT} \
   603                                    -e DOCKER_GRAPHDRIVER \
   604                                    -e TESTDEBUG \
   605                                    -e TEST_SKIP_INTEGRATION_CLI \
   606                                    -e TIMEOUT \
   607                                    -e VALIDATE_REPO=${GIT_URL} \
   608                                    -e VALIDATE_BRANCH=${CHANGE_TARGET} \
   609                                    docker:${GIT_COMMIT} \
   610                                    hack/make.sh \
   611                                      dynbinary \
   612                                      test-integration
   613                                  '''
   614                              }
   615                              post {
   616                                  always {
   617                                      junit testResults: 'bundles/**/*-report.xml', allowEmptyResults: true
   618                                  }
   619                              }
   620                          }
   621                      }
   622  
   623                      post {
   624                          always {
   625                              sh '''
   626                              echo "Ensuring container killed."
   627                              docker rm -vf docker-pr$BUILD_NUMBER || true
   628                              '''
   629  
   630                              sh '''
   631                              echo "Chowning /workspace to jenkins user"
   632                              docker run --rm -v "$WORKSPACE:/workspace" busybox chown -R "$(id -u):$(id -g)" /workspace
   633                              '''
   634  
   635                              catchError(buildResult: 'SUCCESS', stageResult: 'FAILURE', message: 'Failed to create bundles.tar.gz') {
   636                                  sh '''
   637                                  bundleName=s390x-integration
   638                                  echo "Creating ${bundleName}-bundles.tar.gz"
   639                                  # exclude overlay2 directories
   640                                  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
   641                                  '''
   642  
   643                                  archiveArtifacts artifacts: '*-bundles.tar.gz', allowEmptyArchive: true
   644                              }
   645                          }
   646                          cleanup {
   647                              sh 'make clean'
   648                              deleteDir()
   649                          }
   650                      }
   651                  }
   652                  stage('s390x integration-cli') {
   653                      when {
   654                          beforeAgent true
   655                          not { changeRequest() }
   656                          expression { params.s390x }
   657                      }
   658                      agent { label 's390x-ubuntu-1804' }
   659  
   660                      stages {
   661                          stage("Print info") {
   662                              steps {
   663                                  sh 'docker version'
   664                                  sh 'docker info'
   665                                  sh '''
   666                                  echo "check-config.sh version: ${CHECK_CONFIG_COMMIT}"
   667                                  curl -fsSL -o ${WORKSPACE}/check-config.sh "https://raw.githubusercontent.com/moby/moby/${CHECK_CONFIG_COMMIT}/contrib/check-config.sh" \
   668                                  && bash ${WORKSPACE}/check-config.sh || true
   669                                  '''
   670                              }
   671                          }
   672                          stage("Build dev image") {
   673                              steps {
   674                                  sh '''
   675                                  docker build --force-rm --build-arg APT_MIRROR -t docker:${GIT_COMMIT} .
   676                                  '''
   677                              }
   678                          }
   679                          stage("Integration-cli tests") {
   680                              environment { TEST_SKIP_INTEGRATION = '1' }
   681                              steps {
   682                                  sh '''
   683                                  docker run --rm -t --privileged \
   684                                    -v "$WORKSPACE/bundles:/go/src/github.com/docker/docker/bundles" \
   685                                    --name docker-pr$BUILD_NUMBER \
   686                                    -e DOCKER_GITCOMMIT=${GIT_COMMIT} \
   687                                    -e DOCKER_GRAPHDRIVER \
   688                                    -e TEST_SKIP_INTEGRATION \
   689                                    -e TIMEOUT \
   690                                    -e VALIDATE_REPO=${GIT_URL} \
   691                                    -e VALIDATE_BRANCH=${CHANGE_TARGET} \
   692                                    docker:${GIT_COMMIT} \
   693                                    hack/make.sh \
   694                                      dynbinary \
   695                                      test-integration
   696                                  '''
   697                              }
   698                              post {
   699                                  always {
   700                                      junit testResults: 'bundles/**/*-report.xml', allowEmptyResults: true
   701                                  }
   702                              }
   703                          }
   704                      }
   705  
   706                      post {
   707                          always {
   708                              sh '''
   709                              echo "Ensuring container killed."
   710                              docker rm -vf docker-pr$BUILD_NUMBER || true
   711                              '''
   712  
   713                              sh '''
   714                              echo "Chowning /workspace to jenkins user"
   715                              docker run --rm -v "$WORKSPACE:/workspace" busybox chown -R "$(id -u):$(id -g)" /workspace
   716                              '''
   717  
   718                              catchError(buildResult: 'SUCCESS', stageResult: 'FAILURE', message: 'Failed to create bundles.tar.gz') {
   719                                  sh '''
   720                                  bundleName=s390x-integration-cli
   721                                  echo "Creating ${bundleName}-bundles.tar.gz"
   722                                  # exclude overlay2 directories
   723                                  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
   724                                  '''
   725  
   726                                  archiveArtifacts artifacts: '*-bundles.tar.gz', allowEmptyArchive: true
   727                              }
   728                          }
   729                          cleanup {
   730                              sh 'make clean'
   731                              deleteDir()
   732                          }
   733                      }
   734                  }
   735                  stage('ppc64le') {
   736                      when {
   737                          beforeAgent true
   738                          expression { params.ppc64le }
   739                      }
   740                      agent { label 'ppc64le-ubuntu-1604' }
   741                      // ppc64le machines run on Docker 18.06, and buildkit has some
   742                      // bugs on that version. Build and use buildx instead.
   743                      environment {
   744                          USE_BUILDX      = '1'
   745                          DOCKER_BUILDKIT = '0'
   746                      }
   747  
   748                      stages {
   749                          stage("Print info") {
   750                              steps {
   751                                  sh 'docker version'
   752                                  sh 'docker info'
   753                                  sh '''
   754                                  echo "check-config.sh version: ${CHECK_CONFIG_COMMIT}"
   755                                  curl -fsSL -o ${WORKSPACE}/check-config.sh "https://raw.githubusercontent.com/moby/moby/${CHECK_CONFIG_COMMIT}/contrib/check-config.sh" \
   756                                  && bash ${WORKSPACE}/check-config.sh || true
   757                                  '''
   758                              }
   759                          }
   760                          stage("Build dev image") {
   761                              steps {
   762                                  sh '''
   763                                  make bundles/buildx
   764                                  bundles/buildx build --load --force-rm --build-arg APT_MIRROR -t docker:${GIT_COMMIT} .
   765                                  '''
   766                              }
   767                          }
   768                          stage("Unit tests") {
   769                              steps {
   770                                  sh '''
   771                                  docker run --rm -t --privileged \
   772                                    -v "$WORKSPACE/bundles:/go/src/github.com/docker/docker/bundles" \
   773                                    --name docker-pr$BUILD_NUMBER \
   774                                    -e DOCKER_EXPERIMENTAL \
   775                                    -e DOCKER_GITCOMMIT=${GIT_COMMIT} \
   776                                    -e DOCKER_GRAPHDRIVER \
   777                                    -e VALIDATE_REPO=${GIT_URL} \
   778                                    -e VALIDATE_BRANCH=${CHANGE_TARGET} \
   779                                    docker:${GIT_COMMIT} \
   780                                    hack/test/unit
   781                                  '''
   782                              }
   783                              post {
   784                                  always {
   785                                      junit testResults: 'bundles/junit-report.xml', allowEmptyResults: true
   786                                  }
   787                              }
   788                          }
   789                          stage("Integration tests") {
   790                              environment { TEST_SKIP_INTEGRATION_CLI = '1' }
   791                              steps {
   792                                  sh '''
   793                                  docker run --rm -t --privileged \
   794                                    -v "$WORKSPACE/bundles:/go/src/github.com/docker/docker/bundles" \
   795                                    --name docker-pr$BUILD_NUMBER \
   796                                    -e DOCKER_EXPERIMENTAL \
   797                                    -e DOCKER_GITCOMMIT=${GIT_COMMIT} \
   798                                    -e DOCKER_GRAPHDRIVER \
   799                                    -e TESTDEBUG \
   800                                    -e TEST_SKIP_INTEGRATION_CLI \
   801                                    -e TIMEOUT \
   802                                    -e VALIDATE_REPO=${GIT_URL} \
   803                                    -e VALIDATE_BRANCH=${CHANGE_TARGET} \
   804                                    docker:${GIT_COMMIT} \
   805                                    hack/make.sh \
   806                                      dynbinary \
   807                                      test-integration
   808                                  '''
   809                              }
   810                              post {
   811                                  always {
   812                                      junit testResults: 'bundles/**/*-report.xml', allowEmptyResults: true
   813                                  }
   814                              }
   815                          }
   816                      }
   817  
   818                      post {
   819                          always {
   820                              sh '''
   821                              echo "Ensuring container killed."
   822                              docker rm -vf docker-pr$BUILD_NUMBER || true
   823                              '''
   824  
   825                              sh '''
   826                              echo "Chowning /workspace to jenkins user"
   827                              docker run --rm -v "$WORKSPACE:/workspace" busybox chown -R "$(id -u):$(id -g)" /workspace
   828                              '''
   829  
   830                              catchError(buildResult: 'SUCCESS', stageResult: 'FAILURE', message: 'Failed to create bundles.tar.gz') {
   831                                  sh '''
   832                                  bundleName=ppc64le-integration
   833                                  echo "Creating ${bundleName}-bundles.tar.gz"
   834                                  # exclude overlay2 directories
   835                                  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
   836                                  '''
   837  
   838                                  archiveArtifacts artifacts: '*-bundles.tar.gz', allowEmptyArchive: true
   839                              }
   840                          }
   841                          cleanup {
   842                              sh 'make clean'
   843                              deleteDir()
   844                          }
   845                      }
   846                  }
   847                  stage('ppc64le integration-cli') {
   848                      when {
   849                          beforeAgent true
   850                          not { changeRequest() }
   851                          expression { params.ppc64le }
   852                      }
   853                      agent { label 'ppc64le-ubuntu-1604' }
   854                      // ppc64le machines run on Docker 18.06, and buildkit has some
   855                      // bugs on that version. Build and use buildx instead.
   856                      environment {
   857                          USE_BUILDX      = '1'
   858                          DOCKER_BUILDKIT = '0'
   859                      }
   860  
   861                      stages {
   862                          stage("Print info") {
   863                              steps {
   864                                  sh 'docker version'
   865                                  sh 'docker info'
   866                                  sh '''
   867                                  echo "check-config.sh version: ${CHECK_CONFIG_COMMIT}"
   868                                  curl -fsSL -o ${WORKSPACE}/check-config.sh "https://raw.githubusercontent.com/moby/moby/${CHECK_CONFIG_COMMIT}/contrib/check-config.sh" \
   869                                  && bash ${WORKSPACE}/check-config.sh || true
   870                                  '''
   871                              }
   872                          }
   873                          stage("Build dev image") {
   874                              steps {
   875                                  sh '''
   876                                  make bundles/buildx
   877                                  bundles/buildx build --load --force-rm --build-arg APT_MIRROR -t docker:${GIT_COMMIT} .
   878                                  '''
   879                              }
   880                          }
   881                          stage("Integration-cli tests") {
   882                              environment { TEST_SKIP_INTEGRATION = '1' }
   883                              steps {
   884                                  sh '''
   885                                  docker run --rm -t --privileged \
   886                                    -v "$WORKSPACE/bundles:/go/src/github.com/docker/docker/bundles" \
   887                                    --name docker-pr$BUILD_NUMBER \
   888                                    -e DOCKER_GITCOMMIT=${GIT_COMMIT} \
   889                                    -e DOCKER_GRAPHDRIVER \
   890                                    -e TEST_SKIP_INTEGRATION \
   891                                    -e TIMEOUT \
   892                                    -e VALIDATE_REPO=${GIT_URL} \
   893                                    -e VALIDATE_BRANCH=${CHANGE_TARGET} \
   894                                    docker:${GIT_COMMIT} \
   895                                    hack/make.sh \
   896                                      dynbinary \
   897                                      test-integration
   898                                  '''
   899                              }
   900                              post {
   901                                  always {
   902                                      junit testResults: 'bundles/**/*-report.xml', allowEmptyResults: true
   903                                  }
   904                              }
   905                          }
   906                      }
   907  
   908                      post {
   909                          always {
   910                              sh '''
   911                              echo "Ensuring container killed."
   912                              docker rm -vf docker-pr$BUILD_NUMBER || true
   913                              '''
   914  
   915                              sh '''
   916                              echo "Chowning /workspace to jenkins user"
   917                              docker run --rm -v "$WORKSPACE:/workspace" busybox chown -R "$(id -u):$(id -g)" /workspace
   918                              '''
   919  
   920                              catchError(buildResult: 'SUCCESS', stageResult: 'FAILURE', message: 'Failed to create bundles.tar.gz') {
   921                                  sh '''
   922                                  bundleName=ppc64le-integration-cli
   923                                  echo "Creating ${bundleName}-bundles.tar.gz"
   924                                  # exclude overlay2 directories
   925                                  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
   926                                  '''
   927  
   928                                  archiveArtifacts artifacts: '*-bundles.tar.gz', allowEmptyArchive: true
   929                              }
   930                          }
   931                          cleanup {
   932                              sh 'make clean'
   933                              deleteDir()
   934                          }
   935                      }
   936                  }
   937                  stage('arm64') {
   938                      when {
   939                          beforeAgent true
   940                          expression { params.arm64 }
   941                      }
   942                      agent { label 'arm64 && linux' }
   943                      environment {
   944                          TEST_SKIP_INTEGRATION_CLI = '1'
   945                      }
   946  
   947                      stages {
   948                          stage("Print info") {
   949                              steps {
   950                                  sh 'docker version'
   951                                  sh 'docker info'
   952                                  sh '''
   953                                  echo "check-config.sh version: ${CHECK_CONFIG_COMMIT}"
   954                                  curl -fsSL -o ${WORKSPACE}/check-config.sh "https://raw.githubusercontent.com/moby/moby/${CHECK_CONFIG_COMMIT}/contrib/check-config.sh" \
   955                                  && bash ${WORKSPACE}/check-config.sh || true
   956                                  '''
   957                              }
   958                          }
   959                          stage("Build dev image") {
   960                              steps {
   961                                  sh 'docker build --force-rm --build-arg APT_MIRROR -t docker:${GIT_COMMIT} .'
   962                              }
   963                          }
   964                          stage("Unit tests") {
   965                              steps {
   966                                  sh '''
   967                                  docker run --rm -t --privileged \
   968                                    -v "$WORKSPACE/bundles:/go/src/github.com/docker/docker/bundles" \
   969                                    --name docker-pr$BUILD_NUMBER \
   970                                    -e DOCKER_EXPERIMENTAL \
   971                                    -e DOCKER_GITCOMMIT=${GIT_COMMIT} \
   972                                    -e DOCKER_GRAPHDRIVER \
   973                                    -e VALIDATE_REPO=${GIT_URL} \
   974                                    -e VALIDATE_BRANCH=${CHANGE_TARGET} \
   975                                    docker:${GIT_COMMIT} \
   976                                    hack/test/unit
   977                                  '''
   978                              }
   979                              post {
   980                                  always {
   981                                      junit testResults: 'bundles/junit-report.xml', allowEmptyResults: true
   982                                  }
   983                              }
   984                          }
   985                          stage("Integration tests") {
   986                              environment { TEST_SKIP_INTEGRATION_CLI = '1' }
   987                              steps {
   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 TESTDEBUG \
   996                                    -e TEST_SKIP_INTEGRATION_CLI \
   997                                    -e TIMEOUT \
   998                                    -e VALIDATE_REPO=${GIT_URL} \
   999                                    -e VALIDATE_BRANCH=${CHANGE_TARGET} \
  1000                                    docker:${GIT_COMMIT} \
  1001                                    hack/make.sh \
  1002                                      dynbinary \
  1003                                      test-integration
  1004                                  '''
  1005                              }
  1006                              post {
  1007                                  always {
  1008                                      junit testResults: 'bundles/**/*-report.xml', allowEmptyResults: true
  1009                                  }
  1010                              }
  1011                          }
  1012                      }
  1013  
  1014                      post {
  1015                          always {
  1016                              sh '''
  1017                              echo "Ensuring container killed."
  1018                              docker rm -vf docker-pr$BUILD_NUMBER || true
  1019                              '''
  1020  
  1021                              sh '''
  1022                              echo "Chowning /workspace to jenkins user"
  1023                              docker run --rm -v "$WORKSPACE:/workspace" busybox chown -R "$(id -u):$(id -g)" /workspace
  1024                              '''
  1025  
  1026                              catchError(buildResult: 'SUCCESS', stageResult: 'FAILURE', message: 'Failed to create bundles.tar.gz') {
  1027                                  sh '''
  1028                                  bundleName=arm64-integration
  1029                                  echo "Creating ${bundleName}-bundles.tar.gz"
  1030                                  # exclude overlay2 directories
  1031                                  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
  1032                                  '''
  1033  
  1034                                  archiveArtifacts artifacts: '*-bundles.tar.gz', allowEmptyArchive: true
  1035                              }
  1036                          }
  1037                          cleanup {
  1038                              sh 'make clean'
  1039                              deleteDir()
  1040                          }
  1041                      }
  1042                  }
  1043                  stage('win-RS1') {
  1044                      when {
  1045                          beforeAgent true
  1046                          // Skip this stage on PRs unless the windowsRS1 checkbox is selected
  1047                          anyOf {
  1048                              not { changeRequest() }
  1049                              expression { params.windowsRS1 }
  1050                          }
  1051                      }
  1052                      environment {
  1053                          DOCKER_BUILDKIT        = '0'
  1054                          DOCKER_DUT_DEBUG       = '1'
  1055                          SKIP_VALIDATION_TESTS  = '1'
  1056                          SOURCES_DRIVE          = 'd'
  1057                          SOURCES_SUBDIR         = 'gopath'
  1058                          TESTRUN_DRIVE          = 'd'
  1059                          TESTRUN_SUBDIR         = "CI"
  1060                          WINDOWS_BASE_IMAGE     = 'mcr.microsoft.com/windows/servercore'
  1061                          WINDOWS_BASE_IMAGE_TAG = 'ltsc2016'
  1062                      }
  1063                      agent {
  1064                          node {
  1065                              customWorkspace 'd:\\gopath\\src\\github.com\\docker\\docker'
  1066                              label 'windows-2016'
  1067                          }
  1068                      }
  1069                      stages {
  1070                          stage("Print info") {
  1071                              steps {
  1072                                  sh 'docker version'
  1073                                  sh 'docker info'
  1074                              }
  1075                          }
  1076                          stage("Run tests") {
  1077                              steps {
  1078                                  powershell '''
  1079                                  $ErrorActionPreference = 'Stop'
  1080                                  [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
  1081                                  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
  1082                                  ./hack/ci/windows.ps1
  1083                                  exit $LastExitCode
  1084                                  '''
  1085                              }
  1086                          }
  1087                      }
  1088                      post {
  1089                          always {
  1090                              junit testResults: 'bundles/junit-report-*.xml', allowEmptyResults: true
  1091                              catchError(buildResult: 'SUCCESS', stageResult: 'FAILURE', message: 'Failed to create bundles.tar.gz') {
  1092                                  powershell '''
  1093                                  cd $env:WORKSPACE
  1094                                  $bundleName="windowsRS1-integration"
  1095                                  Write-Host -ForegroundColor Green "Creating ${bundleName}-bundles.zip"
  1096  
  1097                                  # archiveArtifacts does not support env-vars to , so save the artifacts in a fixed location
  1098                                  Compress-Archive -Path "bundles/CIDUT.out", "bundles/CIDUT.err", "bundles/junit-report-*.xml" -CompressionLevel Optimal -DestinationPath "${bundleName}-bundles.zip"
  1099                                  '''
  1100  
  1101                                  archiveArtifacts artifacts: '*-bundles.zip', allowEmptyArchive: true
  1102                              }
  1103                          }
  1104                          cleanup {
  1105                              sh 'make clean'
  1106                              deleteDir()
  1107                          }
  1108                      }
  1109                  }
  1110                  stage('win-RS5') {
  1111                      when {
  1112                          beforeAgent true
  1113                          expression { params.windowsRS5 }
  1114                      }
  1115                      environment {
  1116                          DOCKER_BUILDKIT        = '0'
  1117                          DOCKER_DUT_DEBUG       = '1'
  1118                          SKIP_VALIDATION_TESTS  = '1'
  1119                          SOURCES_DRIVE          = 'd'
  1120                          SOURCES_SUBDIR         = 'gopath'
  1121                          TESTRUN_DRIVE          = 'd'
  1122                          TESTRUN_SUBDIR         = "CI"
  1123                          WINDOWS_BASE_IMAGE     = 'mcr.microsoft.com/windows/servercore'
  1124                          WINDOWS_BASE_IMAGE_TAG = 'ltsc2019'
  1125                      }
  1126                      agent {
  1127                          node {
  1128                              customWorkspace 'd:\\gopath\\src\\github.com\\docker\\docker'
  1129                              label 'windows-2019'
  1130                          }
  1131                      }
  1132                      stages {
  1133                          stage("Print info") {
  1134                              steps {
  1135                                  sh 'docker version'
  1136                                  sh 'docker info'
  1137                              }
  1138                          }
  1139                          stage("Run tests") {
  1140                              steps {
  1141                                  powershell '''
  1142                                  $ErrorActionPreference = 'Stop'
  1143                                  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
  1144                                  ./hack/ci/windows.ps1
  1145                                  exit $LastExitCode
  1146                                  '''
  1147                              }
  1148                          }
  1149                      }
  1150                      post {
  1151                          always {
  1152                              junit testResults: 'bundles/junit-report-*.xml', allowEmptyResults: true
  1153                              catchError(buildResult: 'SUCCESS', stageResult: 'FAILURE', message: 'Failed to create bundles.tar.gz') {
  1154                                  powershell '''
  1155                                  cd $env:WORKSPACE
  1156                                  $bundleName="windowsRS5-integration"
  1157                                  Write-Host -ForegroundColor Green "Creating ${bundleName}-bundles.zip"
  1158  
  1159                                  # archiveArtifacts does not support env-vars to , so save the artifacts in a fixed location
  1160                                  Compress-Archive -Path "bundles/CIDUT.out", "bundles/CIDUT.err", "bundles/junit-report-*.xml" -CompressionLevel Optimal -DestinationPath "${bundleName}-bundles.zip"
  1161                                  '''
  1162  
  1163                                  archiveArtifacts artifacts: '*-bundles.zip', allowEmptyArchive: true
  1164                              }
  1165                          }
  1166                          cleanup {
  1167                              sh 'make clean'
  1168                              deleteDir()
  1169                          }
  1170                      }
  1171                  }
  1172              }
  1173          }
  1174      }
  1175  }