Allow precommits to coexist with phrase triggering

Project: http://git-wip-us.apache.org/repos/asf/beam/repo
Commit: http://git-wip-us.apache.org/repos/asf/beam/commit/6416deb0
Tree: http://git-wip-us.apache.org/repos/asf/beam/tree/6416deb0
Diff: http://git-wip-us.apache.org/repos/asf/beam/diff/6416deb0

Branch: refs/heads/master
Commit: 6416deb0f1a706c7ef899f8a227e225ea5a3c2d9
Parents: ec5e724
Author: Kenneth Knowles <k...@google.com>
Authored: Fri Oct 6 14:14:29 2017 -0700
Committer: Kenneth Knowles <k...@google.com>
Committed: Mon Oct 9 09:10:06 2017 -0700

----------------------------------------------------------------------
 .test-infra/jenkins/common_job_properties.groovy | 15 ++++++++++-----
 1 file changed, 10 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/beam/blob/6416deb0/.test-infra/jenkins/common_job_properties.groovy
----------------------------------------------------------------------
diff --git a/.test-infra/jenkins/common_job_properties.groovy 
b/.test-infra/jenkins/common_job_properties.groovy
index 87763a2..c6a8b27 100644
--- a/.test-infra/jenkins/common_job_properties.groovy
+++ b/.test-infra/jenkins/common_job_properties.groovy
@@ -122,8 +122,9 @@ class common_job_properties {
   // below to insulate callers from internal parameter defaults.
   private static void setPullRequestBuildTrigger(context,
                                                  String commitStatusContext,
-                                                 String successComment = 
'--none--',
-                                                 String prTriggerPhrase = '') {
+                                                 String prTriggerPhrase = '',
+                                                 boolean 
onlyTriggerPhraseToggle = true,
+                                                 String successComment = 
'--none--') {
     context.triggers {
       githubPullRequest {
         admins(['asfbot'])
@@ -138,6 +139,8 @@ class common_job_properties {
         // required to start it.
         if (prTriggerPhrase) {
           triggerPhrase(prTriggerPhrase)
+        }
+        if (onlyTriggerPhraseToggle) {
           onlyTriggerPhrase()
         }
 
@@ -182,9 +185,10 @@ class common_job_properties {
   // Sets common config for PreCommit jobs.
   static void setPreCommit(context,
                            String commitStatusName,
+                           String prTriggerPhrase = '',
                            String successComment = '--none--') {
     // Set pull request build trigger.
-    setPullRequestBuildTrigger(context, commitStatusName, successComment)
+    setPullRequestBuildTrigger(context, commitStatusName, prTriggerPhrase, 
false, successComment)
   }
 
   // Enable triggering postcommit runs against pull requests. Users can 
comment the trigger phrase
@@ -196,8 +200,9 @@ class common_job_properties {
     setPullRequestBuildTrigger(
       context,
       commitStatusName,
-      '--none--',
-      prTriggerPhrase)
+      prTriggerPhrase,
+      true,
+      '--none--')
   }
 
   // Sets common config for PostCommit jobs.

Reply via email to