From cebc1a52323db0b2cc7480904ad39fedc35b6868 Mon Sep 17 00:00:00 2001 From: jstastny-cz Date: Wed, 25 Oct 2023 11:36:05 +0200 Subject: [PATCH] kie-issues#651: introduce DISABLE_PR_CHECK config env variable --- .../groovy/org/kie/jenkins/jobdsl/KogitoJobTemplate.groovy | 3 +++ dsl/seed/src/main/groovy/org/kie/jenkins/jobdsl/Utils.groovy | 4 ++++ 2 files changed, 7 insertions(+) diff --git a/dsl/seed/src/main/groovy/org/kie/jenkins/jobdsl/KogitoJobTemplate.groovy b/dsl/seed/src/main/groovy/org/kie/jenkins/jobdsl/KogitoJobTemplate.groovy index 438a10e5c..44b2e8083 100644 --- a/dsl/seed/src/main/groovy/org/kie/jenkins/jobdsl/KogitoJobTemplate.groovy +++ b/dsl/seed/src/main/groovy/org/kie/jenkins/jobdsl/KogitoJobTemplate.groovy @@ -482,6 +482,9 @@ class KogitoJobTemplate { scriptPath(jenkinsFilePath) } } + configure { + it / disabled << Utils.isPrCheckDisabled(script) + } branchSources { github { id(Utils.getRepoName(script)) // IMPORTANT: use a constant and unique identifier diff --git a/dsl/seed/src/main/groovy/org/kie/jenkins/jobdsl/Utils.groovy b/dsl/seed/src/main/groovy/org/kie/jenkins/jobdsl/Utils.groovy index c11b65f35..14ce74d1f 100644 --- a/dsl/seed/src/main/groovy/org/kie/jenkins/jobdsl/Utils.groovy +++ b/dsl/seed/src/main/groovy/org/kie/jenkins/jobdsl/Utils.groovy @@ -283,4 +283,8 @@ class Utils { return getBindingValue(script, 'DISABLE_DEPLOY').toBoolean() || isTestEnvironment(script) } + static boolean isPrCheckDisabled(def script) { + return getBindingValue(script, 'DISABLE_PR_CHECK').toBoolean() || isTestEnvironment(script) + } + }