Repository: hbase
Updated Branches:
  refs/heads/HBASE-18467 2f542e8d4 -> 3577f7195


HBASE-18467 convert to non cps


Project: http://git-wip-us.apache.org/repos/asf/hbase/repo
Commit: http://git-wip-us.apache.org/repos/asf/hbase/commit/3577f719
Tree: http://git-wip-us.apache.org/repos/asf/hbase/tree/3577f719
Diff: http://git-wip-us.apache.org/repos/asf/hbase/diff/3577f719

Branch: refs/heads/HBASE-18467
Commit: 3577f71959d527452ab2dd7a2b40e54caa13f132
Parents: 2f542e8
Author: Sean Busbey <bus...@apache.org>
Authored: Wed Sep 13 23:22:15 2017 -0500
Committer: Sean Busbey <bus...@apache.org>
Committed: Wed Sep 13 23:22:15 2017 -0500

----------------------------------------------------------------------
 dev-support/Jenkinsfile | 50 ++++++++++++++++++++++++--------------------
 1 file changed, 27 insertions(+), 23 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hbase/blob/3577f719/dev-support/Jenkinsfile
----------------------------------------------------------------------
diff --git a/dev-support/Jenkinsfile b/dev-support/Jenkinsfile
index 8b61e7d..ce81d60 100644
--- a/dev-support/Jenkinsfile
+++ b/dev-support/Jenkinsfile
@@ -393,29 +393,8 @@ END
            echo comment
            echo ""
            echo "[INFO] There are ${currentBuild.changeSets.size()} change 
sets."
-           def seenJiras = []
-           for (int i = 0; i < currentBuild.changeSets.size(); i++) {
-             def changes = currentBuild.changeSets.get(i).getItems()
-             for (int j = 0; j < changes.length; j++) {
-               def change = changes[j]
-               CharSequence msg = change.msg
-               echo "[DEBUG] msg is of class ${msg.class}"
-               echo "change: ${change}"
-               echo "     ${msg}"
-               echo "  ${change.commitId}"
-               echo "     ${change.author}"
-               echo ""
-               msg.eachMatch("HBASE-[0-9]+") { currentIssue ->
-                 echo "[DEBUG] found jira key: ${currentIssue}"
-                 if ( currentIssue in seenJiras ) {
-                   echo "[DEBUG] already commented on ${currentIssue}."
-                 } else {
-                   echo "[INFO] commenting on ${currentIssue}."
-                   jiraComment issueKey: currentIssue, body: comment
-                   seenJiras << currentIssue
-                 }
-               }
-             }
+           getJirasToComment(currentBuild).each { currentIssue ->
+             jiraComment issueKey: currentIssue, body: comment
            }
         } catch (Exception exception) {
           echo "Got exception: ${exception}"
@@ -425,3 +404,28 @@ END
     }
   }
 }
+import org.jenkinsci.plugins.workflow.support.steps.build.RunWrapper
+@NonCPS
+List<String> getJirasToComment(RunWrapper thisBuild) {
+  def seenJiras = []
+  thisBuild.changeSets.each { cs ->
+    cs.getItems().each { change ->
+      CharSequence msg = change.msg
+      echo "change: ${change}"
+      echo "     ${msg}"
+      echo "     ${change.commitId}"
+      echo "     ${change.author}"
+      echo ""
+      msg.eachMatch("HBASE-[0-9]+") { currentIssue ->
+        echo "[DEBUG] found jira key: ${currentIssue}"
+        if (currentIssue in seenJiras) {
+          echo "[DEBUG] already commented on ${currentIssue}."
+        } else {
+          echo "[INFO] commenting on ${currentIssue}."
+          seenJiras << currentIssue
+        }
+      }
+    }
+  }
+  return seenJiras
+}

Reply via email to