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