github.com/adityamillind98/moby@v23.0.0-rc.4+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: 'arm64', defaultValue: true, description: 'ARM (arm64) Build/Test')
    12          booleanParam(name: 's390x', defaultValue: false, description: 'IBM Z (s390x) Build/Test')
    13          booleanParam(name: 'ppc64le', defaultValue: false, description: 'PowerPC (ppc64le) Build/Test')
    14          booleanParam(name: 'dco', defaultValue: true, description: 'Run the DCO check')
    15      }
    16      environment {
    17          DOCKER_BUILDKIT     = '1'
    18          DOCKER_EXPERIMENTAL = '1'
    19          DOCKER_GRAPHDRIVER  = 'overlay2'
    20          APT_MIRROR          = 'cdn-fastly.deb.debian.org'
    21          CHECK_CONFIG_COMMIT = '33a3680e08d1007e72c3b3f1454f823d8e9948ee'
    22          TESTDEBUG           = '0'
    23          TIMEOUT             = '120m'
    24      }
    25      stages {
    26          stage('pr-hack') {
    27              when { changeRequest() }
    28              steps {
    29                  script {
    30                      echo "Workaround for PR auto-cancel feature. Borrowed from https://issues.jenkins-ci.org/browse/JENKINS-43353"
    31                      def buildNumber = env.BUILD_NUMBER as int
    32                      if (buildNumber > 1) milestone(buildNumber - 1)
    33                      milestone(buildNumber)
    34                  }
    35              }
    36          }
    37          stage('DCO-check') {
    38              when {
    39                  beforeAgent true
    40                  expression { params.dco }
    41              }
    42              agent { label 'arm64 && ubuntu-2004' }
    43              steps {
    44                  sh '''
    45                  docker run --rm \
    46                    -v "$WORKSPACE:/workspace" \
    47                    -e VALIDATE_REPO=${GIT_URL} \
    48                    -e VALIDATE_BRANCH=${CHANGE_TARGET} \
    49                    alpine sh -c 'apk add --no-cache -q bash git openssh-client && git config --system --add safe.directory /workspace && cd /workspace && hack/validate/dco'
    50                  '''
    51              }
    52          }
    53          stage('Build') {
    54              parallel {
    55                  stage('s390x') {
    56                      when {
    57                          beforeAgent true
    58                          // Skip this stage on PRs unless the checkbox is selected
    59                          anyOf {
    60                              not { changeRequest() }
    61                              expression { params.s390x }
    62                          }
    63                      }
    64                      agent { label 's390x-ubuntu-2004' }
    65  
    66                      stages {
    67                          stage("Print info") {
    68                              steps {
    69                                  sh 'docker version'
    70                                  sh 'docker info'
    71                                  sh '''
    72                                  echo "check-config.sh version: ${CHECK_CONFIG_COMMIT}"
    73                                  curl -fsSL -o ${WORKSPACE}/check-config.sh "https://raw.githubusercontent.com/moby/moby/${CHECK_CONFIG_COMMIT}/contrib/check-config.sh" \
    74                                  && bash ${WORKSPACE}/check-config.sh || true
    75                                  '''
    76                              }
    77                          }
    78                          stage("Build dev image") {
    79                              steps {
    80                                  sh '''
    81                                  docker build --force-rm --build-arg APT_MIRROR -t docker:${GIT_COMMIT} .
    82                                  '''
    83                              }
    84                          }
    85                          stage("Unit tests") {
    86                              steps {
    87                                  sh '''
    88                                  sudo modprobe ip6table_filter
    89                                  '''
    90                                  sh '''
    91                                  docker run --rm -t --privileged \
    92                                    -v "$WORKSPACE/bundles:/go/src/github.com/docker/docker/bundles" \
    93                                    --name docker-pr$BUILD_NUMBER \
    94                                    -e DOCKER_EXPERIMENTAL \
    95                                    -e DOCKER_GITCOMMIT=${GIT_COMMIT} \
    96                                    -e DOCKER_GRAPHDRIVER \
    97                                    -e VALIDATE_REPO=${GIT_URL} \
    98                                    -e VALIDATE_BRANCH=${CHANGE_TARGET} \
    99                                    docker:${GIT_COMMIT} \
   100                                    hack/test/unit
   101                                  '''
   102                              }
   103                              post {
   104                                  always {
   105                                      junit testResults: 'bundles/junit-report*.xml', allowEmptyResults: true
   106                                  }
   107                              }
   108                          }
   109                          stage("Integration tests") {
   110                              environment { TEST_SKIP_INTEGRATION_CLI = '1' }
   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 TESTDEBUG \
   120                                    -e TEST_SKIP_INTEGRATION_CLI \
   121                                    -e TIMEOUT \
   122                                    -e VALIDATE_REPO=${GIT_URL} \
   123                                    -e VALIDATE_BRANCH=${CHANGE_TARGET} \
   124                                    docker:${GIT_COMMIT} \
   125                                    hack/make.sh \
   126                                      dynbinary \
   127                                      test-integration
   128                                  '''
   129                              }
   130                              post {
   131                                  always {
   132                                      junit testResults: 'bundles/**/*-report.xml', allowEmptyResults: true
   133                                  }
   134                              }
   135                          }
   136                      }
   137  
   138                      post {
   139                          always {
   140                              sh '''
   141                              echo "Ensuring container killed."
   142                              docker rm -vf docker-pr$BUILD_NUMBER || true
   143                              '''
   144  
   145                              sh '''
   146                              echo "Chowning /workspace to jenkins user"
   147                              docker run --rm -v "$WORKSPACE:/workspace" busybox chown -R "$(id -u):$(id -g)" /workspace
   148                              '''
   149  
   150                              catchError(buildResult: 'SUCCESS', stageResult: 'FAILURE', message: 'Failed to create bundles.tar.gz') {
   151                                  sh '''
   152                                  bundleName=s390x-integration
   153                                  echo "Creating ${bundleName}-bundles.tar.gz"
   154                                  # exclude overlay2 directories
   155                                  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
   156                                  '''
   157  
   158                                  archiveArtifacts artifacts: '*-bundles.tar.gz', allowEmptyArchive: true
   159                              }
   160                          }
   161                          cleanup {
   162                              sh 'make clean'
   163                              deleteDir()
   164                          }
   165                      }
   166                  }
   167                  stage('s390x integration-cli') {
   168                      when {
   169                          beforeAgent true
   170                          // Skip this stage on PRs unless the checkbox is selected
   171                          anyOf {
   172                              not { changeRequest() }
   173                              expression { params.s390x }
   174                          }
   175                      }
   176                      agent { label 's390x-ubuntu-2004' }
   177  
   178                      stages {
   179                          stage("Print info") {
   180                              steps {
   181                                  sh 'docker version'
   182                                  sh 'docker info'
   183                                  sh '''
   184                                  echo "check-config.sh version: ${CHECK_CONFIG_COMMIT}"
   185                                  curl -fsSL -o ${WORKSPACE}/check-config.sh "https://raw.githubusercontent.com/moby/moby/${CHECK_CONFIG_COMMIT}/contrib/check-config.sh" \
   186                                  && bash ${WORKSPACE}/check-config.sh || true
   187                                  '''
   188                              }
   189                          }
   190                          stage("Build dev image") {
   191                              steps {
   192                                  sh '''
   193                                  docker build --force-rm --build-arg APT_MIRROR -t docker:${GIT_COMMIT} .
   194                                  '''
   195                              }
   196                          }
   197                          stage("Integration-cli tests") {
   198                              environment { TEST_SKIP_INTEGRATION = '1' }
   199                              steps {
   200                                  sh '''
   201                                  docker run --rm -t --privileged \
   202                                    -v "$WORKSPACE/bundles:/go/src/github.com/docker/docker/bundles" \
   203                                    --name docker-pr$BUILD_NUMBER \
   204                                    -e DOCKER_GITCOMMIT=${GIT_COMMIT} \
   205                                    -e DOCKER_GRAPHDRIVER \
   206                                    -e TEST_SKIP_INTEGRATION \
   207                                    -e TIMEOUT \
   208                                    -e VALIDATE_REPO=${GIT_URL} \
   209                                    -e VALIDATE_BRANCH=${CHANGE_TARGET} \
   210                                    docker:${GIT_COMMIT} \
   211                                    hack/make.sh \
   212                                      dynbinary \
   213                                      test-integration
   214                                  '''
   215                              }
   216                              post {
   217                                  always {
   218                                      junit testResults: 'bundles/**/*-report.xml', allowEmptyResults: true
   219                                  }
   220                              }
   221                          }
   222                      }
   223  
   224                      post {
   225                          always {
   226                              sh '''
   227                              echo "Ensuring container killed."
   228                              docker rm -vf docker-pr$BUILD_NUMBER || true
   229                              '''
   230  
   231                              sh '''
   232                              echo "Chowning /workspace to jenkins user"
   233                              docker run --rm -v "$WORKSPACE:/workspace" busybox chown -R "$(id -u):$(id -g)" /workspace
   234                              '''
   235  
   236                              catchError(buildResult: 'SUCCESS', stageResult: 'FAILURE', message: 'Failed to create bundles.tar.gz') {
   237                                  sh '''
   238                                  bundleName=s390x-integration-cli
   239                                  echo "Creating ${bundleName}-bundles.tar.gz"
   240                                  # exclude overlay2 directories
   241                                  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
   242                                  '''
   243  
   244                                  archiveArtifacts artifacts: '*-bundles.tar.gz', allowEmptyArchive: true
   245                              }
   246                          }
   247                          cleanup {
   248                              sh 'make clean'
   249                              deleteDir()
   250                          }
   251                      }
   252                  }
   253                  stage('ppc64le') {
   254                      when {
   255                          beforeAgent true
   256                          // Skip this stage on PRs unless the checkbox is selected
   257                          anyOf {
   258                              not { changeRequest() }
   259                              expression { params.ppc64le }
   260                          }
   261                      }
   262                      agent { label 'ppc64le-ubuntu-1604' }
   263  
   264                      stages {
   265                          stage("Print info") {
   266                              steps {
   267                                  sh 'docker version'
   268                                  sh 'docker info'
   269                                  sh '''
   270                                  echo "check-config.sh version: ${CHECK_CONFIG_COMMIT}"
   271                                  curl -fsSL -o ${WORKSPACE}/check-config.sh "https://raw.githubusercontent.com/moby/moby/${CHECK_CONFIG_COMMIT}/contrib/check-config.sh" \
   272                                  && bash ${WORKSPACE}/check-config.sh || true
   273                                  '''
   274                              }
   275                          }
   276                          stage("Build dev image") {
   277                              steps {
   278                                  sh '''
   279                                  docker buildx build --load --force-rm --build-arg APT_MIRROR -t docker:${GIT_COMMIT} .
   280                                  '''
   281                              }
   282                          }
   283                          stage("Unit tests") {
   284                              steps {
   285                                  sh '''
   286                                  sudo modprobe ip6table_filter
   287                                  '''
   288                                  sh '''
   289                                  docker run --rm -t --privileged \
   290                                    -v "$WORKSPACE/bundles:/go/src/github.com/docker/docker/bundles" \
   291                                    --name docker-pr$BUILD_NUMBER \
   292                                    -e DOCKER_EXPERIMENTAL \
   293                                    -e DOCKER_GITCOMMIT=${GIT_COMMIT} \
   294                                    -e DOCKER_GRAPHDRIVER \
   295                                    -e VALIDATE_REPO=${GIT_URL} \
   296                                    -e VALIDATE_BRANCH=${CHANGE_TARGET} \
   297                                    docker:${GIT_COMMIT} \
   298                                    hack/test/unit
   299                                  '''
   300                              }
   301                              post {
   302                                  always {
   303                                      junit testResults: 'bundles/junit-report*.xml', allowEmptyResults: true
   304                                  }
   305                              }
   306                          }
   307                          stage("Integration tests") {
   308                              environment { TEST_SKIP_INTEGRATION_CLI = '1' }
   309                              steps {
   310                                  sh '''
   311                                  docker run --rm -t --privileged \
   312                                    -v "$WORKSPACE/bundles:/go/src/github.com/docker/docker/bundles" \
   313                                    --name docker-pr$BUILD_NUMBER \
   314                                    -e DOCKER_EXPERIMENTAL \
   315                                    -e DOCKER_GITCOMMIT=${GIT_COMMIT} \
   316                                    -e DOCKER_GRAPHDRIVER \
   317                                    -e TESTDEBUG \
   318                                    -e TEST_SKIP_INTEGRATION_CLI \
   319                                    -e TIMEOUT \
   320                                    -e VALIDATE_REPO=${GIT_URL} \
   321                                    -e VALIDATE_BRANCH=${CHANGE_TARGET} \
   322                                    docker:${GIT_COMMIT} \
   323                                    hack/make.sh \
   324                                      dynbinary \
   325                                      test-integration
   326                                  '''
   327                              }
   328                              post {
   329                                  always {
   330                                      junit testResults: 'bundles/**/*-report.xml', allowEmptyResults: true
   331                                  }
   332                              }
   333                          }
   334                      }
   335  
   336                      post {
   337                          always {
   338                              sh '''
   339                              echo "Ensuring container killed."
   340                              docker rm -vf docker-pr$BUILD_NUMBER || true
   341                              '''
   342  
   343                              sh '''
   344                              echo "Chowning /workspace to jenkins user"
   345                              docker run --rm -v "$WORKSPACE:/workspace" busybox chown -R "$(id -u):$(id -g)" /workspace
   346                              '''
   347  
   348                              catchError(buildResult: 'SUCCESS', stageResult: 'FAILURE', message: 'Failed to create bundles.tar.gz') {
   349                                  sh '''
   350                                  bundleName=ppc64le-integration
   351                                  echo "Creating ${bundleName}-bundles.tar.gz"
   352                                  # exclude overlay2 directories
   353                                  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
   354                                  '''
   355  
   356                                  archiveArtifacts artifacts: '*-bundles.tar.gz', allowEmptyArchive: true
   357                              }
   358                          }
   359                          cleanup {
   360                              sh 'make clean'
   361                              deleteDir()
   362                          }
   363                      }
   364                  }
   365                  stage('ppc64le integration-cli') {
   366                      when {
   367                          beforeAgent true
   368                          // Skip this stage on PRs unless the checkbox is selected
   369                          anyOf {
   370                              not { changeRequest() }
   371                              expression { params.ppc64le }
   372                          }
   373                      }
   374                      agent { label 'ppc64le-ubuntu-1604' }
   375  
   376                      stages {
   377                          stage("Print info") {
   378                              steps {
   379                                  sh 'docker version'
   380                                  sh 'docker info'
   381                                  sh '''
   382                                  echo "check-config.sh version: ${CHECK_CONFIG_COMMIT}"
   383                                  curl -fsSL -o ${WORKSPACE}/check-config.sh "https://raw.githubusercontent.com/moby/moby/${CHECK_CONFIG_COMMIT}/contrib/check-config.sh" \
   384                                  && bash ${WORKSPACE}/check-config.sh || true
   385                                  '''
   386                              }
   387                          }
   388                          stage("Build dev image") {
   389                              steps {
   390                                  sh '''
   391                                  docker buildx build --load --force-rm --build-arg APT_MIRROR -t docker:${GIT_COMMIT} .
   392                                  '''
   393                              }
   394                          }
   395                          stage("Integration-cli tests") {
   396                              environment { TEST_SKIP_INTEGRATION = '1' }
   397                              steps {
   398                                  sh '''
   399                                  docker run --rm -t --privileged \
   400                                    -v "$WORKSPACE/bundles:/go/src/github.com/docker/docker/bundles" \
   401                                    --name docker-pr$BUILD_NUMBER \
   402                                    -e DOCKER_GITCOMMIT=${GIT_COMMIT} \
   403                                    -e DOCKER_GRAPHDRIVER \
   404                                    -e TEST_SKIP_INTEGRATION \
   405                                    -e TIMEOUT \
   406                                    -e VALIDATE_REPO=${GIT_URL} \
   407                                    -e VALIDATE_BRANCH=${CHANGE_TARGET} \
   408                                    docker:${GIT_COMMIT} \
   409                                    hack/make.sh \
   410                                      dynbinary \
   411                                      test-integration
   412                                  '''
   413                              }
   414                              post {
   415                                  always {
   416                                      junit testResults: 'bundles/**/*-report.xml', allowEmptyResults: true
   417                                  }
   418                              }
   419                          }
   420                      }
   421  
   422                      post {
   423                          always {
   424                              sh '''
   425                              echo "Ensuring container killed."
   426                              docker rm -vf docker-pr$BUILD_NUMBER || true
   427                              '''
   428  
   429                              sh '''
   430                              echo "Chowning /workspace to jenkins user"
   431                              docker run --rm -v "$WORKSPACE:/workspace" busybox chown -R "$(id -u):$(id -g)" /workspace
   432                              '''
   433  
   434                              catchError(buildResult: 'SUCCESS', stageResult: 'FAILURE', message: 'Failed to create bundles.tar.gz') {
   435                                  sh '''
   436                                  bundleName=ppc64le-integration-cli
   437                                  echo "Creating ${bundleName}-bundles.tar.gz"
   438                                  # exclude overlay2 directories
   439                                  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
   440                                  '''
   441  
   442                                  archiveArtifacts artifacts: '*-bundles.tar.gz', allowEmptyArchive: true
   443                              }
   444                          }
   445                          cleanup {
   446                              sh 'make clean'
   447                              deleteDir()
   448                          }
   449                      }
   450                  }
   451                  stage('arm64') {
   452                      when {
   453                          beforeAgent true
   454                          expression { params.arm64 }
   455                      }
   456                      agent { label 'arm64 && ubuntu-2004' }
   457                      environment {
   458                          TEST_SKIP_INTEGRATION_CLI = '1'
   459                      }
   460  
   461                      stages {
   462                          stage("Print info") {
   463                              steps {
   464                                  sh 'docker version'
   465                                  sh 'docker info'
   466                                  sh '''
   467                                  echo "check-config.sh version: ${CHECK_CONFIG_COMMIT}"
   468                                  curl -fsSL -o ${WORKSPACE}/check-config.sh "https://raw.githubusercontent.com/moby/moby/${CHECK_CONFIG_COMMIT}/contrib/check-config.sh" \
   469                                  && bash ${WORKSPACE}/check-config.sh || true
   470                                  '''
   471                              }
   472                          }
   473                          stage("Build dev image") {
   474                              steps {
   475                                  sh 'docker build --force-rm --build-arg APT_MIRROR -t docker:${GIT_COMMIT} .'
   476                              }
   477                          }
   478                          stage("Unit tests") {
   479                              steps {
   480                                  sh '''
   481                                  sudo modprobe ip6table_filter
   482                                  '''
   483                                  sh '''
   484                                  docker run --rm -t --privileged \
   485                                    -v "$WORKSPACE/bundles:/go/src/github.com/docker/docker/bundles" \
   486                                    --name docker-pr$BUILD_NUMBER \
   487                                    -e DOCKER_EXPERIMENTAL \
   488                                    -e DOCKER_GITCOMMIT=${GIT_COMMIT} \
   489                                    -e DOCKER_GRAPHDRIVER \
   490                                    -e VALIDATE_REPO=${GIT_URL} \
   491                                    -e VALIDATE_BRANCH=${CHANGE_TARGET} \
   492                                    docker:${GIT_COMMIT} \
   493                                    hack/test/unit
   494                                  '''
   495                              }
   496                              post {
   497                                  always {
   498                                      junit testResults: 'bundles/junit-report*.xml', allowEmptyResults: true
   499                                  }
   500                              }
   501                          }
   502                          stage("Integration tests") {
   503                              environment { TEST_SKIP_INTEGRATION_CLI = '1' }
   504                              steps {
   505                                  sh '''
   506                                  docker run --rm -t --privileged \
   507                                    -v "$WORKSPACE/bundles:/go/src/github.com/docker/docker/bundles" \
   508                                    --name docker-pr$BUILD_NUMBER \
   509                                    -e DOCKER_EXPERIMENTAL \
   510                                    -e DOCKER_GITCOMMIT=${GIT_COMMIT} \
   511                                    -e DOCKER_GRAPHDRIVER \
   512                                    -e TESTDEBUG \
   513                                    -e TEST_SKIP_INTEGRATION_CLI \
   514                                    -e TIMEOUT \
   515                                    -e VALIDATE_REPO=${GIT_URL} \
   516                                    -e VALIDATE_BRANCH=${CHANGE_TARGET} \
   517                                    docker:${GIT_COMMIT} \
   518                                    hack/make.sh \
   519                                      dynbinary \
   520                                      test-integration
   521                                  '''
   522                              }
   523                              post {
   524                                  always {
   525                                      junit testResults: 'bundles/**/*-report.xml', allowEmptyResults: true
   526                                  }
   527                              }
   528                          }
   529                      }
   530  
   531                      post {
   532                          always {
   533                              sh '''
   534                              echo "Ensuring container killed."
   535                              docker rm -vf docker-pr$BUILD_NUMBER || true
   536                              '''
   537  
   538                              sh '''
   539                              echo "Chowning /workspace to jenkins user"
   540                              docker run --rm -v "$WORKSPACE:/workspace" busybox chown -R "$(id -u):$(id -g)" /workspace
   541                              '''
   542  
   543                              catchError(buildResult: 'SUCCESS', stageResult: 'FAILURE', message: 'Failed to create bundles.tar.gz') {
   544                                  sh '''
   545                                  bundleName=arm64-integration
   546                                  echo "Creating ${bundleName}-bundles.tar.gz"
   547                                  # exclude overlay2 directories
   548                                  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
   549                                  '''
   550  
   551                                  archiveArtifacts artifacts: '*-bundles.tar.gz', allowEmptyArchive: true
   552                              }
   553                          }
   554                          cleanup {
   555                              sh 'make clean'
   556                              deleteDir()
   557                          }
   558                      }
   559                  }
   560              }
   561          }
   562      }
   563  }