github.com/rawahars/moby@v24.0.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_INTEGRATION_USE_SNAPSHOTTER \ 121 -e TEST_SKIP_INTEGRATION_CLI \ 122 -e TIMEOUT \ 123 -e VALIDATE_REPO=${GIT_URL} \ 124 -e VALIDATE_BRANCH=${CHANGE_TARGET} \ 125 docker:${GIT_COMMIT} \ 126 hack/make.sh \ 127 dynbinary \ 128 test-integration 129 ''' 130 } 131 post { 132 always { 133 junit testResults: 'bundles/**/*-report.xml', allowEmptyResults: true 134 } 135 } 136 } 137 } 138 139 post { 140 always { 141 sh ''' 142 echo "Ensuring container killed." 143 docker rm -vf docker-pr$BUILD_NUMBER || true 144 ''' 145 146 sh ''' 147 echo "Chowning /workspace to jenkins user" 148 docker run --rm -v "$WORKSPACE:/workspace" busybox chown -R "$(id -u):$(id -g)" /workspace 149 ''' 150 151 catchError(buildResult: 'SUCCESS', stageResult: 'FAILURE', message: 'Failed to create bundles.tar.gz') { 152 sh ''' 153 bundleName=s390x-integration 154 echo "Creating ${bundleName}-bundles.tar.gz" 155 # exclude overlay2 directories 156 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 157 ''' 158 159 archiveArtifacts artifacts: '*-bundles.tar.gz', allowEmptyArchive: true 160 } 161 } 162 cleanup { 163 sh 'make clean' 164 deleteDir() 165 } 166 } 167 } 168 stage('s390x integration-cli') { 169 when { 170 beforeAgent true 171 // Skip this stage on PRs unless the checkbox is selected 172 anyOf { 173 not { changeRequest() } 174 expression { params.s390x } 175 } 176 } 177 agent { label 's390x-ubuntu-2004' } 178 179 stages { 180 stage("Print info") { 181 steps { 182 sh 'docker version' 183 sh 'docker info' 184 sh ''' 185 echo "check-config.sh version: ${CHECK_CONFIG_COMMIT}" 186 curl -fsSL -o ${WORKSPACE}/check-config.sh "https://raw.githubusercontent.com/moby/moby/${CHECK_CONFIG_COMMIT}/contrib/check-config.sh" \ 187 && bash ${WORKSPACE}/check-config.sh || true 188 ''' 189 } 190 } 191 stage("Build dev image") { 192 steps { 193 sh ''' 194 docker build --force-rm --build-arg APT_MIRROR -t docker:${GIT_COMMIT} . 195 ''' 196 } 197 } 198 stage("Integration-cli tests") { 199 environment { TEST_SKIP_INTEGRATION = '1' } 200 steps { 201 sh ''' 202 docker run --rm -t --privileged \ 203 -v "$WORKSPACE/bundles:/go/src/github.com/docker/docker/bundles" \ 204 --name docker-pr$BUILD_NUMBER \ 205 -e DOCKER_GITCOMMIT=${GIT_COMMIT} \ 206 -e DOCKER_GRAPHDRIVER \ 207 -e TEST_INTEGRATION_USE_SNAPSHOTTER \ 208 -e TEST_SKIP_INTEGRATION \ 209 -e TIMEOUT \ 210 -e VALIDATE_REPO=${GIT_URL} \ 211 -e VALIDATE_BRANCH=${CHANGE_TARGET} \ 212 docker:${GIT_COMMIT} \ 213 hack/make.sh \ 214 dynbinary \ 215 test-integration 216 ''' 217 } 218 post { 219 always { 220 junit testResults: 'bundles/**/*-report.xml', allowEmptyResults: true 221 } 222 } 223 } 224 } 225 226 post { 227 always { 228 sh ''' 229 echo "Ensuring container killed." 230 docker rm -vf docker-pr$BUILD_NUMBER || true 231 ''' 232 233 sh ''' 234 echo "Chowning /workspace to jenkins user" 235 docker run --rm -v "$WORKSPACE:/workspace" busybox chown -R "$(id -u):$(id -g)" /workspace 236 ''' 237 238 catchError(buildResult: 'SUCCESS', stageResult: 'FAILURE', message: 'Failed to create bundles.tar.gz') { 239 sh ''' 240 bundleName=s390x-integration-cli 241 echo "Creating ${bundleName}-bundles.tar.gz" 242 # exclude overlay2 directories 243 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 244 ''' 245 246 archiveArtifacts artifacts: '*-bundles.tar.gz', allowEmptyArchive: true 247 } 248 } 249 cleanup { 250 sh 'make clean' 251 deleteDir() 252 } 253 } 254 } 255 stage('ppc64le') { 256 when { 257 beforeAgent true 258 // Skip this stage on PRs unless the checkbox is selected 259 anyOf { 260 not { changeRequest() } 261 expression { params.ppc64le } 262 } 263 } 264 agent { label 'ppc64le-ubuntu-1604' } 265 266 stages { 267 stage("Print info") { 268 steps { 269 sh 'docker version' 270 sh 'docker info' 271 sh ''' 272 echo "check-config.sh version: ${CHECK_CONFIG_COMMIT}" 273 curl -fsSL -o ${WORKSPACE}/check-config.sh "https://raw.githubusercontent.com/moby/moby/${CHECK_CONFIG_COMMIT}/contrib/check-config.sh" \ 274 && bash ${WORKSPACE}/check-config.sh || true 275 ''' 276 } 277 } 278 stage("Build dev image") { 279 steps { 280 sh ''' 281 docker buildx build --load --force-rm --build-arg APT_MIRROR -t docker:${GIT_COMMIT} . 282 ''' 283 } 284 } 285 stage("Unit tests") { 286 steps { 287 sh ''' 288 sudo modprobe ip6table_filter 289 ''' 290 sh ''' 291 docker run --rm -t --privileged \ 292 -v "$WORKSPACE/bundles:/go/src/github.com/docker/docker/bundles" \ 293 --name docker-pr$BUILD_NUMBER \ 294 -e DOCKER_EXPERIMENTAL \ 295 -e DOCKER_GITCOMMIT=${GIT_COMMIT} \ 296 -e DOCKER_GRAPHDRIVER \ 297 -e VALIDATE_REPO=${GIT_URL} \ 298 -e VALIDATE_BRANCH=${CHANGE_TARGET} \ 299 docker:${GIT_COMMIT} \ 300 hack/test/unit 301 ''' 302 } 303 post { 304 always { 305 junit testResults: 'bundles/junit-report*.xml', allowEmptyResults: true 306 } 307 } 308 } 309 stage("Integration tests") { 310 environment { TEST_SKIP_INTEGRATION_CLI = '1' } 311 steps { 312 sh ''' 313 docker run --rm -t --privileged \ 314 -v "$WORKSPACE/bundles:/go/src/github.com/docker/docker/bundles" \ 315 --name docker-pr$BUILD_NUMBER \ 316 -e DOCKER_EXPERIMENTAL \ 317 -e DOCKER_GITCOMMIT=${GIT_COMMIT} \ 318 -e DOCKER_GRAPHDRIVER \ 319 -e TESTDEBUG \ 320 -e TEST_INTEGRATION_USE_SNAPSHOTTER \ 321 -e TEST_SKIP_INTEGRATION_CLI \ 322 -e TIMEOUT \ 323 -e VALIDATE_REPO=${GIT_URL} \ 324 -e VALIDATE_BRANCH=${CHANGE_TARGET} \ 325 docker:${GIT_COMMIT} \ 326 hack/make.sh \ 327 dynbinary \ 328 test-integration 329 ''' 330 } 331 post { 332 always { 333 junit testResults: 'bundles/**/*-report.xml', allowEmptyResults: true 334 } 335 } 336 } 337 } 338 339 post { 340 always { 341 sh ''' 342 echo "Ensuring container killed." 343 docker rm -vf docker-pr$BUILD_NUMBER || true 344 ''' 345 346 sh ''' 347 echo "Chowning /workspace to jenkins user" 348 docker run --rm -v "$WORKSPACE:/workspace" busybox chown -R "$(id -u):$(id -g)" /workspace 349 ''' 350 351 catchError(buildResult: 'SUCCESS', stageResult: 'FAILURE', message: 'Failed to create bundles.tar.gz') { 352 sh ''' 353 bundleName=ppc64le-integration 354 echo "Creating ${bundleName}-bundles.tar.gz" 355 # exclude overlay2 directories 356 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 357 ''' 358 359 archiveArtifacts artifacts: '*-bundles.tar.gz', allowEmptyArchive: true 360 } 361 } 362 cleanup { 363 sh 'make clean' 364 deleteDir() 365 } 366 } 367 } 368 stage('ppc64le integration-cli') { 369 when { 370 beforeAgent true 371 // Skip this stage on PRs unless the checkbox is selected 372 anyOf { 373 not { changeRequest() } 374 expression { params.ppc64le } 375 } 376 } 377 agent { label 'ppc64le-ubuntu-1604' } 378 379 stages { 380 stage("Print info") { 381 steps { 382 sh 'docker version' 383 sh 'docker info' 384 sh ''' 385 echo "check-config.sh version: ${CHECK_CONFIG_COMMIT}" 386 curl -fsSL -o ${WORKSPACE}/check-config.sh "https://raw.githubusercontent.com/moby/moby/${CHECK_CONFIG_COMMIT}/contrib/check-config.sh" \ 387 && bash ${WORKSPACE}/check-config.sh || true 388 ''' 389 } 390 } 391 stage("Build dev image") { 392 steps { 393 sh ''' 394 docker buildx build --load --force-rm --build-arg APT_MIRROR -t docker:${GIT_COMMIT} . 395 ''' 396 } 397 } 398 stage("Integration-cli tests") { 399 environment { TEST_SKIP_INTEGRATION = '1' } 400 steps { 401 sh ''' 402 docker run --rm -t --privileged \ 403 -v "$WORKSPACE/bundles:/go/src/github.com/docker/docker/bundles" \ 404 --name docker-pr$BUILD_NUMBER \ 405 -e DOCKER_GITCOMMIT=${GIT_COMMIT} \ 406 -e DOCKER_GRAPHDRIVER \ 407 -e TEST_INTEGRATION_USE_SNAPSHOTTER \ 408 -e TEST_SKIP_INTEGRATION \ 409 -e TIMEOUT \ 410 -e VALIDATE_REPO=${GIT_URL} \ 411 -e VALIDATE_BRANCH=${CHANGE_TARGET} \ 412 docker:${GIT_COMMIT} \ 413 hack/make.sh \ 414 dynbinary \ 415 test-integration 416 ''' 417 } 418 post { 419 always { 420 junit testResults: 'bundles/**/*-report.xml', allowEmptyResults: true 421 } 422 } 423 } 424 } 425 426 post { 427 always { 428 sh ''' 429 echo "Ensuring container killed." 430 docker rm -vf docker-pr$BUILD_NUMBER || true 431 ''' 432 433 sh ''' 434 echo "Chowning /workspace to jenkins user" 435 docker run --rm -v "$WORKSPACE:/workspace" busybox chown -R "$(id -u):$(id -g)" /workspace 436 ''' 437 438 catchError(buildResult: 'SUCCESS', stageResult: 'FAILURE', message: 'Failed to create bundles.tar.gz') { 439 sh ''' 440 bundleName=ppc64le-integration-cli 441 echo "Creating ${bundleName}-bundles.tar.gz" 442 # exclude overlay2 directories 443 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 444 ''' 445 446 archiveArtifacts artifacts: '*-bundles.tar.gz', allowEmptyArchive: true 447 } 448 } 449 cleanup { 450 sh 'make clean' 451 deleteDir() 452 } 453 } 454 } 455 stage('arm64') { 456 when { 457 beforeAgent true 458 expression { params.arm64 } 459 } 460 agent { label 'arm64 && ubuntu-2004' } 461 environment { 462 TEST_SKIP_INTEGRATION_CLI = '1' 463 } 464 465 stages { 466 stage("Print info") { 467 steps { 468 sh 'docker version' 469 sh 'docker info' 470 sh ''' 471 echo "check-config.sh version: ${CHECK_CONFIG_COMMIT}" 472 curl -fsSL -o ${WORKSPACE}/check-config.sh "https://raw.githubusercontent.com/moby/moby/${CHECK_CONFIG_COMMIT}/contrib/check-config.sh" \ 473 && bash ${WORKSPACE}/check-config.sh || true 474 ''' 475 } 476 } 477 stage("Build dev image") { 478 steps { 479 sh 'docker build --force-rm --build-arg APT_MIRROR -t docker:${GIT_COMMIT} .' 480 } 481 } 482 stage("Unit tests") { 483 steps { 484 sh ''' 485 sudo modprobe ip6table_filter 486 ''' 487 sh ''' 488 docker run --rm -t --privileged \ 489 -v "$WORKSPACE/bundles:/go/src/github.com/docker/docker/bundles" \ 490 --name docker-pr$BUILD_NUMBER \ 491 -e DOCKER_EXPERIMENTAL \ 492 -e DOCKER_GITCOMMIT=${GIT_COMMIT} \ 493 -e DOCKER_GRAPHDRIVER \ 494 -e VALIDATE_REPO=${GIT_URL} \ 495 -e VALIDATE_BRANCH=${CHANGE_TARGET} \ 496 docker:${GIT_COMMIT} \ 497 hack/test/unit 498 ''' 499 } 500 post { 501 always { 502 junit testResults: 'bundles/junit-report*.xml', allowEmptyResults: true 503 } 504 } 505 } 506 stage("Integration tests") { 507 environment { TEST_SKIP_INTEGRATION_CLI = '1' } 508 steps { 509 sh ''' 510 docker run --rm -t --privileged \ 511 -v "$WORKSPACE/bundles:/go/src/github.com/docker/docker/bundles" \ 512 --name docker-pr$BUILD_NUMBER \ 513 -e DOCKER_EXPERIMENTAL \ 514 -e DOCKER_GITCOMMIT=${GIT_COMMIT} \ 515 -e DOCKER_GRAPHDRIVER \ 516 -e TESTDEBUG \ 517 -e TEST_INTEGRATION_USE_SNAPSHOTTER \ 518 -e TEST_SKIP_INTEGRATION_CLI \ 519 -e TIMEOUT \ 520 -e VALIDATE_REPO=${GIT_URL} \ 521 -e VALIDATE_BRANCH=${CHANGE_TARGET} \ 522 docker:${GIT_COMMIT} \ 523 hack/make.sh \ 524 dynbinary \ 525 test-integration 526 ''' 527 } 528 post { 529 always { 530 junit testResults: 'bundles/**/*-report.xml', allowEmptyResults: true 531 } 532 } 533 } 534 } 535 536 post { 537 always { 538 sh ''' 539 echo "Ensuring container killed." 540 docker rm -vf docker-pr$BUILD_NUMBER || true 541 ''' 542 543 sh ''' 544 echo "Chowning /workspace to jenkins user" 545 docker run --rm -v "$WORKSPACE:/workspace" busybox chown -R "$(id -u):$(id -g)" /workspace 546 ''' 547 548 catchError(buildResult: 'SUCCESS', stageResult: 'FAILURE', message: 'Failed to create bundles.tar.gz') { 549 sh ''' 550 bundleName=arm64-integration 551 echo "Creating ${bundleName}-bundles.tar.gz" 552 # exclude overlay2 directories 553 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 554 ''' 555 556 archiveArtifacts artifacts: '*-bundles.tar.gz', allowEmptyArchive: true 557 } 558 } 559 cleanup { 560 sh 'make clean' 561 deleteDir() 562 } 563 } 564 } 565 } 566 } 567 } 568 }