From 2b3b9288901f3271012bb7f72601ee603cde6bba Mon Sep 17 00:00:00 2001 From: "mergify[bot]" <37929162+mergify[bot]@users.noreply.github.com> Date: Wed, 23 Jun 2021 17:30:31 +0100 Subject: [PATCH] [7.12](backport #25864) ci: exclude builds with changes on the k8s templates files (#25943) --- Jenkinsfile | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 30479827d91..9a0611c4f44 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -53,11 +53,18 @@ pipeline { steps { pipelineManager([ cancelPreviousRunningBuilds: [ when: 'PR' ] ]) deleteDir() - gitCheckout(basedir: "${BASE_DIR}", githubNotifyFirstTimeContributor: true) + // Here we do a checkout into a temporary directory in order to have the + // side-effect of setting up the git environment correctly. + gitCheckout(basedir: "${pwd(tmp: true)}", githubNotifyFirstTimeContributor: true) + dir("${BASE_DIR}") { + // We use a raw checkout to avoid the many extra objects which are brought in + // with a `git fetch` as would happen if we used the `gitCheckout` step. + checkout scm + } stashV2(name: 'source', bucket: "${JOB_GCS_BUCKET}", credentialsId: "${JOB_GCS_CREDENTIALS}") dir("${BASE_DIR}"){ - // Skip all the stages except docs for PR's with asciidoc and md changes only - setEnvVar('ONLY_DOCS', isGitRegionMatch(patterns: [ '.*\\.(asciidoc|md)' ], shouldMatchAll: true).toString()) + // Skip all the stages except docs for PR's with asciidoc, md or deploy k8s templates changes only + setEnvVar('ONLY_DOCS', isGitRegionMatch(patterns: [ '(.*\\.(asciidoc|md)|deploy/kubernetes/.*-kubernetes\\.yaml)' ], shouldMatchAll: true).toString()) setEnvVar('GO_MOD_CHANGES', isGitRegionMatch(patterns: [ '^go.mod' ], shouldMatchAll: false).toString()) setEnvVar('PACKAGING_CHANGES', isGitRegionMatch(patterns: [ '^dev-tools/packaging/.*' ], shouldMatchAll: false).toString()) setEnvVar('GO_VERSION', readFile(".go-version").trim())