From 54b1b2fefedd9a7aa4512c58b7d61f4fad3359ee Mon Sep 17 00:00:00 2001 From: Victor Martinez Date: Wed, 23 Mar 2022 12:46:55 +0000 Subject: [PATCH 1/3] ci: disable stages if only docs changes or .github --- .ci/Jenkinsfile | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/.ci/Jenkinsfile b/.ci/Jenkinsfile index 87dd8060cf6..8b189df9851 100644 --- a/.ci/Jenkinsfile +++ b/.ci/Jenkinsfile @@ -41,9 +41,15 @@ pipeline { deleteDir() gitCheckout(basedir: "${BASE_DIR}") stashV2(name: 'source', bucket: "${JOB_GCS_BUCKET}", credentialsId: "${JOB_GCS_CREDENTIALS}") + setEnvVar('ONLY_DOCS', isGitRegionMatch(patterns: [ '.*\\.(asciidoc|md)' ], shouldMatchAll: true).toString()) + // Skip all the stages except check Go sources for changeset's with asciidoc, md or .github changes only + setEnvVar('ONLY_DOCS', isGitRegionMatch(patterns: [ '(.*\\.(asciidoc|md)|^\\.github/.*)' ], shouldMatchAll: true).toString()) } } stage('Check Go sources') { + when { + expression { return env.ONLY_DOCS == "false" } + } steps { dir("${BASE_DIR}"){ withMageEnv(){ @@ -54,6 +60,9 @@ pipeline { } } stage('Check integrations') { + when { + expression { return env.ONLY_DOCS == "false" } + } steps { script { dir("${BASE_DIR}/packages") { @@ -115,7 +124,9 @@ pipeline { } post { always { - publishCoverageReports() + whenTrue(env.ONLY_DOCS == "false") { + publishCoverageReports() + } } cleanup { notifyBuildResult(prComment: true) From b853ba46bd6d0a3952d65b0664f5ebffcc6e00b6 Mon Sep 17 00:00:00 2001 From: Victor Martinez Date: Wed, 23 Mar 2022 12:55:56 +0000 Subject: [PATCH 2/3] run within the git context --- .ci/Jenkinsfile | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/.ci/Jenkinsfile b/.ci/Jenkinsfile index 8b189df9851..6884ac49b41 100644 --- a/.ci/Jenkinsfile +++ b/.ci/Jenkinsfile @@ -41,9 +41,10 @@ pipeline { deleteDir() gitCheckout(basedir: "${BASE_DIR}") stashV2(name: 'source', bucket: "${JOB_GCS_BUCKET}", credentialsId: "${JOB_GCS_CREDENTIALS}") - setEnvVar('ONLY_DOCS', isGitRegionMatch(patterns: [ '.*\\.(asciidoc|md)' ], shouldMatchAll: true).toString()) - // Skip all the stages except check Go sources for changeset's with asciidoc, md or .github changes only - setEnvVar('ONLY_DOCS', isGitRegionMatch(patterns: [ '(.*\\.(asciidoc|md)|^\\.github/.*)' ], shouldMatchAll: true).toString()) + dir("${BASE_DIR}"){ + // Skip all the stages except check Go sources for changeset's with asciidoc, md or .github changes only + setEnvVar('ONLY_DOCS', isGitRegionMatch(patterns: [ '(.*\\.(asciidoc|md)|^\\.github/.*)' ], shouldMatchAll: true).toString()) + } } } stage('Check Go sources') { From e2bf750cd8c2dfa4b113a152aa14b2e8ba177ca8 Mon Sep 17 00:00:00 2001 From: Victor Martinez Date: Wed, 23 Mar 2022 13:37:17 +0000 Subject: [PATCH 3/3] ci: filter for docs/*.md and .github --- .ci/Jenkinsfile | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/.ci/Jenkinsfile b/.ci/Jenkinsfile index 6884ac49b41..a24a94e6193 100644 --- a/.ci/Jenkinsfile +++ b/.ci/Jenkinsfile @@ -42,15 +42,12 @@ pipeline { gitCheckout(basedir: "${BASE_DIR}") stashV2(name: 'source', bucket: "${JOB_GCS_BUCKET}", credentialsId: "${JOB_GCS_CREDENTIALS}") dir("${BASE_DIR}"){ - // Skip all the stages except check Go sources for changeset's with asciidoc, md or .github changes only - setEnvVar('ONLY_DOCS', isGitRegionMatch(patterns: [ '(.*\\.(asciidoc|md)|^\\.github/.*)' ], shouldMatchAll: true).toString()) + // Skip all the stages except check Go sources for changeset's with ^docs/*.md or ^.github only + setEnvVar('ONLY_DOCS', isGitRegionMatch(patterns: [ '(^docs/.*\\.md|^\\.github/.*)' ], shouldMatchAll: true).toString()) } } } stage('Check Go sources') { - when { - expression { return env.ONLY_DOCS == "false" } - } steps { dir("${BASE_DIR}"){ withMageEnv(){