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

105
Jenkinsfile vendored
View file

@ -31,6 +31,8 @@ pipeline {
}
agent { label 'amd64 && ubuntu-1804 && overlay2' }
stages {
stage("Build dev image") {
steps {
sh '''
# todo: include ip_vs in base image
@ -38,6 +40,13 @@ pipeline {
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)
docker run --rm -t --privileged \
-v "$WORKSPACE/bundles:/go/src/github.com/docker/docker/bundles" \
@ -49,6 +58,9 @@ pipeline {
hack/test/unit
'''
}
}
}
post {
always {
junit 'bundles/junit-report.xml'
@ -58,7 +70,9 @@ pipeline {
echo 'Chowning /workspace to jenkins user'
docker run --rm -v "$WORKSPACE:/workspace" busybox chown -R "$(id -u):$(id -g)" /workspace
'''
sh '''
echo 'Creating unit-bundles.tar.gz'
tar -czvf unit-bundles.tar.gz bundles/junit-report.xml bundles/go-test-report.json bundles/profile.out
'''
@ -74,6 +88,8 @@ pipeline {
}
agent { label 'amd64 && ubuntu-1804 && overlay2' }
stages {
stage("Build dev image") {
steps {
sh '''
# todo: include ip_vs in base image
@ -81,6 +97,13 @@ pipeline {
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)
docker run --rm -t --privileged \
-v "$WORKSPACE/bundles:/go/src/github.com/docker/docker/bundles" \
@ -92,12 +115,19 @@ pipeline {
docker:$GITCOMMIT \
hack/ci/janky
'''
}
}
stage("Build e2e image") {
steps {
sh '''
GITCOMMIT=$(git rev-parse --short HEAD)
echo "Building e2e image"
docker build --build-arg DOCKER_GITCOMMIT=$GITCOMMIT -t moby-e2e-test -f Dockerfile.e2e .
'''
}
}
}
post {
always {
sh '''
@ -107,6 +137,7 @@ pipeline {
echo "Chowning /workspace to jenkins user"
docker run --rm -v "$WORKSPACE:/workspace" busybox chown -R "$(id -u):$(id -g)" /workspace
'''
sh '''
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
@ -122,11 +153,20 @@ pipeline {
expression { params.experimental }
}
agent { label 'amd64 && ubuntu-1804 && overlay2' }
stages {
stage("Build dev image") {
steps {
sh '''
GITCOMMIT=$(git rev-parse --short HEAD)
docker build --force-rm --build-arg APT_MIRROR -t docker:${GITCOMMIT}-exp .
'''
}
}
stage("Run tests") {
steps {
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 \
@ -137,6 +177,9 @@ pipeline {
hack/ci/experimental
'''
}
}
}
post {
always {
sh '''
@ -146,13 +189,13 @@ pipeline {
echo "Chowning /workspace to jenkins user"
docker run --rm -v "$WORKSPACE:/workspace" busybox chown -R "$(id -u):$(id -g)" /workspace
'''
sh '''
echo "Creating bundles.tar.gz"
(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'
deleteDir()
}
@ -164,12 +207,20 @@ pipeline {
expression { params.z }
}
agent { label 's390x-ubuntu-1604' }
stages {
stage("Build dev image") {
steps {
sh '''
GITCOMMIT=$(git rev-parse --short HEAD)
docker build --force-rm --build-arg APT_MIRROR -t docker-s390x:$GITCOMMIT -f Dockerfile .
'''
}
}
stage("Run tests") {
steps {
sh '''
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 \
@ -180,6 +231,9 @@ pipeline {
hack/ci/z
'''
}
}
}
post {
always {
sh '''
@ -189,6 +243,7 @@ pipeline {
echo "Chowning /workspace to jenkins user"
docker run --rm -v "$WORKSPACE:/workspace" s390x/busybox chown -R "$(id -u):$(id -g)" /workspace
'''
sh '''
echo "Creating bundles.tar.gz"
find bundles -name '*.log' | xargs tar -czf s390x-bundles.tar.gz
@ -204,12 +259,20 @@ pipeline {
expression { params.powerpc }
}
agent { label 'ppc64le-ubuntu-1604' }
stages {
stage("Build dev image") {
steps {
sh '''
GITCOMMIT=$(git rev-parse --short HEAD)
docker build --force-rm --build-arg APT_MIRROR -t docker-powerpc:$GITCOMMIT -f Dockerfile .
'''
}
}
stage("Run tests") {
steps {
sh '''
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 \
@ -220,6 +283,9 @@ pipeline {
hack/ci/powerpc
'''
}
}
}
post {
always {
sh '''
@ -229,6 +295,7 @@ pipeline {
echo "Chowning /workspace to jenkins user"
docker run --rm -v "$WORKSPACE:/workspace" ppc64le/busybox chown -R "$(id -u):$(id -g)" /workspace
'''
sh '''
echo "Creating bundles.tar.gz"
find bundles -name '*.log' | xargs tar -czf powerpc-bundles.tar.gz
@ -244,12 +311,20 @@ pipeline {
expression { params.vendor }
}
agent { label 'amd64 && ubuntu-1804 && overlay2' }
stages {
stage("Build dev image") {
steps {
sh '''
GITCOMMIT=$(git rev-parse --short HEAD)
docker build --force-rm --build-arg APT_MIRROR -t dockerven:$GITCOMMIT .
'''
}
}
stage("Run tests") {
steps {
sh '''
GITCOMMIT=$(git rev-parse --short HEAD)
docker run --rm -t --privileged \
--name dockerven-pr$BUILD_NUMBER \
-e DOCKER_GRAPHDRIVER=vfs \
@ -260,6 +335,8 @@ pipeline {
'''
}
}
}
}
stage('windowsRS1') {
when {
beforeAgent true
@ -271,6 +348,8 @@ pipeline {
customWorkspace 'c:\\gopath\\src\\github.com\\docker\\docker'
}
}
stages {
stage("Run tests") {
steps {
powershell '''
$ErrorActionPreference = 'Stop'
@ -279,6 +358,8 @@ pipeline {
'''
}
}
}
}
stage('windowsRS5-process') {
when {
beforeAgent true
@ -290,6 +371,8 @@ pipeline {
customWorkspace 'c:\\gopath\\src\\github.com\\docker\\docker'
}
}
stages {
stage("Run tests") {
steps {
powershell '''
$ErrorActionPreference = 'Stop'
@ -302,3 +385,5 @@ pipeline {
}
}
}
}
}