You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ignite.apache.org by GitBox <gi...@apache.org> on 2018/09/25 13:21:25 UTC

[GitHub] asfgit closed pull request #16: IGNITE-9668 Comment JIRA from pr.html

asfgit closed pull request #16: IGNITE-9668 Comment JIRA from pr.html
URL: https://github.com/apache/ignite-teamcity-bot/pull/16
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git a/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/TcHelper.java b/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/TcHelper.java
index e1b709e..0adf3fb 100644
--- a/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/TcHelper.java
+++ b/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/TcHelper.java
@@ -189,10 +189,7 @@ private BranchesTracked getTrackedBranches() {
                 return false;
             }
 
-            if ("finished".equals(build.state))
-                return teamcity.sendJiraComment(ticket, comment);
-
-            return false;
+            return teamcity.sendJiraComment(ticket, comment);
         }
     }
 
diff --git a/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/web/rest/TriggerBuild.java b/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/web/rest/TriggerBuild.java
index f5619ef..a4c66e6 100644
--- a/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/web/rest/TriggerBuild.java
+++ b/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/web/rest/TriggerBuild.java
@@ -98,7 +98,6 @@ public SimpleResult commentJira(
 
     @NotNull
     public SimpleResult commentJiraEx(@QueryParam("serverId") @Nullable String srvId, @QueryParam("branchName") @Nullable String branchForTc, @QueryParam("suiteId") @Nullable String suiteId, @QueryParam("ticketId") @Nullable String ticketId) {
-        System.out.println("commentJira ");
         final ICredentialsProv prov = ICredentialsProv.get(req);
 
         if (!prov.hasAccess(srvId))
diff --git a/ignite-tc-helper-web/src/main/webapp/js/testfails-2.1.js b/ignite-tc-helper-web/src/main/webapp/js/testfails-2.1.js
index 67d5c18..7974fca 100644
--- a/ignite-tc-helper-web/src/main/webapp/js/testfails-2.1.js
+++ b/ignite-tc-helper-web/src/main/webapp/js/testfails-2.1.js
@@ -35,6 +35,10 @@ class Settings {
     isGithubAvailable() {
         return this.javaFlags & 2
     };
+
+    isJiraAvailable() {
+        return this.javaFlags & 4
+    };
 }
 
 //@param results - TestFailuresSummary
@@ -159,13 +163,22 @@ function showChainCurrentStatusData(server, settings) {
     }
 
     res += "</td><td>";
-    if (settings.isGithubAvailable()) {
-        g_srv_to_notify_git = server;
-        res += "<button onclick='notifyGit()'>Update PR status</button>";
+
+    // if (settings.isGithubAvailable()) {
+    //     g_srv_to_notify_git = server;
+    //     res += "<button onclick='notifyGit()'>Update PR status</button>";
+    // }
+
+    if (settings.isJiraAvailable()) {
+        res += "<button onclick='commentJira(\"" + server.serverId + "\", \"IgniteTests24Java8_RunAll\", \""
+            + server.branchName + "\")'>Comment JIRA</button>";
     }
 
     if (isDefinedAndFilled(server.baseBranchForTc)) {
-        if (settings.isGithubAvailable())
+        // if (settings.isGithubAvailable())
+        //     res+="<br>";
+
+        if (settings.isJiraAvailable())
             res+="<br>";
 
         res += "Base branch";
@@ -409,19 +422,43 @@ function commentJira(serverId, suiteId, branchName, ticketId) {
             "branchName": branchName,
             "ticketId": ticketId
         },
-        success: function(result) {$("#notifyJira").html("");
+        success: function(result) {
+            $("#notifyJira").html("");
+
+            var needTicketId = result.result.lastIndexOf("enter ticket id") !== -1;
+
+            if (needTicketId) {
+                var buttons = {
+                    "Retry": function () {
+                        $(this).dialog("close");
+
+                        ticketId = $("#enterTicketId").val();
+
+                        commentJira(serverId, suiteId, branchName, ticketId)
+                    },
+                    "Cancel": function () {
+                        $(this).dialog("close");
+                    }
+                }
+            }
+            else {
+                buttons = {
+                    "Ok": function () {
+                        $(this).dialog("close");
+                    }
+                }
+            }
+
             var dialog = $("#triggerDialog");
 
             dialog.html("Trigger builds at server: " + serverId + "<br>" +
-                " Suite: " + suiteId + "<br>Branch:" + branchName + "<br>Top: " +
-                "<br><br> Result: " + result.result);
+                " Suite: " + suiteId + "<br>Branch:" + branchName +
+                "<br><br> Result: " + result.result +
+                (needTicketId ? ("<br><br>Enter JIRA ticket number: <input type='text' id='enterTicketId'>") : ""));
+
             dialog.dialog({
                 modal: true,
-                buttons: {
-                    "Ok": function() {
-                        $(this).dialog("close");
-                    }
-                }
+                buttons: buttons
             });
 
             loadData(); // should be defined by page


 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services