github.com/docker/app@v0.9.1-beta3.0.20210611140623-a48f773ab002/Jenkinsfile (about) 1 pipeline { 2 agent none 3 4 options { 5 skipDefaultCheckout(true) 6 buildDiscarder(logRotator(numToKeepStr: '20')) 7 timeout(time: 1, unit: 'HOURS') 8 } 9 10 environment { 11 TAG = "${env.BUILD_TAG}" 12 GOPROXY = "direct" 13 DOCKER_BUILDKIT = "1" 14 } 15 16 stages { 17 stage('Build') { 18 parallel { 19 stage("Validate") { 20 agent { label 'ubuntu-1804 && x86_64 && overlay2' } 21 steps { 22 dir('src/github.com/docker/app') { 23 checkout scm 24 ansiColor('xterm') { 25 sh 'make -f docker.Makefile lint' 26 sh 'make -f docker.Makefile check-vendor' 27 } 28 } 29 } 30 post { 31 always { 32 deleteDir() 33 } 34 } 35 } 36 stage("Binaries"){ 37 agent { label 'ubuntu-1804 && x86_64 && overlay2' } 38 steps { 39 dir('src/github.com/docker/app') { 40 script { 41 try { 42 checkout scm 43 ansiColor('xterm') { 44 sh 'make -f docker.Makefile cli-cross cross e2e-cross tars' 45 } 46 dir('bin') { 47 stash name: 'binaries' 48 } 49 dir('e2e') { 50 stash name: 'e2e' 51 } 52 dir('examples') { 53 stash name: 'examples' 54 } 55 if(!(env.BRANCH_NAME ==~ "PR-\\d+")) { 56 stash name: 'artifacts', includes: 'bin/*.tar.gz', excludes: 'bin/*-e2e-*' 57 archiveArtifacts 'bin/*.tar.gz' 58 } 59 } finally { 60 def clean_images = /docker image ls --format="{{.Repository}}:{{.Tag}}" '*$BUILD_TAG*' | xargs --no-run-if-empty docker image rm -f/ 61 sh clean_images 62 } 63 } 64 } 65 } 66 post { 67 always { 68 deleteDir() 69 } 70 } 71 } 72 stage('Build Invocation image'){ 73 agent { label 'ubuntu-1804 && x86_64 && overlay2' } 74 steps { 75 dir('src/github.com/docker/app') { 76 checkout scm 77 ansiColor('xterm') { 78 sh 'make -f docker.Makefile invocation-image save-invocation-image' 79 sh 'make -f docker.Makefile INVOCATION_IMAGE_TAG=$TAG-coverage OUTPUT=coverage-invocation-image.tar save-invocation-image-tag' 80 } 81 dir('_build') { 82 stash name: 'invocation-image', includes: 'invocation-image.tar' 83 stash name: 'coverage-invocation-image', includes: 'coverage-invocation-image.tar' 84 } 85 } 86 } 87 post { 88 always { 89 dir('src/github.com/docker/app') { 90 sh 'docker rmi docker/cnab-app-base:$TAG' 91 sh 'docker rmi docker/cnab-app-base:$TAG-coverage' 92 } 93 deleteDir() 94 } 95 } 96 } 97 } 98 } 99 stage('Test') { 100 parallel { 101 stage("Coverage") { 102 agent { label 'ubuntu-1804 && x86_64 && overlay2' } 103 steps { 104 dir('src/github.com/docker/app') { 105 checkout scm 106 dir('_build') { 107 unstash "coverage-invocation-image" 108 sh 'docker load -i coverage-invocation-image.tar' 109 } 110 ansiColor('xterm') { 111 sh 'make -f docker.Makefile TAG=$TAG-coverage coverage-run' 112 sh 'make -f docker.Makefile TAG=$TAG-coverage coverage-results' 113 } 114 archiveArtifacts '_build/ci-cov/all.out' 115 archiveArtifacts '_build/ci-cov/coverage.html' 116 } 117 } 118 post { 119 always { 120 dir('src/github.com/docker/app/_build/test-results') { 121 sh '[ ! -e unit-coverage.xml ] || sed -i -E -e \'s,"github.com/docker/app","unit/basic",g; s,"github.com/docker/app/([^"]*)","unit/basic/\\1",g\' unit-coverage.xml' 122 sh '[ ! -e e2e-coverage.xml ] || sed -i -E -e \'s,"github.com/docker/app/e2e","e2e/basic",g\' e2e-coverage.xml' 123 archiveArtifacts '*.xml' 124 junit '*.xml' 125 } 126 sh 'docker rmi docker/cnab-app-base:$TAG-coverage' 127 deleteDir() 128 } 129 } 130 } 131 stage("Test Linux") { 132 agent { label 'ubuntu-1804 && x86_64 && overlay2' } 133 environment { 134 DOCKERAPP_BINARY = '../docker-app-linux' 135 DOCKERCLI_BINARY = '../docker-linux' 136 } 137 steps { 138 dir('src/github.com/docker/app') { 139 checkout scm 140 dir('_build') { 141 unstash "invocation-image" 142 sh 'docker load -i invocation-image.tar' 143 } 144 unstash "binaries" 145 dir('examples') { 146 unstash "examples" 147 } 148 dir('e2e'){ 149 unstash "e2e" 150 } 151 ansiColor('xterm') { 152 sh './gotestsum-linux --format short-verbose --junitfile e2e-linux.xml --raw-command -- ./test2json-linux -t -p e2e/linux ./docker-app-e2e-linux -test.v --e2e-path=e2e' 153 } 154 } 155 } 156 post { 157 always { 158 archiveArtifacts 'src/github.com/docker/app/e2e-linux.xml' 159 junit 'src/github.com/docker/app/e2e-linux.xml' 160 sh 'docker rmi docker/cnab-app-base:$TAG' 161 deleteDir() 162 } 163 } 164 } 165 } 166 } 167 } 168 }