catch if not using gerrit triggers 21/5721/1
authorMike Marchetti <mmarchetti@sandvine.com>
Wed, 22 Nov 2017 21:34:20 +0000 (16:34 -0500)
committerMike Marchetti <mmarchetti@sandvine.com>
Wed, 22 Nov 2017 21:34:20 +0000 (16:34 -0500)
Signed-off-by: Mike Marchetti <mmarchetti@sandvine.com>
jenkins/ci-pipelines/ci_stage_1.groovy

index 251d36e..d74de59 100644 (file)
@@ -36,18 +36,24 @@ node("${params.NODE}") {
     }
 
     stage('downstream') {
-        // initially use stage_name as the event_type
-        def stage_name = GERRIT_EVENT_TYPE
+        // default to stage_2 (patchset)
+        def stage_name = "stage_2"
 
-        switch(GERRIT_EVENT_TYPE) {
-            case "change-merged":
-               stage_name = "stage_2-merge"
-               break
+        try {
+            switch(GERRIT_EVENT_TYPE) {
+                case "change-merged":
+                   stage_name = "stage_2-merge"
+                   break
 
-            case "patchset-created":
-               stage_name = "stage_2"
-               break
+                case "patchset-created":
+                   stage_name = "stage_2"
+                   break
+            }
+        }
+        catch(caughtError) {
+            println("No gerrit event found")
         }
+
         do_stage_4 = false
         if (params.DO_STAGE_4)
         {