From b468a38b6ceb528471a01d3a7ed237de10dedbb6 Mon Sep 17 00:00:00 2001 From: Victor Martinez Date: Wed, 14 Aug 2019 12:23:55 +0100 Subject: [PATCH 1/3] Revert "ci(jenkins): delegate docker setup to the preCommit step (#557)" This reverts commit b4fc4469fa172c2d3d2ee56b5c1bbdf115c65140. --- .ci/Jenkinsfile | 6 ++++-- .ci/linting.groovy | 4 +++- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/.ci/Jenkinsfile b/.ci/Jenkinsfile index 5d18fc0c1..7be2d0aec 100644 --- a/.ci/Jenkinsfile +++ b/.ci/Jenkinsfile @@ -56,8 +56,10 @@ pipeline { deleteDir() unstash 'source' script { - dir(BASE_DIR){ - preCommit(commit: "${GIT_BASE_COMMIT}", junit: true, dockerImage: 'python:3.7-stretch') + docker.image('python:3.7-stretch').inside("-e PATH=${PATH}:${env.WORKSPACE}/bin"){ + dir("${BASE_DIR}"){ + preCommit(commit: "${GIT_BASE_COMMIT}", junit: true) + } } } } diff --git a/.ci/linting.groovy b/.ci/linting.groovy index 4efe668c7..270f9e75a 100644 --- a/.ci/linting.groovy +++ b/.ci/linting.groovy @@ -25,7 +25,9 @@ pipeline { steps { script { def sha = getGitCommitSha() - preCommit(commit: "${sha}", junit: true, dockerImage: 'python:3.7-stretch') + docker.image('python:3.7-stretch').inside("-e PATH=${PATH}:${env.WORKSPACE}/bin"){ + preCommit(commit: "${sha}", junit: true) + } } } } From 0220f8e780d0863546dec66f29e6844e71be676e Mon Sep 17 00:00:00 2001 From: Victor Martinez Date: Wed, 14 Aug 2019 12:27:42 +0100 Subject: [PATCH 2/3] ci(jenkins): override registry params to ensure no docker login is done within the docker container as it's not required and might fail --- .ci/Jenkinsfile | 3 ++- .ci/linting.groovy | 3 ++- Jenkinsfile | 7 +++++-- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/.ci/Jenkinsfile b/.ci/Jenkinsfile index 7be2d0aec..d6680a67d 100644 --- a/.ci/Jenkinsfile +++ b/.ci/Jenkinsfile @@ -58,7 +58,8 @@ pipeline { script { docker.image('python:3.7-stretch').inside("-e PATH=${PATH}:${env.WORKSPACE}/bin"){ dir("${BASE_DIR}"){ - preCommit(commit: "${GIT_BASE_COMMIT}", junit: true) + // registry: '' will help to disable the docker login + preCommit(commit: "${GIT_BASE_COMMIT}", junit: true, registry: '') } } } diff --git a/.ci/linting.groovy b/.ci/linting.groovy index 270f9e75a..3dabe46e6 100644 --- a/.ci/linting.groovy +++ b/.ci/linting.groovy @@ -26,7 +26,8 @@ pipeline { script { def sha = getGitCommitSha() docker.image('python:3.7-stretch').inside("-e PATH=${PATH}:${env.WORKSPACE}/bin"){ - preCommit(commit: "${sha}", junit: true) + // registry: '' will help to disable the docker login + preCommit(commit: "${sha}", junit: true, registry: '') } } } diff --git a/Jenkinsfile b/Jenkinsfile index c5946fae2..88101377a 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -70,8 +70,11 @@ pipeline { deleteDir() unstash 'source' script { - dir(BASE_DIR){ - preCommit(commit: "${GIT_BASE_COMMIT}", junit: true, dockerImage: 'python:3.7-stretch') + docker.image('python:3.7-stretch').inside("-e PATH=${PATH}:${env.WORKSPACE}/bin"){ + dir("${BASE_DIR}"){ + // registry: '' will help to disable the docker login + preCommit(commit: "${GIT_BASE_COMMIT}", junit: true, registry: '') + } } } } From 401a329d3afe9b8bfe853cca936649131d4a3af2 Mon Sep 17 00:00:00 2001 From: Victor Martinez Date: Wed, 14 Aug 2019 12:31:52 +0100 Subject: [PATCH 3/3] ci(jenkins): enable to run the same stages in the PRs if required --- .ci/Jenkinsfile | 5 +++-- Jenkinsfile | 5 +++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/.ci/Jenkinsfile b/.ci/Jenkinsfile index d6680a67d..06794a88c 100644 --- a/.ci/Jenkinsfile +++ b/.ci/Jenkinsfile @@ -47,8 +47,9 @@ pipeline { stage('Sanity checks') { when { beforeAgent true - not { - changeRequest() + anyOf { + not { changeRequest() } + expression { return params.Run_As_Master_Branch } } } steps { diff --git a/Jenkinsfile b/Jenkinsfile index 88101377a..4df6d9893 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -61,8 +61,9 @@ pipeline { stage('Sanity checks') { when { beforeAgent true - not { - changeRequest() + anyOf { + not { changeRequest() } + expression { return params.Run_As_Master_Branch } } } steps {