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: Master Trends - suites from different servers (#123)
Date Wed, 08 May 2019 13:46:38 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 9a8ee82  Master Trends - suites from different servers (#123)
9a8ee82 is described below

commit 9a8ee82699435018985810975288eb64f96be461
Author: Dmitriy Pavlov <dpavlov@apache.org>
AuthorDate: Wed May 8 16:46:33 2019 +0300

    Master Trends - suites from different servers (#123)
    
    * Selection of service
---
 .../ignite/ci/web/model/hist/BuildsHistory.java    | 22 ++++++++++-----
 .../ignite/ci/web/rest/GetTrackedBranches.java     |  2 +-
 .../ci/web/rest/build/GetBuildTestFailures.java    |  3 +-
 .../src/main/webapp/comparison.html                | 33 ++++++++++++++++------
 4 files changed, 43 insertions(+), 17 deletions(-)

diff --git a/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/web/model/hist/BuildsHistory.java
b/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/web/model/hist/BuildsHistory.java
index 3534f8d..f1b154e 100644
--- a/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/web/model/hist/BuildsHistory.java
+++ b/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/web/model/hist/BuildsHistory.java
@@ -36,6 +36,9 @@ import java.util.concurrent.ConcurrentHashMap;
 import java.util.concurrent.ExecutionException;
 import java.util.concurrent.Future;
 import java.util.stream.Collectors;
+
+import org.apache.ignite.ci.ITeamcity;
+import org.apache.ignite.ci.tcbot.conf.ITcBotConfig;
 import org.apache.ignite.ci.tcbot.trends.MasterTrendsService;
 import org.apache.ignite.ci.teamcity.ignited.BuildRefCompacted;
 import org.apache.ignite.ci.teamcity.ignited.IStringCompactor;
@@ -52,12 +55,12 @@ import static com.google.common.base.Strings.isNullOrEmpty;
  * Presents statistic for all valid builds and merged failed unmuted tests in specified time
interval. Statistics and
  * tests are stored in {@link #buildsStatistics} and {@link #mergedTestsBySuites} properties
respectively. Builder
  * pattern is used for instance creation. Default values: <br>skipTests = false,<br>projectId="IgniteTests24Java8",
- * <br>srvId="apache", <br>buildTypeId="IgniteTests24Java8_RunAll",
+ * <br>srvCode="apache", <br>buildTypeId="IgniteTests24Java8_RunAll",
  * <br>branchName="refs/heads/master".
  */
 public class BuildsHistory {
     /** */
-    private String srvId;
+    private String srvCode;
 
     /** */
     public String projectId;
@@ -101,7 +104,7 @@ public class BuildsHistory {
      * @param prov Credentials.
      */
     public void initialize(ICredentialsProv prov) {
-        ITeamcityIgnited ignitedTeamcity = tcIgnitedProv.server(srvId, prov);
+        ITeamcityIgnited ignitedTeamcity = tcIgnitedProv.server(srvCode, prov);
 
         tcHost = ignitedTeamcity.host();
 
@@ -212,7 +215,7 @@ public class BuildsHistory {
 
     private BuildsHistory withParameters(Builder builder) {
         this.skipTests = builder.skipTests;
-        this.srvId = builder.srvId;
+        this.srvCode = builder.srvCode;
         this.buildTypeId = builder.buildTypeId;
         this.branchName = builder.branchName;
         this.sinceDateFilter = builder.sinceDate;
@@ -230,13 +233,13 @@ public class BuildsHistory {
         private String projectId = "IgniteTests24Java8";
 
         /** */
-        private String srvId = "apache";
+        private String srvCode;
 
         /** */
         private String buildTypeId = "IgniteTests24Java8_RunAll";
 
         /** */
-        private String branchName = "refs/heads/master";
+        private String branchName = ITeamcity.DEFAULT;
 
         /** */
         private Date sinceDate = null;
@@ -247,12 +250,17 @@ public class BuildsHistory {
         /** */
         private DateFormat dateFormat = new SimpleDateFormat("ddMMyyyyHHmmss");
 
+        public Builder(ITcBotConfig cfg) {
+            srvCode = cfg.primaryServerCode();
+            // todo may find findDefaultBuildType() from cfg.getTeamcityConfig(srvCode).defaultTrackedBranch()
+        }
+
         /**
          * @param srvId server name.
          */
         public Builder server(String srvId) {
             if (!isNullOrEmpty(srvId))
-                this.srvId = srvId;
+                this.srvCode = srvId;
 
             return this;
         }
diff --git a/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/web/rest/GetTrackedBranches.java
b/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/web/rest/GetTrackedBranches.java
index ed366db..3611068 100644
--- a/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/web/rest/GetTrackedBranches.java
+++ b/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/web/rest/GetTrackedBranches.java
@@ -103,7 +103,7 @@ public class GetTrackedBranches {
     }
 
     /**
-     * Return all servers registered in TC Bot config: Both from tracked branches and from
+     * Return all accessible servers registered in TC Bot config: Both from tracked branches
and from
      */
     @GET
     @Path("getServerIds")
diff --git a/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/web/rest/build/GetBuildTestFailures.java
b/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/web/rest/build/GetBuildTestFailures.java
index 3ed0179..ca4f259 100644
--- a/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/web/rest/build/GetBuildTestFailures.java
+++ b/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/web/rest/build/GetBuildTestFailures.java
@@ -213,8 +213,9 @@ public class GetBuildTestFailures {
         @Nullable @QueryParam("skipTests") String skipTests)  throws ParseException {
 
         Injector injector = CtxListener.getInjector(ctx);
+        final ITcBotConfig cfg = injector.getInstance(ITcBotConfig.class);
 
-        BuildsHistory.Builder builder = new BuildsHistory.Builder()
+        BuildsHistory.Builder builder = new BuildsHistory.Builder(cfg)
             .branch(branch)
             .server(srvCode)
             .buildType(buildType)
diff --git a/ignite-tc-helper-web/src/main/webapp/comparison.html b/ignite-tc-helper-web/src/main/webapp/comparison.html
index d2a008f..51da05c 100644
--- a/ignite-tc-helper-web/src/main/webapp/comparison.html
+++ b/ignite-tc-helper-web/src/main/webapp/comparison.html
@@ -188,6 +188,9 @@
         testsTrigger = false,
         error = $('#loadStatus');
 
+    /** Key-value map. Key - Full suite text. Value - {@link org.apache.ignite.ci.tcbot.conf.ChainAtServer}
object. */
+    var suiteFullNameToChain = new Map();
+
     function refreshTests() {
         printTests(generateTestsResultsComparison(mergedTestsResults));
     }
@@ -557,8 +560,8 @@
 
     function loadTrackedSuites() {
         $.ajax({
-            url: "rest/branches/suites?server=apache",
-            success: function(result) {
+            url: "rest/branches/suites",
+            success: function (result) {
                 if (!isDefinedAndFilled(result)) {
                     error.html("Result from " + this.url + " is undefined!");
 
@@ -573,11 +576,20 @@
         });
     }
 
+    /**
+     *
+     * @param result list of {@link org.apache.ignite.ci.tcbot.conf.ChainAtServer} objects
as JSON.
+     */
     function printSuites(result) {
         let selectHtml = "<select id='selectSuite'>";
 
-        for (let i = 0; i < result.length; i++)
-            selectHtml += getHtmlOption(result[i].suiteId, false, false, result[i].suiteId);
+        for (let i = 0; i < result.length; i++) {
+            let suite = result[i];
+            let text = suite.suiteId + " (" + suite.serverId + ")";
+
+            suiteFullNameToChain.set(text, suite);
+            selectHtml += getHtmlOption(text, false, false, text);
+        }
 
         selectHtml += "</select>";
 
@@ -589,18 +601,23 @@
     function loadData(num, sinceDate, untilDate, testsTrigger) {
         loadGif(num);
 
-        let suiteId = $('#selectSuite').val();
+        let suiteIdFull = $('#selectSuite').val();
+
 
         mergedTestsResults[num] = {};
 
-        if ((!isDefinedAndFilled(suiteId)) || (suiteId === "")) {
+        if ((!isDefinedAndFilled(suiteIdFull)) || (suiteIdFull === "")) {
             error.html("Suite is " + (isDefinedAndFilled(suiteId) ? "empty" : "undefined")
+ "!");
 
             return;
         }
 
-        let url = 'rest/build/history?server=apache&buildType=' + suiteId + '&sinceDate='
+
-            sinceDate.format("DDMMYYYY") + '000001&untilDate=' + untilDate.format("DDMMYYYY")
+ '235959';
+        let chainAtServer = suiteFullNameToChain.get(suiteIdFull);
+
+        let url = 'rest/build/history?server=' + chainAtServer.serverId
+            + '&buildType=' + chainAtServer.suiteId
+            + '&sinceDate=' + sinceDate.format("DDMMYYYY") + '000001'
+            + '&untilDate=' + untilDate.format("DDMMYYYY") + '235959';
 
         if (!testsTrigger)
             url = url + '&' + SKIP_TESTS;


Mime
View raw message