ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dpav...@apache.org
Subject [ignite-teamcity-bot] branch master updated: IGNITE-9377 Trigger build fix - Fixes #8.
Date Thu, 13 Sep 2018 13:10:05 GMT
This is an automated email from the ASF dual-hosted git repository.

dpavlov pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/ignite-teamcity-bot.git


The following commit(s) were added to refs/heads/master by this push:
     new 18c66bc  IGNITE-9377 Trigger build fix - Fixes #8.
18c66bc is described below

commit 18c66bcb895003f107b551b290ec3e2888094ff0
Author: Dmitrii Ryabov <SomeFireOne@gmail.com>
AuthorDate: Thu Sep 13 16:09:55 2018 +0300

    IGNITE-9377 Trigger build fix - Fixes #8.
    
    Signed-off-by: Dmitriy Pavlov <dpavlov@apache.org>
---
 .../java/org/apache/ignite/ci/util/HttpUtil.java   |  4 +-
 .../org/apache/ignite/ci/web/model/Version.java    |  2 +-
 .../apache/ignite/ci/web/rest/TriggerBuild.java    | 44 ++++++++++++----------
 ignite-tc-helper-web/src/main/webapp/index.html    |  2 +-
 4 files changed, 30 insertions(+), 22 deletions(-)

diff --git a/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/util/HttpUtil.java b/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/util/HttpUtil.java
index 1184869..4730606 100644
--- a/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/util/HttpUtil.java
+++ b/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/util/HttpUtil.java
@@ -93,8 +93,10 @@ public class HttpUtil {
         URL obj = new URL(url);
         HttpURLConnection con = (HttpURLConnection)obj.openConnection();
 
+        if (githubAuthTok != null)
+            con.setRequestProperty("Authorization", "token " + githubAuthTok);
+
         con.setRequestProperty("accept-charset", StandardCharsets.UTF_8.toString());
-        con.setRequestProperty("Authorization", "token " + githubAuthTok);
         con.setRequestProperty("Connection", "Keep-Alive");
         con.setRequestProperty("Keep-Alive", "header");
 
diff --git a/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/web/model/Version.java
b/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/web/model/Version.java
index 81587c0..873c06e 100644
--- a/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/web/model/Version.java
+++ b/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/web/model/Version.java
@@ -22,7 +22,7 @@ package org.apache.ignite.ci.web.model;
     public static final String DEFAULT_CONTACT = "dev@ignite.apache.org";
 
     /** TC Helper Version. */
-    public String version = "20180912";
+    public String version = "20180913";
 
     /** Ignite version. */
     public String ignVer;
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 2148a35..9269cbe 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
@@ -32,6 +32,7 @@ import org.apache.ignite.ci.ITeamcity;
 import org.apache.ignite.ci.github.PullRequest;
 import org.apache.ignite.ci.tcmodel.result.Build;
 import org.apache.ignite.ci.user.ICredentialsProv;
+import org.apache.ignite.ci.util.XmlUtil;
 import org.apache.ignite.ci.web.CtxListener;
 import org.apache.ignite.ci.web.rest.login.ServiceUnauthorizedException;
 import org.apache.ignite.ci.web.model.SimpleResult;
@@ -56,6 +57,7 @@ public class TriggerBuild {
         @Nullable @QueryParam("top") Boolean top,
         @Nullable @QueryParam("observe") Boolean observe
     ) {
+        String errors = "";
         final ICredentialsProv prov = ICredentialsProv.get(req);
 
         if (!prov.hasAccess(srvId))
@@ -64,33 +66,37 @@ public class TriggerBuild {
         ITcHelper helper = CtxListener.getTcHelper(context);
 
         try (final ITeamcity teamcity = helper.server(srvId, prov)) {
-            PullRequest pr = teamcity.getPullRequest(branchName);
-
-            String ticketId = "";
+            Build build = teamcity.triggerBuild(suiteId, branchName, false, top != null &&
top);
 
-            if (pr.getTitle().startsWith("IGNITE-")) {
-                int beginIdx = 7;
-                int endIdx = 7;
+            if (observe != null && observe) {
+                PullRequest pr = teamcity.getPullRequest(branchName);
 
-                while (endIdx < pr.getTitle().length() && Character.isDigit(pr.getTitle().charAt(endIdx)))
-                    endIdx++;
+                String ticketId = "";
 
-                ticketId = pr.getTitle().substring(beginIdx, endIdx);
-            }
+                if (pr.getTitle().startsWith("IGNITE-")) {
+                    int beginIdx = 7;
+                    int endIdx = 7;
 
-            if (ticketId.equals(""))
-                return new SimpleResult("PR title \"" + pr.getTitle() + "\" should starts
with \"IGNITE-XXXX\"." +
-                    " Please, rename PR according to the" +
-                    " <a href='https://cwiki.apache.org/confluence/display/IGNITE/How+to+Contribute"
+
-                    "#HowtoContribute-1.CreateGitHubpull-request'>contributing guide</a>.");
+                    while (endIdx < pr.getTitle().length() && Character.isDigit(pr.getTitle().charAt(endIdx)))
+                        endIdx++;
 
-            Build build = teamcity.triggerBuild(suiteId, branchName, false, top != null &&
top);
+                    ticketId = pr.getTitle().substring(beginIdx, endIdx);
+                }
 
-            if (observe != null && observe)
-                helper.buildObserver().observe(build, srvId, prov, "ignite-" + ticketId);
+                if (!ticketId.equals(""))
+                    helper.buildObserver().observe(build, srvId, prov, "ignite-" + ticketId);
+                else {
+                    errors += "<br>" +
+                        "JIRA ticket will not be notified after the tests are completed -
" +
+                        "PR title \"" + pr.getTitle() + "\" should starts with \"IGNITE-XXXX\"."
+
+                        " Please, rename PR according to the" +
+                        " <a href='https://cwiki.apache.org/confluence/display/IGNITE/How+to+Contribute"
+
+                        "#HowtoContribute-1.CreateGitHubpull-request'>contributing guide</a>.";
+                }
+            }
         }
 
-        return new SimpleResult("OK");
+        return new SimpleResult("Tests started." + errors);
     }
 
     @GET
diff --git a/ignite-tc-helper-web/src/main/webapp/index.html b/ignite-tc-helper-web/src/main/webapp/index.html
index fc8020b..97cfebd 100644
--- a/ignite-tc-helper-web/src/main/webapp/index.html
+++ b/ignite-tc-helper-web/src/main/webapp/index.html
@@ -157,7 +157,7 @@ function trigBuild(event) {
     $.ajax({
         url: url,
         success: function(result) {
-            $("#runAll").html("Run All test build was started for PR #" + prId);
+            $("#runAll").html(result.result);
         },
         error: showErrInLoadStatus
     });


Mime
View raw message