From 4d13504211b37fdead851f9afac4d87e276cd8d0 Mon Sep 17 00:00:00 2001 From: Niels de Vos Date: Wed, 12 Aug 2020 15:17:28 +0200 Subject: [PATCH] ci: skip ci-job-validation for doc-only PRs Signed-off-by: Niels de Vos --- ci-job-validation.groovy | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/ci-job-validation.groovy b/ci-job-validation.groovy index c4192ef6f..230ecd350 100644 --- a/ci-job-validation.groovy +++ b/ci-job-validation.groovy @@ -3,7 +3,9 @@ def cico_retry_interval = 60 def ci_git_repo = 'https://github.com/ceph/ceph-csi' def ci_git_branch = 'ci/centos' def ref = 'ci/centos' +def git_since = 'ci/centos' def base = '' +def doc_change = 0 node('cico-workspace') { stage('checkout ci repository') { @@ -14,6 +16,29 @@ node('cico-workspace') { userRemoteConfigs: [[url: "${ci_git_repo}", refspec: "${ref}"]]]) } + stage('checkout PR') { + if (params.ghprbPullId != null) { + ref = "pull/${ghprbPullId}/head" + } + if (params.ghprbTargetBranch != null) { + git_since = "${ghprbTargetBranch}" + } + + sh "git clone --depth=1 --branch='${git_since}' '${git_repo}' ~/build/ceph-csi" + sh "cd ~/build/ceph-csi && git fetch origin ${ref} && git checkout -b ${ref} FETCH_HEAD" + } + + stage('check doc-only change') { + doc_change = sh( + script: "cd ~/build/ceph-csi && \${OLDPWD}/scripts/skip-doc-change.sh origin/${git_since}", + returnStatus: true) + } + // if doc_change (return value of skip-doc-change.sh is 1, do not run the other stages + if (doc_change == 1) { + currentBuild.result = 'SUCCESS' + return + } + stage('reserve bare-metal machine') { def firstAttempt = true retry(30) {