Add Gerrit Trigger for multipatch build 22/65322/5
authorThanh Ha <thanh.ha@linuxfoundation.org>
Wed, 8 Nov 2017 16:14:10 +0000 (11:14 -0500)
committerThanh Ha <thanh.ha@linuxfoundation.org>
Wed, 8 Nov 2017 17:25:43 +0000 (12:25 -0500)
Introduces a new trigger "multipatch-build:" which can be used to
trigger a build from a Gerrit comment rather than requiring committers
to have Jenkins access. Patch parameters are passed through a 1 liner
after the colon of the trigger.

Change-Id: I4c269d3db11a80d981209ef9b1b4ff428f1b7741
Signed-off-by: Thanh Ha <thanh.ha@linuxfoundation.org>
jjb/integration/integration-test-jobs.yaml
jjb/integration/multipatch-distribution.sh

index cca3d2bee69a887ff98f87245f8aff872aa62efe..17a814f5203e5a0ba4a58bd46aedc47e0d1c31f9 100644 (file)
       - opendaylight-infra-wrappers:
           build-timeout: '1200'
 
+    triggers:
+      - gerrit:
+          server-name: '{gerrit-server-name}'
+          trigger-on:
+            - comment-added-contains-event:
+                comment-contains-value: 'multipatch-build:'
+          projects:
+            - project-compare-type: ANT
+              project-pattern: '**'
+              branches:
+                - branch-compare-type: ANT
+                  branch-pattern: '**/{branch}'
+
     builders:
       - wipe-org-opendaylight-repo
       - integration-multipatch-builder
index fde2a3dde4138f26bb04a33302c9c6a78d58738c..ea9e96b037df11cc2d050f20b864b76adadf276f 100644 (file)
@@ -30,7 +30,12 @@ export EMAIL="sandbox@jenkins.opendaylight.org"
 export GIT_COMMITTER_NAME="Multipatch Job"
 
 # TODO: Is "patches" still the correct word?
-IFS=',' read -ra PATCHES <<< "${PATCHES_TO_BUILD}"
+if [ -n "$GERRIT_EVENT_COMMENT_TEXT" ]; then
+    PATCHES=($(echo "$GERRIT_EVENT_COMMENT_TEXT" \
+        | grep 'multipatch-build:' | awk -F: '{print $2}'))
+else
+    IFS=',' read -ra PATCHES <<< "${PATCHES_TO_BUILD}"
+fi
 
 # For each patch:
 # * Clone the project.