From cc336f432b15d777c1c494fb919b202654a8caaa Mon Sep 17 00:00:00 2001 From: OZGCloud <ozgcloud@mgm-tp.com> Date: Mon, 13 Mar 2023 10:18:35 +0100 Subject: [PATCH] OZG-3420 skip scm build --- goofy-client/apps/goofy-e2e/Jenkinsfile | 57 +++++++++++-------------- 1 file changed, 26 insertions(+), 31 deletions(-) diff --git a/goofy-client/apps/goofy-e2e/Jenkinsfile b/goofy-client/apps/goofy-e2e/Jenkinsfile index ce4ff6e2b0..426250bc21 100644 --- a/goofy-client/apps/goofy-e2e/Jenkinsfile +++ b/goofy-client/apps/goofy-e2e/Jenkinsfile @@ -1,5 +1,7 @@ import groovy.json.JsonOutput +def SKIP_RUN = false + pipeline { agent { node { @@ -31,13 +33,26 @@ pipeline { } stages { - stage('Checkout SCM') { + stage('Checkout build trigger') { when { - anyOf { + not { triggeredBy 'BuildUpstreamCause' + } + not { triggeredBy cause: "UserIdCause" } } + steps { + script { + SKIP_RUN = true + currentBuild.result= "ABORTED" + } + } + } + stage('Checkout SCM') { + when { + expression { !SKIP_RUN } + } steps { script { FAILED_STAGE = env.STAGE_NAME @@ -48,10 +63,7 @@ pipeline { } stage("Clone Gitops Repo") { when { - anyOf { - triggeredBy 'BuildUpstreamCause' - triggeredBy cause: "UserIdCause" - } + expression { !SKIP_RUN } } steps { script { @@ -64,10 +76,7 @@ pipeline { stage("Init Default Versions") { when { - anyOf { - triggeredBy 'BuildUpstreamCause' - triggeredBy cause: "UserIdCause" - } + expression { !SKIP_RUN } } steps { script { @@ -82,6 +91,7 @@ pipeline { stage("Set User Versions") { when { + expression { !SKIP_RUN } beforeInput true triggeredBy cause: "UserIdCause" } @@ -106,10 +116,7 @@ pipeline { stage("Install Cypress") { when { - anyOf { - triggeredBy 'BuildUpstreamCause' - triggeredBy cause: "UserIdCause" - } + expression { !SKIP_RUN } } steps { script { @@ -130,10 +137,7 @@ pipeline { stage('Init k8s') { when { - anyOf { - triggeredBy 'BuildUpstreamCause' - triggeredBy cause: "UserIdCause" - } + expression { !SKIP_RUN } } steps { script { @@ -151,10 +155,7 @@ pipeline { stage('Rollout E2E Namespaces') { when { - anyOf { - triggeredBy 'BuildUpstreamCause' - triggeredBy cause: "UserIdCause" - } + expression { !SKIP_RUN } } steps { script { @@ -183,10 +184,7 @@ pipeline { stage('Run E2E-Tests') { when { - anyOf { - triggeredBy 'BuildUpstreamCause' - triggeredBy cause: "UserIdCause" - } + expression { !SKIP_RUN } } failFast false @@ -249,10 +247,7 @@ pipeline { stage('Delete E2E Namespaces') { when { - anyOf { - triggeredBy 'BuildUpstreamCause' - triggeredBy cause: "UserIdCause" - } + expression { !SKIP_RUN } } steps { script { @@ -701,7 +696,7 @@ Void sendFailureMessage() { String getFailedStage() { if (FAILED_PARALLEL_STAGE.trim()) { - return FAILED_PARALLEL_STAGE + return FAILED_PARALLEL_STAGE.trim() } return FAILED_STAGE -- GitLab