You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hbase.apache.org by bu...@apache.org on 2018/04/13 05:18:03 UTC

[3/3] hbase git commit: HBASE-20388 nightly tests running on a feature branch should only comment on that feature branch's jira

HBASE-20388 nightly tests running on a feature branch should only comment on that feature branch's jira


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

Branch: refs/heads/HBASE-20388
Commit: 0deb8cd8a8c7545486e0808f1be71baa98fd9c04
Parents: d59a6c8
Author: Sean Busbey <bu...@apache.org>
Authored: Thu Apr 12 21:10:53 2018 -0500
Committer: Sean Busbey <bu...@apache.org>
Committed: Fri Apr 13 00:17:09 2018 -0500

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


http://git-wip-us.apache.org/repos/asf/hbase/blob/0deb8cd8/dev-support/Jenkinsfile
----------------------------------------------------------------------
diff --git a/dev-support/Jenkinsfile b/dev-support/Jenkinsfile
index 3f3066b..4e249ce 100644
--- a/dev-support/Jenkinsfile
+++ b/dev-support/Jenkinsfile
@@ -497,8 +497,14 @@ curl -L  -o personality.sh "${env.PROJECT_PERSONALITY}"
            echo "[INFO] Comment:"
            echo comment
            echo ""
-           echo "[INFO] There are ${currentBuild.changeSets.size()} change sets."
-           getJirasToComment(currentBuild).each { currentIssue ->
+           echo "[DEBUG] checking to see if feature branch"
+           def jiras = getJirasToComment(env.BRANCH_NAME, [])
+           if (jiras.isEmpty()) {
+             echo "[DEBUG] non-feature branch, checking change messages for jira keys."
+             echo "[INFO] There are ${currentBuild.changeSets.size()} change sets."
+             jiras = getJirasToCommentFromChangesets(currentBuild)
+           }
+           jiras.each { currentIssue ->
              jiraComment issueKey: currentIssue, body: comment
            }
         } catch (Exception exception) {
@@ -511,7 +517,7 @@ curl -L  -o personality.sh "${env.PROJECT_PERSONALITY}"
 }
 import org.jenkinsci.plugins.workflow.support.steps.build.RunWrapper
 @NonCPS
-List<String> getJirasToComment(RunWrapper thisBuild) {
+List<String> getJirasToCommentFromChangesets(RunWrapper thisBuild) {
   def seenJiras = []
   thisBuild.changeSets.each { cs ->
     cs.getItems().each { change ->
@@ -521,16 +527,21 @@ List<String> getJirasToComment(RunWrapper thisBuild) {
       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
-        }
-      }
+      seenJiras = getJirasToComment(msg, seenJiras)
     }
   }
   return seenJiras
 }
+@NonCPS
+List<String> getJirasToComment(CharSequence source, CharSequence[] seen) {
+  source.eachMatch("HBASE-[0-9]+") { currentIssue ->
+    echo "[DEBUG] found jira key: ${currentIssue}"
+    if (currentIssue in seen) {
+      echo "[DEBUG] already commented on ${currentIssue}."
+    } else {
+      echo "[INFO] commenting on ${currentIssue}."
+      seen << currentIssue
+    }
+  }
+  return seen
+}