1
0
Fork 0
mirror of https://github.com/moby/moby.git synced 2022-11-09 12:21:53 -05:00

Jenkinsfile: use sub-stages to describe steps

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
Sebastiaan van Stijn 2019-08-02 18:37:58 +02:00
parent f648964875
commit 79713d8d07
No known key found for this signature in database
GPG key ID: 76698F39D527CE8C

311
Jenkinsfile vendored
View file

@ -31,24 +31,36 @@ pipeline {
} }
agent { label 'amd64 && ubuntu-1804 && overlay2' } agent { label 'amd64 && ubuntu-1804 && overlay2' }
steps { stages {
sh ''' stage("Build dev image") {
# todo: include ip_vs in base image steps {
sudo modprobe ip_vs sh '''
# todo: include ip_vs in base image
GITCOMMIT=$(git rev-parse --short HEAD) sudo modprobe ip_vs
docker build --force-rm --build-arg APT_MIRROR -t docker:$GITCOMMIT .
GITCOMMIT=$(git rev-parse --short HEAD)
docker run --rm -t --privileged \ docker build --force-rm --build-arg APT_MIRROR -t docker:$GITCOMMIT .
-v "$WORKSPACE/bundles:/go/src/github.com/docker/docker/bundles" \ '''
-v "$WORKSPACE/.git:/go/src/github.com/docker/docker/.git" \ }
--name docker-pr$BUILD_NUMBER \ }
-e DOCKER_GITCOMMIT=${GITCOMMIT} \ stage("Run tests") {
-e DOCKER_GRAPHDRIVER=overlay2 \ steps {
docker:$GITCOMMIT \ sh '''
hack/test/unit GITCOMMIT=$(git rev-parse --short HEAD)
'''
docker run --rm -t --privileged \
-v "$WORKSPACE/bundles:/go/src/github.com/docker/docker/bundles" \
-v "$WORKSPACE/.git:/go/src/github.com/docker/docker/.git" \
--name docker-pr$BUILD_NUMBER \
-e DOCKER_GITCOMMIT=${GITCOMMIT} \
-e DOCKER_GRAPHDRIVER=overlay2 \
docker:$GITCOMMIT \
hack/test/unit
'''
}
}
} }
post { post {
always { always {
junit 'bundles/junit-report.xml' junit 'bundles/junit-report.xml'
@ -58,7 +70,9 @@ pipeline {
echo 'Chowning /workspace to jenkins user' echo 'Chowning /workspace to jenkins user'
docker run --rm -v "$WORKSPACE:/workspace" busybox chown -R "$(id -u):$(id -g)" /workspace docker run --rm -v "$WORKSPACE:/workspace" busybox chown -R "$(id -u):$(id -g)" /workspace
'''
sh '''
echo 'Creating unit-bundles.tar.gz' echo 'Creating unit-bundles.tar.gz'
tar -czvf unit-bundles.tar.gz bundles/junit-report.xml bundles/go-test-report.json bundles/profile.out tar -czvf unit-bundles.tar.gz bundles/junit-report.xml bundles/go-test-report.json bundles/profile.out
''' '''
@ -74,30 +88,46 @@ pipeline {
} }
agent { label 'amd64 && ubuntu-1804 && overlay2' } agent { label 'amd64 && ubuntu-1804 && overlay2' }
steps { stages {
sh ''' stage("Build dev image") {
# todo: include ip_vs in base image steps {
sudo modprobe ip_vs sh '''
# todo: include ip_vs in base image
sudo modprobe ip_vs
GITCOMMIT=$(git rev-parse --short HEAD)
docker build --force-rm --build-arg APT_MIRROR -t docker:$GITCOMMIT .
'''
}
}
stage("Run tests") {
steps {
sh '''
GITCOMMIT=$(git rev-parse --short HEAD)
GITCOMMIT=$(git rev-parse --short HEAD) docker run --rm -t --privileged \
docker build --force-rm --build-arg APT_MIRROR -t docker:$GITCOMMIT . -v "$WORKSPACE/bundles:/go/src/github.com/docker/docker/bundles" \
-v "$WORKSPACE/.git:/go/src/github.com/docker/docker/.git" \
docker run --rm -t --privileged \ --name docker-pr$BUILD_NUMBER \
-v "$WORKSPACE/bundles:/go/src/github.com/docker/docker/bundles" \ -e DOCKER_GITCOMMIT=${GITCOMMIT} \
-v "$WORKSPACE/.git:/go/src/github.com/docker/docker/.git" \ -e DOCKER_GRAPHDRIVER=overlay2 \
--name docker-pr$BUILD_NUMBER \ -e GIT_SHA1=${GIT_COMMIT} \
-e DOCKER_GITCOMMIT=${GITCOMMIT} \ docker:$GITCOMMIT \
-e DOCKER_GRAPHDRIVER=overlay2 \ hack/ci/janky
-e GIT_SHA1=${GIT_COMMIT} \ '''
docker:$GITCOMMIT \ }
hack/ci/janky }
''' stage("Build e2e image") {
sh ''' steps {
GITCOMMIT=$(git rev-parse --short HEAD) sh '''
echo "Building e2e image" GITCOMMIT=$(git rev-parse --short HEAD)
docker build --build-arg DOCKER_GITCOMMIT=$GITCOMMIT -t moby-e2e-test -f Dockerfile.e2e . echo "Building e2e image"
''' docker build --build-arg DOCKER_GITCOMMIT=$GITCOMMIT -t moby-e2e-test -f Dockerfile.e2e .
'''
}
}
} }
post { post {
always { always {
sh ''' sh '''
@ -107,6 +137,7 @@ pipeline {
echo "Chowning /workspace to jenkins user" echo "Chowning /workspace to jenkins user"
docker run --rm -v "$WORKSPACE:/workspace" busybox chown -R "$(id -u):$(id -g)" /workspace docker run --rm -v "$WORKSPACE:/workspace" busybox chown -R "$(id -u):$(id -g)" /workspace
''' '''
sh ''' sh '''
echo "Creating janky-bundles.tar.gz" echo "Creating janky-bundles.tar.gz"
(find bundles -name '*.log' -o -name '*.prof' -o -name integration.test | xargs tar -czf janky-bundles.tar.gz) || true (find bundles -name '*.log' -o -name '*.prof' -o -name integration.test | xargs tar -czf janky-bundles.tar.gz) || true
@ -122,21 +153,33 @@ pipeline {
expression { params.experimental } expression { params.experimental }
} }
agent { label 'amd64 && ubuntu-1804 && overlay2' } agent { label 'amd64 && ubuntu-1804 && overlay2' }
steps {
sh ''' stages {
GITCOMMIT=$(git rev-parse --short HEAD) stage("Build dev image") {
docker build --force-rm --build-arg APT_MIRROR -t docker:${GITCOMMIT}-exp . steps {
sh '''
docker run --rm -t --privileged \ GITCOMMIT=$(git rev-parse --short HEAD)
-v "$WORKSPACE/bundles:/go/src/github.com/docker/docker/bundles" \ docker build --force-rm --build-arg APT_MIRROR -t docker:${GITCOMMIT}-exp .
-e DOCKER_EXPERIMENTAL=y \ '''
--name docker-pr-exp$BUILD_NUMBER \ }
-e DOCKER_GITCOMMIT=${GITCOMMIT} \ }
-e DOCKER_GRAPHDRIVER=overlay2 \ stage("Run tests") {
docker:${GITCOMMIT}-exp \ steps {
hack/ci/experimental sh '''
''' GITCOMMIT=$(git rev-parse --short HEAD)
docker run --rm -t --privileged \
-v "$WORKSPACE/bundles:/go/src/github.com/docker/docker/bundles" \
-e DOCKER_EXPERIMENTAL=y \
--name docker-pr-exp$BUILD_NUMBER \
-e DOCKER_GITCOMMIT=${GITCOMMIT} \
-e DOCKER_GRAPHDRIVER=overlay2 \
docker:${GITCOMMIT}-exp \
hack/ci/experimental
'''
}
}
} }
post { post {
always { always {
sh ''' sh '''
@ -146,13 +189,13 @@ pipeline {
echo "Chowning /workspace to jenkins user" echo "Chowning /workspace to jenkins user"
docker run --rm -v "$WORKSPACE:/workspace" busybox chown -R "$(id -u):$(id -g)" /workspace docker run --rm -v "$WORKSPACE:/workspace" busybox chown -R "$(id -u):$(id -g)" /workspace
''' '''
sh ''' sh '''
echo "Creating bundles.tar.gz" echo "Creating bundles.tar.gz"
(find bundles -name '*.log' -o -name '*.prof' -o -name integration.test | xargs tar -czf experimental-bundles.tar.gz) || true (find bundles -name '*.log' -o -name '*.prof' -o -name integration.test | xargs tar -czf experimental-bundles.tar.gz) || true
''' '''
sh '''
make clean sh 'make clean'
'''
archiveArtifacts artifacts: 'experimental-bundles.tar.gz' archiveArtifacts artifacts: 'experimental-bundles.tar.gz'
deleteDir() deleteDir()
} }
@ -164,22 +207,33 @@ pipeline {
expression { params.z } expression { params.z }
} }
agent { label 's390x-ubuntu-1604' } agent { label 's390x-ubuntu-1604' }
steps {
sh ''' stages {
GITCOMMIT=$(git rev-parse --short HEAD) stage("Build dev image") {
steps {
docker build --force-rm --build-arg APT_MIRROR -t docker-s390x:$GITCOMMIT -f Dockerfile . sh '''
GITCOMMIT=$(git rev-parse --short HEAD)
docker run --rm -t --privileged \ docker build --force-rm --build-arg APT_MIRROR -t docker-s390x:$GITCOMMIT -f Dockerfile .
-v "$WORKSPACE/bundles:/go/src/github.com/docker/docker/bundles" \ '''
--name docker-pr-s390x$BUILD_NUMBER \ }
-e DOCKER_GRAPHDRIVER=vfs \ }
-e TIMEOUT="300m" \ stage("Run tests") {
-e DOCKER_GITCOMMIT=${GITCOMMIT} \ steps {
docker-s390x:$GITCOMMIT \ sh '''
hack/ci/z GITCOMMIT=$(git rev-parse --short HEAD)
''' docker run --rm -t --privileged \
-v "$WORKSPACE/bundles:/go/src/github.com/docker/docker/bundles" \
--name docker-pr-s390x$BUILD_NUMBER \
-e DOCKER_GRAPHDRIVER=vfs \
-e TIMEOUT="300m" \
-e DOCKER_GITCOMMIT=${GITCOMMIT} \
docker-s390x:$GITCOMMIT \
hack/ci/z
'''
}
}
} }
post { post {
always { always {
sh ''' sh '''
@ -189,6 +243,7 @@ pipeline {
echo "Chowning /workspace to jenkins user" echo "Chowning /workspace to jenkins user"
docker run --rm -v "$WORKSPACE:/workspace" s390x/busybox chown -R "$(id -u):$(id -g)" /workspace docker run --rm -v "$WORKSPACE:/workspace" s390x/busybox chown -R "$(id -u):$(id -g)" /workspace
''' '''
sh ''' sh '''
echo "Creating bundles.tar.gz" echo "Creating bundles.tar.gz"
find bundles -name '*.log' | xargs tar -czf s390x-bundles.tar.gz find bundles -name '*.log' | xargs tar -czf s390x-bundles.tar.gz
@ -204,22 +259,33 @@ pipeline {
expression { params.powerpc } expression { params.powerpc }
} }
agent { label 'ppc64le-ubuntu-1604' } agent { label 'ppc64le-ubuntu-1604' }
steps {
sh ''' stages {
GITCOMMIT=$(git rev-parse --short HEAD) stage("Build dev image") {
steps {
docker build --force-rm --build-arg APT_MIRROR -t docker-powerpc:$GITCOMMIT -f Dockerfile . sh '''
GITCOMMIT=$(git rev-parse --short HEAD)
docker run --rm -t --privileged \ docker build --force-rm --build-arg APT_MIRROR -t docker-powerpc:$GITCOMMIT -f Dockerfile .
-v "$WORKSPACE/bundles:/go/src/github.com/docker/docker/bundles" \ '''
--name docker-pr-power$BUILD_NUMBER \ }
-e DOCKER_GRAPHDRIVER=vfs \ }
-e DOCKER_GITCOMMIT=${GITCOMMIT} \ stage("Run tests") {
-e TIMEOUT="180m" \ steps {
docker-powerpc:$GITCOMMIT \ sh '''
hack/ci/powerpc GITCOMMIT=$(git rev-parse --short HEAD)
''' docker run --rm -t --privileged \
-v "$WORKSPACE/bundles:/go/src/github.com/docker/docker/bundles" \
--name docker-pr-power$BUILD_NUMBER \
-e DOCKER_GRAPHDRIVER=vfs \
-e DOCKER_GITCOMMIT=${GITCOMMIT} \
-e TIMEOUT="180m" \
docker-powerpc:$GITCOMMIT \
hack/ci/powerpc
'''
}
}
} }
post { post {
always { always {
sh ''' sh '''
@ -229,6 +295,7 @@ pipeline {
echo "Chowning /workspace to jenkins user" echo "Chowning /workspace to jenkins user"
docker run --rm -v "$WORKSPACE:/workspace" ppc64le/busybox chown -R "$(id -u):$(id -g)" /workspace docker run --rm -v "$WORKSPACE:/workspace" ppc64le/busybox chown -R "$(id -u):$(id -g)" /workspace
''' '''
sh ''' sh '''
echo "Creating bundles.tar.gz" echo "Creating bundles.tar.gz"
find bundles -name '*.log' | xargs tar -czf powerpc-bundles.tar.gz find bundles -name '*.log' | xargs tar -czf powerpc-bundles.tar.gz
@ -244,20 +311,30 @@ pipeline {
expression { params.vendor } expression { params.vendor }
} }
agent { label 'amd64 && ubuntu-1804 && overlay2' } agent { label 'amd64 && ubuntu-1804 && overlay2' }
steps {
sh ''' stages {
GITCOMMIT=$(git rev-parse --short HEAD) stage("Build dev image") {
steps {
docker build --force-rm --build-arg APT_MIRROR -t dockerven:$GITCOMMIT . sh '''
GITCOMMIT=$(git rev-parse --short HEAD)
docker run --rm -t --privileged \ docker build --force-rm --build-arg APT_MIRROR -t dockerven:$GITCOMMIT .
--name dockerven-pr$BUILD_NUMBER \ '''
-e DOCKER_GRAPHDRIVER=vfs \ }
-v "$WORKSPACE/.git:/go/src/github.com/docker/docker/.git" \ }
-e DOCKER_GITCOMMIT=${GITCOMMIT} \ stage("Run tests") {
-e TIMEOUT=120m dockerven:$GITCOMMIT \ steps {
hack/validate/vendor sh '''
''' GITCOMMIT=$(git rev-parse --short HEAD)
docker run --rm -t --privileged \
--name dockerven-pr$BUILD_NUMBER \
-e DOCKER_GRAPHDRIVER=vfs \
-v "$WORKSPACE/.git:/go/src/github.com/docker/docker/.git" \
-e DOCKER_GITCOMMIT=${GITCOMMIT} \
-e TIMEOUT=120m dockerven:$GITCOMMIT \
hack/validate/vendor
'''
}
}
} }
} }
stage('windowsRS1') { stage('windowsRS1') {
@ -271,12 +348,16 @@ pipeline {
customWorkspace 'c:\\gopath\\src\\github.com\\docker\\docker' customWorkspace 'c:\\gopath\\src\\github.com\\docker\\docker'
} }
} }
steps { stages {
powershell ''' stage("Run tests") {
$ErrorActionPreference = 'Stop' steps {
.\\hack\\ci\\windows.ps1 powershell '''
exit $LastExitCode $ErrorActionPreference = 'Stop'
''' .\\hack\\ci\\windows.ps1
exit $LastExitCode
'''
}
}
} }
} }
stage('windowsRS5-process') { stage('windowsRS5-process') {
@ -290,12 +371,16 @@ pipeline {
customWorkspace 'c:\\gopath\\src\\github.com\\docker\\docker' customWorkspace 'c:\\gopath\\src\\github.com\\docker\\docker'
} }
} }
steps { stages {
powershell ''' stage("Run tests") {
$ErrorActionPreference = 'Stop' steps {
.\\hack\\ci\\windows.ps1 powershell '''
exit $LastExitCode $ErrorActionPreference = 'Stop'
''' .\\hack\\ci\\windows.ps1
exit $LastExitCode
'''
}
}
} }
} }
} }