From 4f97c1348d9b5669a51fe63c91c09e8e3e3cf3fd Mon Sep 17 00:00:00 2001 From: Ivan Fernandez Calvo Date: Thu, 9 Jul 2020 15:56:53 +0200 Subject: [PATCH] ci: set builds as skipped when they do not match the trigger (#19750) * ci: set builds as skipped when they do not match the trigger * Apply suggestions from code review * Apply suggestions from code review * Apply suggestions from code review --- .ci/apm-beats-update.groovy | 9 ++++++++- .ci/packaging.groovy | 9 ++++++++- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/.ci/apm-beats-update.groovy b/.ci/apm-beats-update.groovy index 376ceb4190f..d66072fc435 100644 --- a/.ci/apm-beats-update.groovy +++ b/.ci/apm-beats-update.groovy @@ -35,7 +35,14 @@ pipeline { when { beforeAgent true expression { - return isCommentTrigger() || isUserTrigger() + def ret = isCommentTrigger() || isUserTrigger() + if(!ret){ + currentBuild.result = 'NOT_BUILT' + currentBuild.description = "The build has been skipped" + currentBuild.displayName = "#${BUILD_NUMBER}-(Skipped)" + echo("the build has been skipped due the trigger is a branch scan and the allow ones are manual, and GitHub comment") + } + return ret } } /** diff --git a/.ci/packaging.groovy b/.ci/packaging.groovy index 91b94221c99..280abe2f9e7 100644 --- a/.ci/packaging.groovy +++ b/.ci/packaging.groovy @@ -38,7 +38,14 @@ pipeline { when { beforeAgent true expression { - return isCommentTrigger() || isUserTrigger() || isUpstreamTrigger() + def ret = isCommentTrigger() || isUserTrigger() || isUpstreamTrigger() + if(!ret){ + currentBuild.result = 'NOT_BUILT' + currentBuild.description = "The build has been skipped" + currentBuild.displayName = "#${BUILD_NUMBER}-(Skipped)" + echo("the build has been skipped due the trigger is a branch scan and the allow ones are manual, GitHub comment, and upstream job") + } + return ret } } stages {