From 6ee17e123345e83ccfe5464968793545d93dd8e4 Mon Sep 17 00:00:00 2001 From: Ivan Fernandez Calvo Date: Tue, 14 Jul 2020 09:48:31 +0200 Subject: [PATCH] ci: Change comment trigger detection method (#19827) * test: check which trigger is enabled * chore: merge master * test: test a fix * test: change the comment trigger detection method * test: change the comment trigger detection method * Update .ci/packaging.groovy Co-authored-by: Victor Martinez Co-authored-by: Victor Martinez --- .ci/apm-beats-update.groovy | 19 +++++++++++-------- .ci/packaging.groovy | 19 +++++++++++-------- 2 files changed, 22 insertions(+), 16 deletions(-) diff --git a/.ci/apm-beats-update.groovy b/.ci/apm-beats-update.groovy index d66072fc435..4a923a0adad 100644 --- a/.ci/apm-beats-update.groovy +++ b/.ci/apm-beats-update.groovy @@ -34,15 +34,18 @@ pipeline { agent { label 'ubuntu && immutable' } when { beforeAgent true - expression { - 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") + anyOf { + triggeredBy cause: "IssueCommentCause" + expression { + def ret = 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 } - return ret } } /** diff --git a/.ci/packaging.groovy b/.ci/packaging.groovy index 280abe2f9e7..38effd7d23e 100644 --- a/.ci/packaging.groovy +++ b/.ci/packaging.groovy @@ -37,15 +37,18 @@ pipeline { agent { label 'ubuntu && immutable' } when { beforeAgent true - expression { - 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") + anyOf { + triggeredBy cause: "IssueCommentCause" + expression { + def ret = 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 } - return ret } } stages {