[ 
https://issues.apache.org/jira/browse/IGNITE-10203?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16712771#comment-16712771
 ] 

ASF GitHub Bot commented on IGNITE-10203:
-----------------------------------------

asfgit closed pull request #90: IGNITE-10203 Fix TC Bot visa on Jira
URL: https://github.com/apache/ignite-teamcity-bot/pull/90
 
 
   

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 eb66f302..3ec28401 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
@@ -208,7 +208,8 @@ private BranchesTracked getTrackedBranches() {
      * @param webUrl Build URL.
      * @return Comment, which should be sent to the JIRA ticket.
      */
-    private String generateJiraComment(List<SuiteCurrentStatus> suites, String 
webUrl, String buildTypeId, ITeamcityIgnited tcIgnited) {
+    private String generateJiraComment(List<SuiteCurrentStatus> suites, String 
webUrl, String buildTypeId,
+        ITeamcityIgnited tcIgnited) {
         BuildTypeRefCompacted bt = tcIgnited.getBuildTypeRef(buildTypeId);
 
         String suiteName = (bt != null ? bt.name(compactor) : buildTypeId);
diff --git 
a/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/observer/BuildObserver.java
 
b/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/observer/BuildObserver.java
index 98287d2e..bee40967 100644
--- 
a/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/observer/BuildObserver.java
+++ 
b/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/observer/BuildObserver.java
@@ -85,8 +85,9 @@ public boolean stopObservation(ContributionKey key) {
      * @param branchForTc Branch for TC.
      * @param ticket JIRA ticket name.
      */
-    public void observe(String srvId, ICredentialsProv prov, String ticket, 
String branchForTc, Build... builds) {
-        BuildsInfo buildsInfo = new BuildsInfo(srvId, prov, ticket, 
branchForTc, builds);
+    public void observe(String srvId, ICredentialsProv prov, String ticket, 
String branchForTc, String parentSuiteId,
+        Build... builds) {
+        BuildsInfo buildsInfo = new BuildsInfo(srvId, prov, ticket, 
branchForTc, parentSuiteId, builds);
 
         observerTask.addInfo(buildsInfo);
     }
diff --git 
a/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/observer/BuildsInfo.java
 
b/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/observer/BuildsInfo.java
index 40e33011..bfb70e76 100644
--- 
a/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/observer/BuildsInfo.java
+++ 
b/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/observer/BuildsInfo.java
@@ -17,6 +17,7 @@
 
 package org.apache.ignite.ci.observer;
 
+import com.google.common.base.Strings;
 import java.util.ArrayList;
 import java.util.Calendar;
 import java.util.Collections;
@@ -81,13 +82,15 @@ public BuildsInfo(CompactBuildsInfo compactBuildsInfo, 
IStringCompactor strCompa
      * @param ticket Ticket.
      * @param builds Builds.
      */
-    public BuildsInfo(String srvId, ICredentialsProv prov, String ticket, 
String branchForTc, Build... builds) {
+    public BuildsInfo(String srvId, ICredentialsProv prov, String ticket, 
String branchForTc, String parentSuiteId,
+        Build... builds) {
         this.userName = prov.getUser(srvId);
         this.date = Calendar.getInstance().getTime();
         this.srvId = srvId;
         this.ticket = ticket;
         this.branchForTc = branchForTc;
-        this.buildTypeId = builds.length == 1 ? builds[0].buildTypeId : 
"IgniteTests24Java8_RunAll";
+        this.buildTypeId = Strings.isNullOrEmpty(parentSuiteId) ?
+            (builds.length == 1 ? builds[0].buildTypeId : 
"IgniteTests24Java8_RunAll") : parentSuiteId;
 
         for (Build build : builds)
             this.builds.add(build.getId());
diff --git 
a/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/tcbot/visa/TcBotTriggerAndSignOffService.java
 
b/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/tcbot/visa/TcBotTriggerAndSignOffService.java
index bbec0a30..910079f9 100644
--- 
a/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/tcbot/visa/TcBotTriggerAndSignOffService.java
+++ 
b/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/tcbot/visa/TcBotTriggerAndSignOffService.java
@@ -32,8 +32,10 @@
 import javax.annotation.Nonnull;
 import javax.inject.Inject;
 import javax.ws.rs.QueryParam;
+import org.apache.ignite.ci.HelperConfig;
 import org.apache.ignite.ci.ITcHelper;
 import org.apache.ignite.ci.IAnalyticsEnabledTeamcity;
+import org.apache.ignite.ci.ITeamcity;
 import org.apache.ignite.ci.github.GitHubUser;
 import org.apache.ignite.ci.github.PullRequest;
 import org.apache.ignite.ci.github.ignited.IGitHubConnIgnitedProvider;
@@ -50,6 +52,7 @@
 import org.apache.ignite.ci.teamcity.ignited.ITeamcityIgnited;
 import org.apache.ignite.ci.teamcity.ignited.ITeamcityIgnitedProvider;
 import org.apache.ignite.ci.teamcity.ignited.SyncMode;
+import org.apache.ignite.ci.teamcity.ignited.buildtype.BuildTypeCompacted;
 import org.apache.ignite.ci.teamcity.ignited.buildtype.BuildTypeRefCompacted;
 import org.apache.ignite.ci.web.model.ContributionKey;
 import org.apache.ignite.ci.web.model.VisaRequest;
@@ -66,6 +69,7 @@
 import static org.apache.ignite.ci.observer.BuildsInfo.FINISHED_STATUS;
 import static org.apache.ignite.ci.observer.BuildsInfo.RUNNING_STATUS;
 import static 
org.apache.ignite.ci.teamcity.ignited.TeamcityIgnitedImpl.DEFAULT_PROJECT_ID;
+import static 
org.apache.ignite.ci.web.rest.parms.FullQueryParams.DEFAULT_TRACKED_BRANCH_NAME;
 
 /**
  * Provides method for TC Bot Visa obtaining
@@ -190,6 +194,7 @@ else if (RUNNING_STATUS.equals(buildsStatus))
     @NotNull public String triggerBuildsAndObserve(
         @Nullable String srvId,
         @Nullable String branchForTc,
+        @Nonnull String parentSuiteId,
         @Nonnull String suiteIdList,
         @Nullable Boolean top,
         @Nullable Boolean observe,
@@ -207,7 +212,7 @@ else if (RUNNING_STATUS.equals(buildsStatus))
             builds[i] = teamcity.triggerBuild(suiteIds[i], branchForTc, false, 
top != null && top);
 
         if (observe != null && observe)
-            jiraRes = observeJira(srvId, branchForTc, ticketId, prov, builds);
+            jiraRes = observeJira(srvId, branchForTc, ticketId, prov, 
parentSuiteId, builds);
 
         return jiraRes;
     }
@@ -225,6 +230,7 @@ private String observeJira(
         String branchForTc,
         @Nullable String ticketFullName,
         ICredentialsProv prov,
+        String parentSuiteId,
         Build... builds
     ) {
         if (F.isEmpty(ticketFullName)) {
@@ -253,7 +259,7 @@ private String observeJira(
             ticketFullName = 
ticketFullName.toUpperCase().startsWith("IGNITE-") ? ticketFullName : "IGNITE-" 
+ ticketFullName;
         }
 
-        buildObserverProvider.get().observe(srvId, prov, ticketFullName, 
branchForTc, builds);
+        buildObserverProvider.get().observe(srvId, prov, ticketFullName, 
branchForTc, parentSuiteId, builds);
 
         if (!tcHelper.isServerAuthorized())
             return "Ask server administrator to authorize the Bot to enable 
JIRA notifications.";
@@ -303,9 +309,7 @@ public SimpleResult commentJiraEx(
         }
 
         if (!Strings.isNullOrEmpty(ticketFullName)) {
-            BuildsInfo buildsInfo = new BuildsInfo(srvId, prov, 
ticketFullName, branchForTc);
-
-            buildsInfo.buildTypeId = suiteId;
+            BuildsInfo buildsInfo = new BuildsInfo(srvId, prov, 
ticketFullName, branchForTc, suiteId);
 
             VisaRequest lastVisaReq = 
visasHistoryStorage.getLastVisaRequest(buildsInfo.getContributionKey());
 
@@ -394,14 +398,25 @@ String branchForTcB(String prId) {
 
         ITeamcityIgnited teamcity = teamcityIgnitedProvider.server(srvId, 
prov);
 
-        List<String> compositeBuildTypes = teamcity
-            
.getCompositeBuildTypesIdsSortedByBuildNumberCounter(DEFAULT_PROJECT_ID);
+        StringBuilder buildTypeId = new StringBuilder();
+
+        HelperConfig.getTrackedBranches().get(DEFAULT_TRACKED_BRANCH_NAME)
+            .ifPresent(b -> b.getChainsStream().filter(c -> 
c.branchForRest.equals(ITeamcity.DEFAULT))
+            .findFirst().ifPresent(ch -> buildTypeId.append(ch.suiteId)));
+
+        BuildTypeCompacted buildType = buildTypeId.length() > 0 ? 
teamcity.getBuildType(buildTypeId.toString()) : null;
+
+        String projectId = Objects.nonNull(buildType) ?
+            compactor.getStringFromId(buildType.projectId()) : 
DEFAULT_PROJECT_ID;
+
+        List<String> compositeBuildTypeIds = teamcity
+            .getCompositeBuildTypesIdsSortedByBuildNumberCounter(projectId);
 
-        for (String buildType : compositeBuildTypes) {
-            List<BuildRefCompacted> forTests = findBuildsForPr(buildType, 
prId, teamcity);
+        for (String btId : compositeBuildTypeIds) {
+            List<BuildRefCompacted> forTests = findBuildsForPr(btId, prId, 
teamcity);
 
-            statuses.add(forTests.isEmpty() ? new 
ContributionCheckStatus(buildType, branchForTcA(prId)) :
-                contributionStatus(srvId, buildType, forTests, teamcity, 
prId));
+            statuses.add(forTests.isEmpty() ? new 
ContributionCheckStatus(btId, branchForTcA(prId)) :
+                contributionStatus(srvId, btId, forTests, teamcity, prId));
         }
 
         return statuses;
diff --git 
a/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/teamcity/ignited/buildtype/BuildTypeCompacted.java
 
b/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/teamcity/ignited/buildtype/BuildTypeCompacted.java
index 1802f01f..92e2d1f0 100644
--- 
a/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/teamcity/ignited/buildtype/BuildTypeCompacted.java
+++ 
b/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/teamcity/ignited/buildtype/BuildTypeCompacted.java
@@ -24,7 +24,6 @@
 import java.util.Objects;
 import org.apache.ignite.ci.analysis.IVersionedEntity;
 import org.apache.ignite.ci.db.Persisted;
-import org.apache.ignite.ci.tcmodel.conf.BuildType;
 import org.apache.ignite.ci.tcmodel.conf.bt.BuildTypeFull;
 import org.apache.ignite.ci.tcmodel.conf.bt.Parameters;
 import org.apache.ignite.ci.tcmodel.conf.bt.SnapshotDependencies;
@@ -87,16 +86,31 @@ public void buildNumberCounter(int buildNumberCounter) {
         this.buildNumberCounter = buildNumberCounter;
     }
 
+    /**
+     * @param compactor Compactor.
+     */
     public BuildTypeFull toBuildType(IStringCompactor compactor) {
+        return toBuildType(compactor, null);
+    }
+
+    /**
+     * @param compactor Compactor.
+     * @param host Normalized Host address, ends with '/'.
+     */
+    public BuildTypeFull toBuildType(IStringCompactor compactor, @Nullable 
String host) {
         BuildTypeFull res = new BuildTypeFull();
 
-        fillBuildTypeRefFields(compactor, res);
+        super.fillBuildTypeRefFields(compactor, res, host);
 
         fillBuildTypeFields(compactor, res);
 
         return res;
     }
 
+    /**
+     * @param compactor Compactor.
+     * @param res Response.
+     */
     protected void fillBuildTypeFields(IStringCompactor compactor, 
BuildTypeFull res) {
         res.setParameters(parameters == null ? new Parameters() : 
parameters.toParameters(compactor));
         res.setSettings(settings == null ? new Parameters() : 
settings.toParameters(compactor));
@@ -114,16 +128,6 @@ protected void fillBuildTypeFields(IStringCompactor 
compactor, BuildTypeFull res
         res.setSnapshotDependencies(new SnapshotDependencies(snDpList));
     }
 
-    protected void fillBuildTypeRefFields(IStringCompactor compactor, 
BuildType res) {
-        String id = id(compactor);
-        res.setId(id);
-        res.setName(compactor.getStringFromId(super.name()));
-        res.setProjectId(compactor.getStringFromId(super.projectId()));
-        res.setProjectName(compactor.getStringFromId(super.projectName()));
-        res.href = getHrefForId(id);
-        res.setWebUrl(getWebUrlForId(id));
-    }
-
     public ParametersCompacted settings() {
         return settings == null ? new ParametersCompacted() : settings;
     }
diff --git 
a/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/teamcity/ignited/buildtype/BuildTypeDao.java
 
b/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/teamcity/ignited/buildtype/BuildTypeDao.java
index 2a12d442..1772370a 100644
--- 
a/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/teamcity/ignited/buildtype/BuildTypeDao.java
+++ 
b/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/teamcity/ignited/buildtype/BuildTypeDao.java
@@ -19,7 +19,6 @@
 
 import com.google.common.base.Preconditions;
 import com.google.common.base.Strings;
-import java.util.Collections;
 import java.util.Comparator;
 import java.util.List;
 import java.util.stream.Collectors;
@@ -160,9 +159,7 @@ public BuildTypeCompacted getFatBuildType(int 
srvIdMaskHigh, @NotNull String bui
 
         Comparator<BuildTypeCompacted> comp = 
Comparator.comparingInt(BuildTypeCompacted::buildNumberCounter);
 
-        res.sort(comp);
-
-        Collections.reverse(res);
+        res.sort(comp.reversed());
 
         return res;
     }
diff --git 
a/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/teamcity/ignited/buildtype/BuildTypeRefCompacted.java
 
b/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/teamcity/ignited/buildtype/BuildTypeRefCompacted.java
index 185bddc2..05dbf824 100644
--- 
a/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/teamcity/ignited/buildtype/BuildTypeRefCompacted.java
+++ 
b/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/teamcity/ignited/buildtype/BuildTypeRefCompacted.java
@@ -23,6 +23,7 @@
 import org.apache.ignite.ci.tcmodel.conf.BuildType;
 import org.apache.ignite.ci.teamcity.ignited.IStringCompactor;
 import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
 
 @Persisted
 public class BuildTypeRefCompacted {
@@ -119,23 +120,38 @@ public BuildTypeRefCompacted(BuildTypeRefCompacted 
refCompacted) {
 
     /**
      * @param compactor Compacter.
+     * @param host Normalized Host address, ends with '/'.
      */
-    public BuildType toBuildTypeRef(IStringCompactor compactor) {
+    public BuildType toBuildTypeRef(IStringCompactor compactor, @Nullable 
String host) {
         BuildType res = new BuildType();
 
-        fillBuildTypeRefFields(compactor, res);
+        fillBuildTypeRefFields(compactor, res, host);
 
         return res;
     }
 
-    protected void fillBuildTypeRefFields(IStringCompactor compactor, 
BuildType res) {
+    /**
+     * @param compactor Compacter.
+     */
+    public BuildType toBuildTypeRef(IStringCompactor compactor) {
+        return toBuildTypeRef(compactor, null);
+    }
+
+    /**
+     * @param compactor Compactor.
+     * @param res Response.
+     * @param host Normalized Host address, ends with '/'.
+     */
+    protected void fillBuildTypeRefFields(IStringCompactor compactor, 
BuildType res, @Nullable String host) {
         String id = id(compactor);
         res.setId(id);
         res.setName(compactor.getStringFromId(name));
         res.setProjectId(compactor.getStringFromId(projectId));
         res.setProjectName(compactor.getStringFromId(projectName));
         res.href = getHrefForId(id);
-        res.setWebUrl(getWebUrlForId(id));
+
+        if (Objects.nonNull(host))
+            res.setWebUrl(getWebUrlForId(host, id));
     }
 
     /**
@@ -147,11 +163,12 @@ protected void fillBuildTypeRefFields(IStringCompactor 
compactor, BuildType res)
     }
 
     /**
+     * @param host Normalized Host address, ends with '/'.
      * @param buildTypeId BuildType id.
      * @return URL to BuildType on Teamcity.
      */
-    @NotNull protected static String getWebUrlForId(String buildTypeId) {
-        return "http://ci.ignite.apache.org/viewType.html?buildTypeId="; + 
buildTypeId;
+    @NotNull protected static String getWebUrlForId(String host, String 
buildTypeId) {
+        return host + "viewType.html?buildTypeId=" + buildTypeId;
     }
 
     /** {@inheritDoc} */
diff --git 
a/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/web/rest/TriggerBuilds.java
 
b/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/web/rest/TriggerBuilds.java
index 142885a4..f9837589 100644
--- 
a/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/web/rest/TriggerBuilds.java
+++ 
b/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/web/rest/TriggerBuilds.java
@@ -62,6 +62,7 @@
     public SimpleResult triggerBuilds(
         @Nullable @QueryParam("serverId") String srvId,
         @Nullable @QueryParam("branchName") String branchForTc,
+        @Nonnull @QueryParam("parentSuiteId") String parentSuiteId,
         @Nonnull @QueryParam("suiteIdList") String suiteIdList,
         @Nullable @QueryParam("top") Boolean top,
         @Nullable @QueryParam("observe") Boolean observe,
@@ -78,7 +79,7 @@ public SimpleResult triggerBuilds(
 
         String jiraRes = CtxListener.getInjector(ctx)
             .getInstance(TcBotTriggerAndSignOffService.class)
-            .triggerBuildsAndObserve(srvId, branchForTc, suiteIdList, top, 
observe, ticketId, prov);
+            .triggerBuildsAndObserve(srvId, branchForTc, parentSuiteId, 
suiteIdList, top, observe, ticketId, prov);
 
         return new SimpleResult("Tests started." + (!jiraRes.isEmpty() ? 
"<br>" + jiraRes : ""));
     }
diff --git a/ignite-tc-helper-web/src/main/webapp/js/common-1.6.js 
b/ignite-tc-helper-web/src/main/webapp/js/common-1.6.js
index 97149bee..b94f4df6 100644
--- a/ignite-tc-helper-web/src/main/webapp/js/common-1.6.js
+++ b/ignite-tc-helper-web/src/main/webapp/js/common-1.6.js
@@ -5,9 +5,23 @@ function isDefinedAndFilled(val) {
     return typeof val !== 'undefined' && val != null
 }
 
-function findGetParameter(parameterName) {
-    var result = null,
+/**
+ * Function return URL parameter from webUrl (if is defined and filled) or 
from current location of the document.
+ *
+ * @returns {string | null} Search parameter or null.
+ * @param {String} parameterName - Search parameter name.
+ * @param {String | null} webUrl - URL.
+ */
+function findGetParameter(parameterName, webUrl) {
+    if (isDefinedAndFilled(webUrl)) {
+        let url = new URL(webUrl);
+
+        return url.searchParams.get(parameterName);
+    }
+
+    let result = null,
         tmp = [];
+
     location.search
         .substr(1)
         .split("&")
@@ -15,6 +29,7 @@ function findGetParameter(parameterName) {
             tmp = item.split("=");
             if (tmp[0] === parameterName) result = decodeURIComponent(tmp[1]);
         });
+
     return result;
 }
 
diff --git a/ignite-tc-helper-web/src/main/webapp/js/prs-1.0.js 
b/ignite-tc-helper-web/src/main/webapp/js/prs-1.0.js
index 8833ba20..ada8a877 100644
--- a/ignite-tc-helper-web/src/main/webapp/js/prs-1.0.js
+++ b/ignite-tc-helper-web/src/main/webapp/js/prs-1.0.js
@@ -356,6 +356,13 @@ function repaintLater(srvId, suiteId) {
 
 function showContributionStatus(status, prId, row, srvId, suiteId) {
     let tdForPr = $('#showResultFor' + prId);
+
+    if (!isDefinedAndFilled(status)) {
+        console.log("Status for " + prId + " is undefined. Wait for the Bot to 
load the suite list.");
+
+        return;
+    }
+
     let buildIsCompleted = isDefinedAndFilled(status.branchWithFinishedSuite);
     let hasJiraIssue = isDefinedAndFilled(row.jiraIssueId);
     let hasQueued = status.queuedBuilds > 0 || status.runningBuilds > 0;
@@ -383,8 +390,8 @@ function showContributionStatus(status, prId, row, srvId, 
suiteId) {
             let jiraBtn = "<button onclick='" +
                 "commentJira(" +
                 "\"" + srvId + "\", " +
-                "\"" + suiteId + "\", " +
                 "\"" + finishedBranch + "\", " +
+                "\"" + suiteId + "\", " +
                 "\"" + row.jiraIssueId + "\"" +
                 "); " +
                 replaintCall +
@@ -433,6 +440,7 @@ function showContributionStatus(status, prId, row, srvId, 
suiteId) {
         // triggerBuilds(serverId, suiteIdList, branchName, top, observe, 
ticketId)  defined in test fails
         let triggerBuildsCall = "triggerBuilds(" +
             "\"" + srvId + "\", " +
+            "null, " +
             "\"" + suiteId + "\", " +
             "\"" + status.resolvedBranch + "\"," +
             " false," +
@@ -449,6 +457,7 @@ function showContributionStatus(status, prId, row, srvId, 
suiteId) {
         // triggerBuilds(serverId, suiteIdList, branchName, top, observe, 
ticketId)  defined in test fails
         let trigObserveCall = "triggerBuilds(" +
             "\"" + srvId + "\", " +
+            "null, " +
             "\"" + suiteId + "\", " +
             "\"" + status.resolvedBranch + "\"," +
             " false," +
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 10b01891..21c58902 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
@@ -108,18 +108,15 @@ function showChainCurrentStatusData(server, settings) {
         res += "</td></tr>";
     }
 
-    let suiteName;
+    let parentSuitId;
 
-    if (isDefinedAndFilled(findGetParameter("suiteId"))) {
-        suiteName = findGetParameter("suiteId");
-    } else if (isDefinedAndFilled(server)) {
-        let url = new URL(server.webToHist);
+    if (isDefinedAndFilled(findGetParameter("suiteId")))
+        parentSuitId = findGetParameter("suiteId");
+    else if (isDefinedAndFilled(server))
+        parentSuitId = findGetParameter("buildTypeId", server.webToHist);
 
-        suiteName = url.searchParams.get("buildTypeId");
-    }
-
-    if (isDefinedAndFilled(suiteName)) {
-        res += "<tr><td><b> Suite: </b></td><td>[" + suiteName + "] ";
+    if (isDefinedAndFilled(parentSuitId)) {
+        res += "<tr><td><b> Suite: </b></td><td>[" + parentSuitId + "] ";
         res += " <a href='" + server.webToHist + "'>[TC history]</a>";
         res += "</td></tr>";
     }
@@ -165,13 +162,13 @@ function showChainCurrentStatusData(server, settings) {
     if (suitesFailedList.length !== 0 && isDefinedAndFilled(server.serverId) 
&& isDefinedAndFilled(server.branchName)) {
         mInfo += "Trigger failed " + cntFailed + " builds";
         mInfo += " <a href='javascript:void(0);' ";
-        mInfo += " onClick='triggerBuilds(\"" + server.serverId + "\", \"" + 
suitesFailedList + "\", \"" +
-            server.branchName + "\", false, false)' ";
+        mInfo += " onClick='triggerBuilds(\"" + server.serverId + "\", \"" + 
parentSuitId + "\", " +
+            "\"" + suitesFailedList + "\", \"" + server.branchName + "\", 
false, false)' ";
         mInfo += " title='trigger builds'>in queue</a> ";
 
         mInfo += " <a href='javascript:void(0);' ";
-        mInfo += " onClick='triggerBuilds(\"" + server.serverId + "\", \"" + 
suitesFailedList + "\", \"" +
-            server.branchName + "\", true, false)' ";
+        mInfo += " onClick='triggerBuilds(\"" + server.serverId + "\", \"" + 
parentSuitId + "\", " +
+            "\"" + suitesFailedList + "\", \"" + server.branchName + "\", 
true, false)' ";
         mInfo += " title='trigger builds'>on top</a><br>";
     }
 
@@ -213,11 +210,9 @@ function showChainCurrentStatusData(server, settings) {
     //     res += "<button onclick='notifyGit()'>Update PR status</button>";
     // }
 
-    var suiteId = findGetParameter("suiteId");
-
     if (settings.isJiraAvailable()) {
-        res += "<button onclick='commentJira(\"" + server.serverId + "\", \"" 
+ suiteId + "\", \""
-            + server.branchName + "\")'>Comment JIRA</button>&nbsp;&nbsp;";
+        res += "<button onclick='commentJira(\"" + server.serverId + "\", \"" 
+ server.branchName + "\", \""
+            + parentSuitId + "\")'>Comment JIRA</button>&nbsp;&nbsp;";
 
         var blockersList = "";
 
@@ -234,11 +229,12 @@ function showChainCurrentStatusData(server, settings) {
             }
         }
 
-        res += "<button onclick='triggerBuilds(\"" + server.serverId + "\", 
\"" + blockersList + "\", \"" +
-            server.branchName + "\", false, false)'> Re-run possible 
blockers</button><br>";
+        res += "<button onclick='triggerBuilds(\"" + server.serverId + "\", 
\"" + parentSuitId + "\", \"" +
+            blockersList + "\", \"" + server.branchName + "\", false, false)'> 
Re-run possible blockers</button><br>";
 
-        res += "<button onclick='triggerBuilds(\"" + server.serverId + "\", 
\"" + blockersList + "\", \"" +
-            server.branchName + "\", false, true)'> Re-run possible blockers & 
Comment JIRA</button><br>";
+        res += "<button onclick='triggerBuilds(\"" + server.serverId + "\", 
\"" + parentSuitId + "\", \"" +
+            blockersList + "\", \"" + server.branchName + "\", false, true)'> 
" +
+            "Re-run possible blockers & Comment JIRA</button><br>";
     }
 
     if (isDefinedAndFilled(server.baseBranchForTc)) {
@@ -388,7 +384,7 @@ function notifyGit() {
     });
 }
 
-function triggerBuilds(serverId, suiteIdList, branchName, top, observe, 
ticketId) {
+function triggerBuilds(serverId, parentSuiteId, suiteIdList, branchName, top, 
observe, ticketId) {
     var queueAtTop = isDefinedAndFilled(top) && top;
     var observeJira = isDefinedAndFilled(observe) && observe;
     var suiteIdsNotExists = !isDefinedAndFilled(suiteIdList) || 
suiteIdList.length === 0;
@@ -412,6 +408,7 @@ function triggerBuilds(serverId, suiteIdList, branchName, 
top, observe, ticketId
     }
 
     var suites = suiteIdList.split(',');
+    var parentSuite = isDefinedAndFilled(parentSuiteId) ? parentSuiteId : 
suites[0];
     var fewSuites = suites.length > 1;
 
     var message = "Trigger build" + (fewSuites ? "s" : "") + " at 
<b>server:</b> " + serverId + "<br>" +
@@ -441,8 +438,9 @@ function triggerBuilds(serverId, suiteIdList, branchName, 
top, observe, ticketId
             url: 'rest/build/trigger',
             data: {
                 "serverId": serverId,
-                "suiteIdList": suiteIdList,
                 "branchName": branchName,
+                "parentSuiteId" : parentSuite,
+                "suiteIdList": suiteIdList,
                 "top": queueAtTop,
                 "observe": observeJira,
                 "ticketId": ticketId
@@ -499,7 +497,7 @@ function jiraTicketNumber(ticket) {
     return regExpr.exec(ticket)[2];
 }
 
-function commentJira(serverId, suiteId, branchName, ticketId) {
+function commentJira(serverId, branchName, parentSuiteId, ticketId) {
     var branchNotExists = !isDefinedAndFilled(branchName) || branchName.length 
=== 0;
     branchName = branchNotExists ? null : branchForTc(branchName);
     ticketId = (isDefinedAndFilled(ticketId) && ticketId.length > 0) ? 
jiraTicketNumber(ticketId) : null;
@@ -527,7 +525,7 @@ function commentJira(serverId, suiteId, branchName, 
ticketId) {
         url: 'rest/build/commentJira',
         data: {
             "serverId": serverId,
-            "suiteId": suiteId,
+            "suiteId": parentSuiteId,
             "branchName": branchName,
             "ticketId": ticketId
         },
@@ -543,7 +541,7 @@ function commentJira(serverId, suiteId, branchName, 
ticketId) {
 
                         ticketId = $("#enterTicketId").val();
 
-                        commentJira(serverId, suiteId, branchName, ticketId)
+                        commentJira(serverId, branchName, parentSuiteId, 
ticketId)
                     },
                     "Cancel": function () {
                         $(this).dialog("close");
@@ -561,7 +559,7 @@ function commentJira(serverId, suiteId, branchName, 
ticketId) {
             var dialog = $("#triggerDialog");
 
             dialog.html("Trigger builds at server: " + serverId + "<br>" +
-                " Suite: " + suiteId + "<br>Branch:" + branchName +
+                " Suite: " + parentSuiteId + "<br>Branch:" + branchName +
                 "<br><br> Result: " + result.result +
                 (needTicketId ? ("<br><br>Enter JIRA ticket number: <input 
type='text' id='enterTicketId'>") : ""));
 
@@ -648,13 +646,13 @@ function showSuiteData(suite, settings) {
     if (isDefinedAndFilled(suite.serverId) && 
isDefinedAndFilled(suite.suiteId) && isDefinedAndFilled(suite.branchName)) {
         mInfo += " Trigger build: ";
         mInfo += "<a href='javascript:void(0);' ";
-        mInfo += " onClick='triggerBuilds(\"" + suite.serverId + "\", \"" + 
suite.suiteId + "\", \"" + suite.branchName
-            + "\", false, false)' ";
+        mInfo += " onClick='triggerBuilds(\"" + suite.serverId + "\", null, 
\"" +
+            suite.suiteId + "\", \"" + suite.branchName + "\", false, false)' 
";
         mInfo += " title='trigger build' >queue</a> ";
 
         mInfo += "<a href='javascript:void(0);' ";
-        mInfo += " onClick='triggerBuilds(\"" + suite.serverId + "\", \"" + 
suite.suiteId + "\", \"" + suite.branchName
-            + "\", true, false)' ";
+        mInfo += " onClick='triggerBuilds(\"" + suite.serverId + "\", null, 
\"" +
+            suite.suiteId + "\", \"" + suite.branchName + "\", true, false)' ";
         mInfo += " title='trigger build at top of queue'>top</a><br>";
     }
 
diff --git 
a/ignite-tc-helper-web/src/test/java/org/apache/ignite/ci/teamcity/ignited/IgnitedTcInMemoryIntegrationTest.java
 
b/ignite-tc-helper-web/src/test/java/org/apache/ignite/ci/teamcity/ignited/IgnitedTcInMemoryIntegrationTest.java
index 923ba18f..08484a25 100644
--- 
a/ignite-tc-helper-web/src/test/java/org/apache/ignite/ci/teamcity/ignited/IgnitedTcInMemoryIntegrationTest.java
+++ 
b/ignite-tc-helper-web/src/test/java/org/apache/ignite/ci/teamcity/ignited/IgnitedTcInMemoryIntegrationTest.java
@@ -289,13 +289,13 @@ public void saveAndLoadBuildTypes() throws IOException, 
JAXBException {
             .findFirst()
             .orElse(null);
 
-        BuildType runAllRefFromCache = 
srv.getBuildTypeRef(runAll).toBuildTypeRef(compactor);
+        BuildType runAllRefFromCache = 
srv.getBuildTypeRef(runAll).toBuildTypeRef(compactor, srv.host());
 
         assertEquals(runAllRef, runAllRefFromCache);
 
         BuildTypeFull runAllFull = jaxbTestXml("/" + runAll + ".xml", 
BuildTypeFull.class);
 
-        BuildTypeFull runAllFullFromCache = 
srv.getBuildType(runAll).toBuildType(compactor);
+        BuildTypeFull runAllFullFromCache = 
srv.getBuildType(runAll).toBuildType(compactor, srv.host());
 
         assertEquals(runAllFull, runAllFullFromCache);
     }


 

----------------------------------------------------------------
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:
us...@infra.apache.org


> [TC Bot] Support for alternative configurations for PR testing
> --------------------------------------------------------------
>
>                 Key: IGNITE-10203
>                 URL: https://issues.apache.org/jira/browse/IGNITE-10203
>             Project: Ignite
>          Issue Type: Task
>            Reporter: Nikolai Kulagin
>            Assignee: Nikolai Kulagin
>            Priority: Major
>
> Support for alternative configurations for PR testing (for example, 
> IgniteTests24Java8_RunMl)



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to