From 6ccfb7f01f77e94dc63922f1d4c4ec6ed89b6f86 Mon Sep 17 00:00:00 2001 From: Ivan Fernandez Calvo Date: Mon, 13 Jul 2020 19:10:26 +0200 Subject: [PATCH] test: change the comment trigger detection method --- .ci/apm-beats-update.groovy | 19 +++++++++++-------- .ci/packaging.groovy | 20 +++++++++++--------- 2 files changed, 22 insertions(+), 17 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 fef83578dc5..546f7decd7a 100644 --- a/.ci/packaging.groovy +++ b/.ci/packaging.groovy @@ -37,16 +37,18 @@ pipeline { agent { label 'ubuntu && immutable' } when { beforeAgent true - expression { - echo "C: ${isCommentTrigger()} - U: ${isUserTrigger()} - UP: ${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") + 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 {