Add trigger for launching release job via comment 55/6355/2
authorThanh Ha <thanh.ha@linuxfoundation.org>
Wed, 6 Sep 2017 23:23:28 +0000 (19:23 -0400)
committerThanh Ha <thanh.ha@linuxfoundation.org>
Thu, 7 Sep 2017 14:14:03 +0000 (10:14 -0400)
Allows the release job to be triggered via Gerrit / GitHub PR comment.
This allows contributors to initiate a release build without needing
permissions via Jenkins directly.

Issue: RELENG-426
Change-Id: I2c75f607cc57471afb49fa0347bb130af214ea4b
Signed-off-by: Thanh Ha <thanh.ha@linuxfoundation.org>
.jjb-test/expected-xml/gerrit-maven-maven-release-master
.jjb-test/expected-xml/github-maven-maven-release-master
jjb/lf-maven-jobs.yaml

index dd4d3e8..191c781 100644 (file)
@@ -143,6 +143,53 @@ For example '&lt;1.0.0' or '&gt;=1.0.0,&lt;2.0.0'.
       <hudson.plugins.git.extensions.impl.WipeWorkspace/>
     </extensions>
   </scm>
+  <triggers class="vector">
+    <com.sonyericsson.hudson.plugins.gerrit.trigger.hudsontrigger.GerritTrigger>
+      <spec/>
+      <gerritProjects>
+        <com.sonyericsson.hudson.plugins.gerrit.trigger.hudsontrigger.data.GerritProject>
+          <compareType>ANT</compareType>
+          <pattern>releng/ciman</pattern>
+          <branches>
+            <com.sonyericsson.hudson.plugins.gerrit.trigger.hudsontrigger.data.Branch>
+              <compareType>ANT</compareType>
+              <pattern>**/master</pattern>
+            </com.sonyericsson.hudson.plugins.gerrit.trigger.hudsontrigger.data.Branch>
+          </branches>
+          <disableStrictForbiddenFileVerification>false</disableStrictForbiddenFileVerification>
+        </com.sonyericsson.hudson.plugins.gerrit.trigger.hudsontrigger.data.GerritProject>
+      </gerritProjects>
+      <skipVote>
+        <onSuccessful>false</onSuccessful>
+        <onFailed>false</onFailed>
+        <onUnstable>false</onUnstable>
+        <onNotBuilt>false</onNotBuilt>
+      </skipVote>
+      <silentMode>false</silentMode>
+      <silentStartMode>false</silentStartMode>
+      <escapeQuotes>true</escapeQuotes>
+      <noNameAndEmailParameters>false</noNameAndEmailParameters>
+      <readableMessage>false</readableMessage>
+      <dependencyJobsNames/>
+      <notificationLevel/>
+      <dynamicTriggerConfiguration>False</dynamicTriggerConfiguration>
+      <triggerConfigURL/>
+      <allowTriggeringUnreviewedPatches>false</allowTriggeringUnreviewedPatches>
+      <triggerOnEvents>
+        <com.sonyericsson.hudson.plugins.gerrit.trigger.hudsontrigger.events.PluginCommentAddedContainsEvent>
+          <commentAddedCommentContains>build release$</commentAddedCommentContains>
+        </com.sonyericsson.hudson.plugins.gerrit.trigger.hudsontrigger.events.PluginCommentAddedContainsEvent>
+      </triggerOnEvents>
+      <buildStartMessage/>
+      <buildFailureMessage/>
+      <buildSuccessfulMessage/>
+      <buildUnstableMessage/>
+      <buildNotBuiltMessage/>
+      <buildUnsuccessfulFilepath/>
+      <customUrl/>
+      <serverName>test-server</serverName>
+    </com.sonyericsson.hudson.plugins.gerrit.trigger.hudsontrigger.GerritTrigger>
+  </triggers>
   <builders>
     <hudson.tasks.Shell>
       <command>mkdir -p $WORKSPACE/target/classes $WORKSPACE/jacoco/classes</command>
index 73aba06..d41076e 100644 (file)
@@ -138,6 +138,26 @@ For example '&lt;1.0.0' or '&gt;=1.0.0,&lt;2.0.0'.
       <hudson.plugins.git.extensions.impl.WipeWorkspace/>
     </extensions>
   </scm>
+  <triggers class="vector">
+    <org.jenkinsci.plugins.ghprb.GhprbTrigger>
+      <spec/>
+      <adminlist/>
+      <allowMembersOfWhitelistedOrgsAsAdmin>false</allowMembersOfWhitelistedOrgsAsAdmin>
+      <whitelist/>
+      <orgslist/>
+      <cron/>
+      <triggerPhrase>^build release$</triggerPhrase>
+      <onlyTriggerPhrase>true</onlyTriggerPhrase>
+      <useGitHubHooks>true</useGitHubHooks>
+      <permitAll>true</permitAll>
+      <autoCloseFailedPullRequests>false</autoCloseFailedPullRequests>
+      <extensions>
+        <org.jenkinsci.plugins.ghprb.extensions.status.GhprbSimpleStatus>
+          <commitStatusContext>Maven Release</commitStatusContext>
+        </org.jenkinsci.plugins.ghprb.extensions.status.GhprbSimpleStatus>
+      </extensions>
+    </org.jenkinsci.plugins.ghprb.GhprbTrigger>
+  </triggers>
   <builders>
     <hudson.tasks.Shell>
       <command>mkdir -p $WORKSPACE/target/classes $WORKSPACE/jacoco/classes</command>
index b503887..1a689b3 100644 (file)
     #     staging-profile-id: Profile ID of the project's Nexus staging profile.
     #
     # Optional parameters:
-    #     mvn-global-settings: The name of the Maven global settings to use for
-    #                          Maven configuration. (default: global-settings)
+    #     :gerrit_verify_triggers: Override Gerrit Triggers.
+    #     :mvn-global-settings: The name of the Maven global settings to use for
+    #                           Maven configuration. (default: global-settings)
 
     ######################
     # Default parameters #
     stream: master
     submodule-recursive: true
 
+    gerrit_release_triggers:
+      - comment-added-contains-event:
+          comment-contains-value: build release$
+
     #####################
     # Job Configuration #
     #####################
           submodule-recursive: '{submodule-recursive}'
           choosing-strategy: default
 
+    triggers:
+      - gerrit:
+          server-name: '{gerrit-server-name}'
+          trigger-on: '{obj:gerrit_release_triggers}'
+          projects:
+            - project-compare-type: ANT
+              project-pattern: '{project}'
+              branches:
+                - branch-compare-type: ANT
+                  branch-pattern: '**/{branch}'
+
 - job-template:
     name: '{project-name}-maven-release-{stream}'
     id: github-maven-release
           choosing-strategy: default
           jenkins-ssh-credential: '{jenkins-ssh-credential}'
 
+    triggers:
+      - lf-infra-github-pr-trigger:
+          trigger-phrase: '^build release$'
+          only-trigger-phrase: true
+          status-context: 'Maven Release'
+          permit-all: true
+          github-hooks: true
+          github-org: ''
+          github_pr_whitelist:
+            - ''
+          github_pr_admin_list:
+            - ''
+
 ###############
 # Maven Sonar #
 ###############