This commit uses the exitings jenkins freestyle job configuration to
create a jenkinsfile. This allows the project to use multi-branch
pipelines in Jenkins and to allow others to contribute to the CI setup.
Signed-off-by: Dave Tucker <dt@docker.com>
| 1 | 1 |
new file mode 100644 |
| ... | ... |
@@ -0,0 +1,325 @@ |
| 0 |
+def withGithubStatus(String context, Closure cl) {
|
|
| 1 |
+ def setGithubStatus = { String state ->
|
|
| 2 |
+ try {
|
|
| 3 |
+ def backref = "${BUILD_URL}flowGraphTable/"
|
|
| 4 |
+ def reposSourceURL = scm.repositories[0].getURIs()[0].toString() |
|
| 5 |
+ step( |
|
| 6 |
+ $class: 'GitHubCommitStatusSetter', |
|
| 7 |
+ contextSource: [$class: "ManuallyEnteredCommitContextSource", context: context], |
|
| 8 |
+ errorHandlers: [[$class: 'ShallowAnyErrorHandler']], |
|
| 9 |
+ reposSource: [$class: 'ManuallyEnteredRepositorySource', url: reposSourceURL], |
|
| 10 |
+ statusBackrefSource: [$class: 'ManuallyEnteredBackrefSource', backref: backref], |
|
| 11 |
+ statusResultSource: [$class: 'ConditionalStatusResultSource', results: [[$class: 'AnyBuildResult', state: state]]], |
|
| 12 |
+ ) |
|
| 13 |
+ } catch (err) {
|
|
| 14 |
+ echo "Exception from GitHubCommitStatusSetter for $context: $err" |
|
| 15 |
+ } |
|
| 16 |
+ } |
|
| 17 |
+ |
|
| 18 |
+ setGithubStatus 'PENDING' |
|
| 19 |
+ |
|
| 20 |
+ try {
|
|
| 21 |
+ cl() |
|
| 22 |
+ } catch (err) {
|
|
| 23 |
+ // AbortException signals a "normal" build failure. |
|
| 24 |
+ if (!(err instanceof hudson.AbortException)) {
|
|
| 25 |
+ echo "Exception in withGithubStatus for $context: $err" |
|
| 26 |
+ } |
|
| 27 |
+ setGithubStatus 'FAILURE' |
|
| 28 |
+ throw err |
|
| 29 |
+ } |
|
| 30 |
+ setGithubStatus 'SUCCESS' |
|
| 31 |
+} |
|
| 32 |
+ |
|
| 33 |
+ |
|
| 34 |
+pipeline {
|
|
| 35 |
+ agent none |
|
| 36 |
+ options {
|
|
| 37 |
+ buildDiscarder(logRotator(daysToKeepStr: '30')) |
|
| 38 |
+ timeout(time: 3, unit: 'HOURS') |
|
| 39 |
+ } |
|
| 40 |
+ parameters {
|
|
| 41 |
+ booleanParam(name: 'janky', defaultValue: true, description: 'x86 Build/Test') |
|
| 42 |
+ booleanParam(name: 'experimental', defaultValue: true, description: 'x86 Experimental Build/Test ') |
|
| 43 |
+ booleanParam(name: 'z', defaultValue: true, description: 'IBM Z (s390x) Build/Test') |
|
| 44 |
+ booleanParam(name: 'powerpc', defaultValue: true, description: 'PowerPC (ppc64le) Build/Test') |
|
| 45 |
+ booleanParam(name: 'vendor', defaultValue: true, description: 'Vendor') |
|
| 46 |
+ booleanParam(name: 'windowsRS1', defaultValue: true, description: 'Windows 2016 (RS1) Build/Test') |
|
| 47 |
+ booleanParam(name: 'windowsRS5', defaultValue: true, description: 'Windows 2019 (RS5) Build/Test') |
|
| 48 |
+ } |
|
| 49 |
+ stages {
|
|
| 50 |
+ stage('Build') {
|
|
| 51 |
+ parallel {
|
|
| 52 |
+ stage('janky') {
|
|
| 53 |
+ when {
|
|
| 54 |
+ beforeAgent true |
|
| 55 |
+ expression { params.janky }
|
|
| 56 |
+ } |
|
| 57 |
+ agent {
|
|
| 58 |
+ node {
|
|
| 59 |
+ label 'ubuntu-1604-overlay2-stable' |
|
| 60 |
+ } |
|
| 61 |
+ } |
|
| 62 |
+ steps {
|
|
| 63 |
+ withCredentials([string(credentialsId: '52af932f-f13f-429e-8467-e7ff8b965cdb', variable: 'CODECOV_TOKEN')]) {
|
|
| 64 |
+ withGithubStatus('janky') {
|
|
| 65 |
+ sh ''' |
|
| 66 |
+ # todo: include ip_vs in base image |
|
| 67 |
+ sudo modprobe ip_vs |
|
| 68 |
+ |
|
| 69 |
+ GITCOMMIT=$(git rev-parse --short HEAD) |
|
| 70 |
+ docker build --rm --force-rm --build-arg APT_MIRROR=cdn-fastly.deb.debian.org -t docker:$GITCOMMIT . |
|
| 71 |
+ |
|
| 72 |
+ docker run --rm -t --privileged \ |
|
| 73 |
+ -v "$WORKSPACE/bundles:/go/src/github.com/docker/docker/bundles" \ |
|
| 74 |
+ -v "$WORKSPACE/.git:/go/src/github.com/docker/docker/.git" \ |
|
| 75 |
+ --name docker-pr$BUILD_NUMBER \ |
|
| 76 |
+ -e DOCKER_GITCOMMIT=${GITCOMMIT} \
|
|
| 77 |
+ -e DOCKER_GRAPHDRIVER=vfs \ |
|
| 78 |
+ -e DOCKER_EXECDRIVER=native \ |
|
| 79 |
+ -e CODECOV_TOKEN \ |
|
| 80 |
+ -e GIT_SHA1=${GIT_COMMIT} \
|
|
| 81 |
+ docker:$GITCOMMIT \ |
|
| 82 |
+ hack/ci/janky |
|
| 83 |
+ ''' |
|
| 84 |
+ sh ''' |
|
| 85 |
+ GITCOMMIT=$(git rev-parse --short HEAD) |
|
| 86 |
+ echo "Building e2e image" |
|
| 87 |
+ docker build --build-arg DOCKER_GITCOMMIT=$GITCOMMIT -t moby-e2e-test -f Dockerfile.e2e . |
|
| 88 |
+ ''' |
|
| 89 |
+ } |
|
| 90 |
+ } |
|
| 91 |
+ } |
|
| 92 |
+ post {
|
|
| 93 |
+ always {
|
|
| 94 |
+ sh ''' |
|
| 95 |
+ echo "Ensuring container killed." |
|
| 96 |
+ docker rm -vf docker-pr$BUILD_NUMBER || true |
|
| 97 |
+ |
|
| 98 |
+ echo "Chowning /workspace to jenkins user" |
|
| 99 |
+ docker run --rm -v "$WORKSPACE:/workspace" busybox chown -R "$(id -u):$(id -g)" /workspace |
|
| 100 |
+ ''' |
|
| 101 |
+ sh ''' |
|
| 102 |
+ echo "Creating bundles.tar.gz" |
|
| 103 |
+ (find bundles -name '*.log' -o -name '*.prof' -o -name integration.test | xargs tar -czf bundles.tar.gz) || true |
|
| 104 |
+ ''' |
|
| 105 |
+ archiveArtifacts artifacts: 'bundles.tar.gz' |
|
| 106 |
+ } |
|
| 107 |
+ } |
|
| 108 |
+ } |
|
| 109 |
+ stage('experimental') {
|
|
| 110 |
+ when {
|
|
| 111 |
+ beforeAgent true |
|
| 112 |
+ expression { params.experimental }
|
|
| 113 |
+ } |
|
| 114 |
+ agent {
|
|
| 115 |
+ node {
|
|
| 116 |
+ label 'ubuntu-1604-aufs-stable' |
|
| 117 |
+ } |
|
| 118 |
+ } |
|
| 119 |
+ steps {
|
|
| 120 |
+ withGithubStatus('experimental') {
|
|
| 121 |
+ sh ''' |
|
| 122 |
+ GITCOMMIT=$(git rev-parse --short HEAD) |
|
| 123 |
+ docker build --rm --force-rm --build-arg APT_MIRROR=cdn-fastly.deb.debian.org -t docker:${GITCOMMIT}-exp .
|
|
| 124 |
+ |
|
| 125 |
+ docker run --rm -t --privileged \ |
|
| 126 |
+ -v "$WORKSPACE/bundles:/go/src/github.com/docker/docker/bundles" \ |
|
| 127 |
+ -e DOCKER_EXPERIMENTAL=y \ |
|
| 128 |
+ --name docker-pr-exp$BUILD_NUMBER \ |
|
| 129 |
+ -e DOCKER_GITCOMMIT=${GITCOMMIT} \
|
|
| 130 |
+ -e DOCKER_GRAPHDRIVER=vfs \ |
|
| 131 |
+ -e DOCKER_EXECDRIVER=native \ |
|
| 132 |
+ docker:${GITCOMMIT}-exp \
|
|
| 133 |
+ hack/ci/experimental |
|
| 134 |
+ ''' |
|
| 135 |
+ } |
|
| 136 |
+ } |
|
| 137 |
+ post {
|
|
| 138 |
+ always {
|
|
| 139 |
+ sh ''' |
|
| 140 |
+ echo "Ensuring container killed." |
|
| 141 |
+ docker rm -vf docker-pr-exp$BUILD_NUMBER || true |
|
| 142 |
+ |
|
| 143 |
+ echo "Chowning /workspace to jenkins user" |
|
| 144 |
+ docker run --rm -v "$WORKSPACE:/workspace" busybox chown -R "$(id -u):$(id -g)" /workspace |
|
| 145 |
+ ''' |
|
| 146 |
+ sh ''' |
|
| 147 |
+ echo "Creating bundles.tar.gz" |
|
| 148 |
+ (find bundles -name '*.log' -o -name '*.prof' -o -name integration.test | xargs tar -czf bundles.tar.gz) || true |
|
| 149 |
+ ''' |
|
| 150 |
+ archiveArtifacts artifacts: 'bundles.tar.gz' |
|
| 151 |
+ } |
|
| 152 |
+ } |
|
| 153 |
+ } |
|
| 154 |
+ stage('z') {
|
|
| 155 |
+ when {
|
|
| 156 |
+ beforeAgent true |
|
| 157 |
+ expression { params.z }
|
|
| 158 |
+ } |
|
| 159 |
+ agent {
|
|
| 160 |
+ node {
|
|
| 161 |
+ label 's390x-ubuntu-1604' |
|
| 162 |
+ } |
|
| 163 |
+ } |
|
| 164 |
+ steps {
|
|
| 165 |
+ withGithubStatus('z') {
|
|
| 166 |
+ sh ''' |
|
| 167 |
+ GITCOMMIT=$(git rev-parse --short HEAD) |
|
| 168 |
+ |
|
| 169 |
+ test -f Dockerfile.s390x && \ |
|
| 170 |
+ docker build --rm --force-rm --build-arg APT_MIRROR=cdn-fastly.deb.debian.org -t docker-s390x:$GITCOMMIT -f Dockerfile.s390x . || \ |
|
| 171 |
+ docker build --rm --force-rm --build-arg APT_MIRROR=cdn-fastly.deb.debian.org -t docker-s390x:$GITCOMMIT -f Dockerfile . |
|
| 172 |
+ |
|
| 173 |
+ docker run --rm -t --privileged \ |
|
| 174 |
+ -v "$WORKSPACE/bundles:/go/src/github.com/docker/docker/bundles" \ |
|
| 175 |
+ --name docker-pr-s390x$BUILD_NUMBER \ |
|
| 176 |
+ -e DOCKER_GRAPHDRIVER=vfs \ |
|
| 177 |
+ -e DOCKER_EXECDRIVER=native \ |
|
| 178 |
+ -e TIMEOUT="300m" \ |
|
| 179 |
+ -e DOCKER_GITCOMMIT=${GITCOMMIT} \
|
|
| 180 |
+ docker-s390x:$GITCOMMIT \ |
|
| 181 |
+ hack/ci/z |
|
| 182 |
+ ''' |
|
| 183 |
+ } |
|
| 184 |
+ } |
|
| 185 |
+ post {
|
|
| 186 |
+ always {
|
|
| 187 |
+ sh ''' |
|
| 188 |
+ echo "Ensuring container killed." |
|
| 189 |
+ docker rm -vf docker-pr-s390x$BUILD_NUMBER || true |
|
| 190 |
+ |
|
| 191 |
+ echo "Chowning /workspace to jenkins user" |
|
| 192 |
+ docker run --rm -v "$WORKSPACE:/workspace" s390x/busybox chown -R "$(id -u):$(id -g)" /workspace |
|
| 193 |
+ ''' |
|
| 194 |
+ sh ''' |
|
| 195 |
+ echo "Creating bundles.tar.gz" |
|
| 196 |
+ find bundles -name '*.log' | xargs tar -czf bundles.tar.gz |
|
| 197 |
+ ''' |
|
| 198 |
+ archiveArtifacts artifacts: 'bundles.tar.gz' |
|
| 199 |
+ } |
|
| 200 |
+ } |
|
| 201 |
+ } |
|
| 202 |
+ stage('powerpc') {
|
|
| 203 |
+ when {
|
|
| 204 |
+ beforeAgent true |
|
| 205 |
+ expression { params.powerpc }
|
|
| 206 |
+ } |
|
| 207 |
+ agent {
|
|
| 208 |
+ node {
|
|
| 209 |
+ label 'ppc64le-ubuntu-1604' |
|
| 210 |
+ } |
|
| 211 |
+ } |
|
| 212 |
+ steps {
|
|
| 213 |
+ withGithubStatus('powerpc') {
|
|
| 214 |
+ sh ''' |
|
| 215 |
+ GITCOMMIT=$(git rev-parse --short HEAD) |
|
| 216 |
+ |
|
| 217 |
+ test -f Dockerfile.ppc64le && \ |
|
| 218 |
+ docker build --rm --force-rm --build-arg APT_MIRROR=cdn-fastly.deb.debian.org -t docker-powerpc:$GITCOMMIT -f Dockerfile.ppc64le . || \ |
|
| 219 |
+ docker build --rm --force-rm --build-arg APT_MIRROR=cdn-fastly.deb.debian.org -t docker-powerpc:$GITCOMMIT -f Dockerfile . |
|
| 220 |
+ |
|
| 221 |
+ docker run --rm -t --privileged \ |
|
| 222 |
+ -v "$WORKSPACE/bundles:/go/src/github.com/docker/docker/bundles" \ |
|
| 223 |
+ --name docker-pr-power$BUILD_NUMBER \ |
|
| 224 |
+ -e DOCKER_GRAPHDRIVER=vfs \ |
|
| 225 |
+ -e DOCKER_EXECDRIVER=native \ |
|
| 226 |
+ -e DOCKER_GITCOMMIT=${GITCOMMIT} \
|
|
| 227 |
+ -e TIMEOUT="180m" \ |
|
| 228 |
+ docker-powerpc:$GITCOMMIT \ |
|
| 229 |
+ hack/ci/powerpc |
|
| 230 |
+ ''' |
|
| 231 |
+ } |
|
| 232 |
+ } |
|
| 233 |
+ post {
|
|
| 234 |
+ always {
|
|
| 235 |
+ sh ''' |
|
| 236 |
+ echo "Ensuring container killed." |
|
| 237 |
+ docker rm -vf docker-pr-power$BUILD_NUMBER || true |
|
| 238 |
+ |
|
| 239 |
+ echo "Chowning /workspace to jenkins user" |
|
| 240 |
+ docker run --rm -v "$WORKSPACE:/workspace" ppc64le/busybox chown -R "$(id -u):$(id -g)" /workspace |
|
| 241 |
+ ''' |
|
| 242 |
+ sh ''' |
|
| 243 |
+ echo "Creating bundles.tar.gz" |
|
| 244 |
+ find bundles -name '*.log' | xargs tar -czf bundles.tar.gz |
|
| 245 |
+ ''' |
|
| 246 |
+ archiveArtifacts artifacts: 'bundles.tar.gz' |
|
| 247 |
+ } |
|
| 248 |
+ } |
|
| 249 |
+ } |
|
| 250 |
+ stage('vendor') {
|
|
| 251 |
+ when {
|
|
| 252 |
+ beforeAgent true |
|
| 253 |
+ expression { params.vendor }
|
|
| 254 |
+ } |
|
| 255 |
+ agent {
|
|
| 256 |
+ node {
|
|
| 257 |
+ label 'ubuntu-1604-aufs-stable' |
|
| 258 |
+ } |
|
| 259 |
+ } |
|
| 260 |
+ steps {
|
|
| 261 |
+ withGithubStatus('vendor') {
|
|
| 262 |
+ sh ''' |
|
| 263 |
+ GITCOMMIT=$(git rev-parse --short HEAD) |
|
| 264 |
+ |
|
| 265 |
+ docker build --rm --force-rm --build-arg APT_MIRROR=cdn-fastly.deb.debian.org -t dockerven:$GITCOMMIT . |
|
| 266 |
+ |
|
| 267 |
+ docker run --rm -t --privileged \ |
|
| 268 |
+ --name dockerven-pr$BUILD_NUMBER \ |
|
| 269 |
+ -e DOCKER_GRAPHDRIVER=vfs \ |
|
| 270 |
+ -e DOCKER_EXECDRIVER=native \ |
|
| 271 |
+ -v "$WORKSPACE/.git:/go/src/github.com/docker/docker/.git" \ |
|
| 272 |
+ -e DOCKER_GITCOMMIT=${GITCOMMIT} \
|
|
| 273 |
+ -e TIMEOUT=120m dockerven:$GITCOMMIT \ |
|
| 274 |
+ hack/validate/vendor |
|
| 275 |
+ ''' |
|
| 276 |
+ } |
|
| 277 |
+ } |
|
| 278 |
+ } |
|
| 279 |
+ stage('windowsRS1') {
|
|
| 280 |
+ when {
|
|
| 281 |
+ beforeAgent true |
|
| 282 |
+ expression { params.windowsRS1 }
|
|
| 283 |
+ } |
|
| 284 |
+ agent {
|
|
| 285 |
+ node {
|
|
| 286 |
+ label 'windows-rs1' |
|
| 287 |
+ customWorkspace 'c:\\gopath\\src\\github.com\\docker\\docker' |
|
| 288 |
+ } |
|
| 289 |
+ } |
|
| 290 |
+ steps {
|
|
| 291 |
+ withGithubStatus('windowsRS1') {
|
|
| 292 |
+ powershell ''' |
|
| 293 |
+ $ErrorActionPreference = 'Stop' |
|
| 294 |
+ .\\hack\\ci\\windows.ps1 |
|
| 295 |
+ exit $LastExitCode |
|
| 296 |
+ ''' |
|
| 297 |
+ } |
|
| 298 |
+ } |
|
| 299 |
+ } |
|
| 300 |
+ stage('windowsRS5-process') {
|
|
| 301 |
+ when {
|
|
| 302 |
+ beforeAgent true |
|
| 303 |
+ expression { params.windowsRS5 }
|
|
| 304 |
+ } |
|
| 305 |
+ agent {
|
|
| 306 |
+ node {
|
|
| 307 |
+ label 'windows-rs5' |
|
| 308 |
+ customWorkspace 'c:\\gopath\\src\\github.com\\docker\\docker' |
|
| 309 |
+ } |
|
| 310 |
+ } |
|
| 311 |
+ steps {
|
|
| 312 |
+ withGithubStatus('windowsRS5-process') {
|
|
| 313 |
+ powershell ''' |
|
| 314 |
+ $ErrorActionPreference = 'Stop' |
|
| 315 |
+ .\\hack\\ci\\windows.ps1 |
|
| 316 |
+ exit $LastExitCode |
|
| 317 |
+ ''' |
|
| 318 |
+ } |
|
| 319 |
+ } |
|
| 320 |
+ } |
|
| 321 |
+ } |
|
| 322 |
+ } |
|
| 323 |
+ } |
|
| 324 |
+} |
|
| 0 | 325 |
\ No newline at end of file |