You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by dp...@apache.org on 2019/04/13 19:09:19 UTC
[ignite-teamcity-bot] branch master updated: IGNITE-11740: Add search for full branch name in contributions table,… (#118)
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 0abee7f IGNITE-11740: Add search for full branch name in contributions table,… (#118)
0abee7f is described below
commit 0abee7f2fea331c144069cb5481805a234603816
Author: Dmitriy Pavlov <dp...@apache.org>
AuthorDate: Sat Apr 13 22:09:15 2019 +0300
IGNITE-11740: Add search for full branch name in contributions table,… (#118)
---
conf/branches.json | 18 +++
.../ci/github/ignited/GitHubConnIgnitedImpl.java | 6 +-
.../apache/ignite/ci/tcbot/conf/GitHubConfig.java | 15 +-
.../apache/ignite/ci/tcbot/conf/IGitHubConfig.java | 2 +
.../ignite/ci/tcbot/visa/ContributionToCheck.java | 5 +-
.../tcbot/visa/TcBotTriggerAndSignOffService.java | 169 +++++++++++----------
.../ci/teamcity/ignited/TeamcityIgnitedImpl.java | 21 +--
.../ci/teamcity/ignited/buildref/BuildRefDao.java | 16 +-
.../model/current/ChainAtServerCurrentStatus.java | 17 +--
9 files changed, 156 insertions(+), 113 deletions(-)
diff --git a/conf/branches.json b/conf/branches.json
index 56f4112..a77dda5 100644
--- a/conf/branches.json
+++ b/conf/branches.json
@@ -1,6 +1,7 @@
{
// Default server (service) code, internal identification
"primaryServerCode": "apache",
+ /**/
"tcServers": [
{
//code of current server
@@ -10,6 +11,7 @@
"reference": "apache"
}
],
+ /* Set of JIRA servers/projects configured */
"jiraServers": [
{
/* Server code will be referenced in all tracked branches, URLs, etc */
@@ -24,6 +26,22 @@
"authTok": "" //todo specify
}
],
+ /* Set of GitHub services configured */
+ "gitHubConfigs": [
+ {
+ "code": "apache",
+ /* More for preffering branches gives branch for PR to be default branch for triggering builds on TC. */
+ "preferBranches": false,
+
+ /*
+ Git Auth token encoded to access non-public GitHub repos, use {@link org.apache.ignite.ci.conf.PasswordEncoder#encodeJiraTok
+ to set up value in a config. For public GitHub repos token gives more velocity
+ */
+ "authTok": "",
+ //todo specify token
+ "apiUrl": "https://api.github.com/repos/apache/ignite/"
+ }
+ ],
"branches": [
{
"id": "master",
diff --git a/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/github/ignited/GitHubConnIgnitedImpl.java b/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/github/ignited/GitHubConnIgnitedImpl.java
index e1375c5..f80d6b5 100644
--- a/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/github/ignited/GitHubConnIgnitedImpl.java
+++ b/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/github/ignited/GitHubConnIgnitedImpl.java
@@ -127,7 +127,11 @@ class GitHubConnIgnitedImpl implements IGitHubConnIgnited {
/** {@inheritDoc} */
@AutoProfiling
@Override public List<String> getBranches() {
- scheduler.sheduleNamed(taskName("actualizeBranches"), this::actualizeBranches, 2, TimeUnit.HOURS);
+ final int rescanIntervalMins = config().isPreferBranches() ? 5 : 120;
+
+ scheduler.sheduleNamed(taskName("actualizeBranches"),
+ this::actualizeBranches,
+ rescanIntervalMins, TimeUnit.MINUTES);
return StreamSupport.stream(branchCache.spliterator(), false)
.filter(entry -> entry.getKey().srvId() == srvIdMaskHigh)
diff --git a/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/tcbot/conf/GitHubConfig.java b/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/tcbot/conf/GitHubConfig.java
index 00c0215..1386678 100644
--- a/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/tcbot/conf/GitHubConfig.java
+++ b/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/tcbot/conf/GitHubConfig.java
@@ -21,6 +21,7 @@ import java.util.Properties;
import javax.annotation.Nullable;
import org.apache.ignite.ci.HelperConfig;
import org.apache.ignite.ci.conf.PasswordEncoder;
+import org.jetbrains.annotations.NotNull;
import static com.google.common.base.Strings.isNullOrEmpty;
@@ -47,6 +48,13 @@ public class GitHubConfig implements IGitHubConfig {
private Properties props;
+ /**
+ * Prefer branches contributions. If null or false then PRs have priority.
+ * If set to true that means branch scanning preformed more often, and default triggering option is branch.
+ */
+ @Nullable
+ private Boolean preferBranches;
+
public GitHubConfig() {
}
@@ -73,6 +81,7 @@ public class GitHubConfig implements IGitHubConfig {
}
/** {@inheritDoc} */
+ @NotNull
@Override public String gitBranchPrefix() {
if (!Strings.isNullOrEmpty(branchPrefix))
return branchPrefix;
@@ -104,6 +113,11 @@ public class GitHubConfig implements IGitHubConfig {
}
+ @Override
+ public boolean isPreferBranches() {
+ return Boolean.TRUE.equals(preferBranches);
+ }
+
@Override public String code() {
return code;
}
@@ -132,6 +146,5 @@ public class GitHubConfig implements IGitHubConfig {
return props != null
? props.getProperty(HelperConfig.GITHUB_AUTH_TOKEN)
: null;
-
}
}
diff --git a/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/tcbot/conf/IGitHubConfig.java b/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/tcbot/conf/IGitHubConfig.java
index 7ba002a..63580d3 100644
--- a/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/tcbot/conf/IGitHubConfig.java
+++ b/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/tcbot/conf/IGitHubConfig.java
@@ -49,4 +49,6 @@ public interface IGitHubConfig {
default boolean isGitTokenAvailable() {
return gitAuthTok() != null;
}
+
+ boolean isPreferBranches();
}
diff --git a/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/tcbot/visa/ContributionToCheck.java b/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/tcbot/visa/ContributionToCheck.java
index c4e1859..ecfcb5b 100644
--- a/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/tcbot/visa/ContributionToCheck.java
+++ b/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/tcbot/visa/ContributionToCheck.java
@@ -41,7 +41,10 @@ package org.apache.ignite.ci.tcbot.visa;
/** Pr head commit hash (first 7 hexes). */
public String prHeadCommit;
- /** Branch Name for team city */
+ /**
+ * Branch Name for Team City. Always a branch for PR_less contribution,
+ * for PRs filled only if there are builds found for TC.
+ */
public String tcBranchName;
/** JIRA issue without server URL, but with project name */
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 469d709..1a5215f 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
@@ -21,21 +21,6 @@ import com.fasterxml.jackson.databind.ObjectMapper;
import com.google.common.base.Preconditions;
import com.google.common.base.Strings;
import com.google.inject.Provider;
-import java.text.DateFormat;
-import java.text.SimpleDateFormat;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.Date;
-import java.util.LinkedHashSet;
-import java.util.List;
-import java.util.Objects;
-import java.util.Set;
-import java.util.stream.Collectors;
-import java.util.stream.Stream;
-import javax.annotation.Nonnull;
-import javax.inject.Inject;
-import javax.ws.rs.QueryParam;
import org.apache.ignite.ci.ITeamcity;
import org.apache.ignite.ci.github.GitHubBranch;
import org.apache.ignite.ci.github.GitHubUser;
@@ -55,20 +40,12 @@ import org.apache.ignite.ci.tcbot.conf.ITcBotConfig;
import org.apache.ignite.ci.tcbot.conf.ITcServerConfig;
import org.apache.ignite.ci.tcmodel.mute.MuteInfo;
import org.apache.ignite.ci.tcmodel.result.Build;
-import org.apache.ignite.ci.teamcity.ignited.BuildRefCompacted;
-import org.apache.ignite.ci.teamcity.ignited.IStringCompactor;
-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.*;
import org.apache.ignite.ci.teamcity.ignited.buildtype.BuildTypeCompacted;
import org.apache.ignite.ci.teamcity.ignited.buildtype.BuildTypeRefCompacted;
import org.apache.ignite.ci.teamcity.ignited.fatbuild.FatBuildCompacted;
import org.apache.ignite.ci.user.ICredentialsProv;
-import org.apache.ignite.ci.web.model.ContributionKey;
-import org.apache.ignite.ci.web.model.JiraCommentResponse;
-import org.apache.ignite.ci.web.model.SimpleResult;
-import org.apache.ignite.ci.web.model.Visa;
-import org.apache.ignite.ci.web.model.VisaRequest;
+import org.apache.ignite.ci.web.model.*;
import org.apache.ignite.ci.web.model.current.SuiteCurrentStatus;
import org.apache.ignite.ci.web.model.current.TestFailure;
import org.apache.ignite.ci.web.model.hist.FailureSummary;
@@ -79,9 +56,16 @@ import org.jetbrains.annotations.Nullable;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import static org.apache.ignite.ci.observer.BuildsInfo.CANCELLED_STATUS;
-import static org.apache.ignite.ci.observer.BuildsInfo.FINISHED_STATUS;
-import static org.apache.ignite.ci.observer.BuildsInfo.RUNNING_STATUS;
+import javax.annotation.Nonnull;
+import javax.inject.Inject;
+import javax.ws.rs.QueryParam;
+import java.text.DateFormat;
+import java.text.SimpleDateFormat;
+import java.util.*;
+import java.util.stream.Collectors;
+import java.util.stream.Stream;
+
+import static org.apache.ignite.ci.observer.BuildsInfo.*;
import static org.apache.ignite.ci.util.XmlUtil.xmlEscapeText;
/**
@@ -372,46 +356,58 @@ public class TcBotTriggerAndSignOffService {
IJiraIgnited jiraIntegration = jiraIgnProv.server(srvCodeOrAlias);
IGitHubConnIgnited gitHubConnIgnited = gitHubConnIgnitedProvider.server(srvCodeOrAlias);
- List<PullRequest> requests = gitHubConnIgnited.getPullRequests();
- if (requests == null)
- return null;
- Set<Ticket> tickets = jiraIntegration.getTickets();
+ ITeamcityIgnited tcIgn = tcIgnitedProv.server(srvCodeOrAlias, credsProv);
- List<String> branches = gitHubConnIgnited.getBranches();
+ List<PullRequest> prs = gitHubConnIgnited.getPullRequests();
- List<Ticket> activeTickets = tickets.stream().filter(Ticket::isActiveContribution).collect(Collectors.toList());
+ Set<Ticket> tickets = jiraIntegration.getTickets();
IJiraServerConfig jiraCfg = jiraIntegration.config();
IGitHubConfig ghCfg = gitHubConnIgnited.config();
- List<ContributionToCheck> contribsList = requests.stream().map(pr -> {
- ContributionToCheck check = new ContributionToCheck();
- check.prNumber = pr.getNumber();
- check.prTitle = pr.getTitle();
- check.prHtmlUrl = pr.htmlUrl();
- check.prHeadCommit = pr.lastCommitShaShort();
- check.prTimeUpdate = pr.getTimeUpdate();
-
- GitHubUser user = pr.gitHubUser();
- if (user != null) {
- check.prAuthor = user.login();
- check.prAuthorAvatarUrl = user.avatarUrl();
- }
- else {
- check.prAuthor = "";
- check.prAuthorAvatarUrl = "";
- }
+ String defBtForTcServ = findDefaultBuildType(srvCodeOrAlias);
- check.jiraIssueId = ticketMatcher.resolveTicketIdForPrBasedContrib(tickets, pr, jiraCfg);
+ List<ContributionToCheck> contribsList = new ArrayList<>();
- if (!Strings.isNullOrEmpty(check.jiraIssueId))
- check.jiraIssueUrl = jiraIntegration.generateTicketUrl(check.jiraIssueId);
+ if (prs != null) {
+ prs.forEach(pr -> {
+ ContributionToCheck c = new ContributionToCheck();
- return check;
- }).collect(Collectors.toList());
+ c.prNumber = pr.getNumber();
+ c.prTitle = pr.getTitle();
+ c.prHtmlUrl = pr.htmlUrl();
+ c.prHeadCommit = pr.lastCommitShaShort();
+ c.prTimeUpdate = pr.getTimeUpdate();
- ITeamcityIgnited tcIgn = tcIgnitedProv.server(srvCodeOrAlias, credsProv);
+ GitHubUser user = pr.gitHubUser();
+ if (user != null) {
+ c.prAuthor = user.login();
+ c.prAuthorAvatarUrl = user.avatarUrl();
+ } else {
+ c.prAuthor = "";
+ c.prAuthorAvatarUrl = "";
+ }
+
+ c.jiraIssueId = ticketMatcher.resolveTicketIdForPrBasedContrib(tickets, pr, jiraCfg);
+
+ if (!Strings.isNullOrEmpty(c.jiraIssueId)
+ && jiraCfg.getUrl() != null)
+ c.jiraIssueUrl = jiraIntegration.generateTicketUrl(c.jiraIssueId);
+
+ findBuildsForPr(defBtForTcServ, Integer.toString(pr.getNumber()), gitHubConnIgnited, tcIgn)
+ .stream()
+ .map(buildRefCompacted -> buildRefCompacted.branchName(compactor))
+ .findAny()
+ .ifPresent(bName -> c.tcBranchName = bName);
+
+ contribsList.add(c);
+ });
+ }
+
+ List<String> branches = gitHubConnIgnited.getBranches();
+
+ List<Ticket> activeTickets = tickets.stream().filter(Ticket::isActiveContribution).collect(Collectors.toList());
activeTickets.forEach(ticket -> {
String branch = ticketMatcher.resolveTcBranchForPrLess(ticket,
@@ -421,10 +417,9 @@ public class TcBotTriggerAndSignOffService {
if (Strings.isNullOrEmpty(branch))
return; // nothing to do if branch was not resolved
- String defBtForMaster = findDefaultBuildType(srvCodeOrAlias);
if (!branches.contains(branch)
- && tcIgn.getAllBuildsCompacted(defBtForMaster, branch).isEmpty())
+ && tcIgn.getAllBuildsCompacted(defBtForTcServ, branch).isEmpty())
return; //Skipping contributions without builds
ContributionToCheck contribution = new ContributionToCheck();
@@ -470,7 +465,8 @@ public class TcBotTriggerAndSignOffService {
IGitHubConnIgnited ghConn,
ITeamcityIgnited srv) {
- List<BuildRefCompacted> buildHist = srv.getAllBuildsCompacted(suiteId, branchForTcDefault(prId, ghConn));
+ List<BuildRefCompacted> buildHist = srv.getAllBuildsCompacted(suiteId,
+ branchForTcDefault(prId, ghConn));
if (!buildHist.isEmpty())
return buildHist;
@@ -484,33 +480,49 @@ public class TcBotTriggerAndSignOffService {
if (!buildHist.isEmpty())
return buildHist;
- PullRequest pr = ghConn.getPullRequest(prNum);
+ String bracnhToCheck =
+ ghConn.config().isPreferBranches()
+ ? branchForTcA(prId) // for prefer branches mode it was already checked in default
+ : getPrBranch(ghConn, prNum);
- if (pr != null) {
- GitHubBranch head = pr.head();
+ if (bracnhToCheck == null)
+ return Collections.emptyList();
- if (head != null) {
- String ref = head.ref();
+ buildHist = srv.getAllBuildsCompacted(suiteId, bracnhToCheck);
- buildHist = srv.getAllBuildsCompacted(suiteId, ref);
+ return buildHist;
+ }
- if (!buildHist.isEmpty())
- return buildHist;
- }
- }
+ @Nullable
+ private String getPrBranch(IGitHubConnIgnited ghConn, Integer prNum) {
+ PullRequest pr = ghConn.getPullRequest(prNum);
+
+ if (pr == null)
+ return null;
+
+ GitHubBranch head = pr.head();
- return Collections.emptyList();
+ if (head == null)
+ return null;
+
+ return head.ref();
}
/**
* @param prId Pr id from {@link ContributionToCheck#prNumber}. Negative value imples branch number to be used for
* PR-less contributions.
- * @param srv Github integration.
+ * @param ghConn Github integration.
*/
- private String branchForTcDefault(String prId, IGitHubConnIgnited srv) {
+ private String branchForTcDefault(String prId, IGitHubConnIgnited ghConn) {
Integer prNum = Integer.valueOf(prId);
if (prNum < 0)
- return srv.gitBranchPrefix() + (-prNum); // Checking "ignite-10930" builds only
+ return ghConn.gitBranchPrefix() + (-prNum); // Checking "ignite-10930" builds only
+
+ if (ghConn.config().isPreferBranches()) {
+ String ref = getPrBranch(ghConn, prNum);
+ if (ref != null)
+ return ref;
+ }
return branchForTcA(prId);
}
@@ -542,11 +554,11 @@ public class TcBotTriggerAndSignOffService {
List<String> compositeBuildTypeIds = findApplicableBuildTypes(srvCode, teamcity);
for (String btId : compositeBuildTypeIds) {
- List<BuildRefCompacted> compBuilds = findBuildsForPr(btId, prId, ghConn, teamcity);
+ List<BuildRefCompacted> buildsForBt = findBuildsForPr(btId, prId, ghConn, teamcity);
- statuses.add(compBuilds.isEmpty()
+ statuses.add(buildsForBt.isEmpty()
? new ContributionCheckStatus(btId, branchForTcDefault(prId, ghConn))
- : contributionStatus(srvCode, btId, compBuilds, teamcity, ghConn, prId));
+ : contributionStatus(srvCode, btId, buildsForBt, teamcity, ghConn, prId));
}
return statuses;
@@ -590,7 +602,8 @@ public class TcBotTriggerAndSignOffService {
* @param srvIdOrAlias Server id. May be weak reference to TC
* @return Some build type included into tracked branches with default branch.
*/
- @NotNull public String findDefaultBuildType(String srvIdOrAlias) {
+ @NotNull
+ private String findDefaultBuildType(String srvIdOrAlias) {
StringBuilder buildTypeId = new StringBuilder();
ITcServerConfig tcCfg = cfg.getTeamcityConfig(srvIdOrAlias);
diff --git a/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/teamcity/ignited/TeamcityIgnitedImpl.java b/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/teamcity/ignited/TeamcityIgnitedImpl.java
index b1a8039..5f836f1 100644
--- a/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/teamcity/ignited/TeamcityIgnitedImpl.java
+++ b/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/teamcity/ignited/TeamcityIgnitedImpl.java
@@ -19,17 +19,8 @@ package org.apache.ignite.ci.teamcity.ignited;
import com.google.common.collect.Lists;
import com.google.common.collect.Sets;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.Comparator;
-import java.util.Date;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.OptionalInt;
-import java.util.Set;
-import java.util.SortedSet;
+
+import java.util.*;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.stream.Collectors;
@@ -89,6 +80,10 @@ public class TeamcityIgnitedImpl implements ITeamcityIgnited {
/** Max build id diff to enforce reload during incremental refresh. */
public static final int MAX_ID_DIFF_TO_ENFORCE_CONTINUE_SCAN = 3000;
+ private static final List<String> DEFAULT_SYNONYMS
+ = Collections.unmodifiableList(
+ Lists.newArrayList(ITeamcity.DEFAULT, ITeamcity.REFS_HEADS_MASTER, "master"));
+
/** Server (service) code. */
private String srvCode;
@@ -338,7 +333,7 @@ public class TeamcityIgnitedImpl implements ITeamcityIgnited {
@Nullable String branchName) {
ensureActualizeRequested();
- return buildRefDao.findBuildsInHistoryCompacted(srvIdMaskHigh, buildTypeId, branchForQuery(branchName));
+ return buildRefDao.getAllBuildsCompacted(srvIdMaskHigh, buildTypeId, branchForQuery(branchName));
}
/** {@inheritDoc} */
@@ -449,7 +444,7 @@ public class TeamcityIgnitedImpl implements ITeamcityIgnited {
public List<String> branchForQuery(@Nullable String branchName) {
if (ITeamcity.DEFAULT.equals(branchName))
- return Lists.newArrayList(branchName, ITeamcity.REFS_HEADS_MASTER, "master");
+ return DEFAULT_SYNONYMS;
else
return Collections.singletonList(branchName);
}
diff --git a/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/teamcity/ignited/buildref/BuildRefDao.java b/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/teamcity/ignited/buildref/BuildRefDao.java
index e254e9a..608bb48 100644
--- a/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/teamcity/ignited/buildref/BuildRefDao.java
+++ b/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/teamcity/ignited/buildref/BuildRefDao.java
@@ -140,9 +140,9 @@ public class BuildRefDao {
* @param bracnhNameQry Bracnh name query.
*/
@AutoProfiling
- @NotNull public List<BuildRefCompacted> findBuildsInHistoryCompacted(int srvId,
- @Nullable String buildTypeId,
- List<String> bracnhNameQry) {
+ @NotNull public List<BuildRefCompacted> getAllBuildsCompacted(int srvId,
+ @Nullable String buildTypeId,
+ List<String> bracnhNameQry) {
Integer buildTypeIdId = compactor.getStringIdIfPresent(buildTypeId);
if (buildTypeIdId == null)
@@ -178,12 +178,12 @@ public class BuildRefDao {
/**
* @param srvId Server id.
- * @param bracnhNamesQry Branch names.
+ * @param branchNamesQry Branch name(s).
*/
@AutoProfiling
- @GuavaCached(softValues = true, maximumSize = 1000, expireAfterAccessSecs = 60)
- public List<BuildRefCompacted> getBuildsForBranch(int srvId, List<String> bracnhNamesQry) {
- Set<Integer> branchIds = bracnhNamesQry.stream().map(str -> compactor.getStringIdIfPresent(str))
+ @GuavaCached(softValues = true, maximumSize = 10000, expireAfterWriteSecs = 90)
+ public List<BuildRefCompacted> getBuildsForBranch(int srvId, List<String> branchNamesQry) {
+ Set<Integer> branchIds = branchNamesQry.stream().map(str -> compactor.getStringIdIfPresent(str))
.filter(Objects::nonNull).collect(Collectors.toSet());
List<BuildRefCompacted> list = new ArrayList<>();
@@ -194,7 +194,7 @@ public class BuildRefDao {
return list;
}
- public void fillBuilds(int srvId, Integer branchNameId, List<BuildRefCompacted> list) {
+ private void fillBuilds(int srvId, Integer branchNameId, List<BuildRefCompacted> list) {
try (QueryCursor<Cache.Entry<Long, BuildRefCompacted>> qryCursor = buildRefsCache.query(
new SqlQuery<Long, BuildRefCompacted>(BuildRefCompacted.class, "branchName = ?")
.setArgs(branchNameId))) {
diff --git a/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/web/model/current/ChainAtServerCurrentStatus.java b/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/web/model/current/ChainAtServerCurrentStatus.java
index 5c739d4..46bcc95 100644
--- a/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/web/model/current/ChainAtServerCurrentStatus.java
+++ b/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/web/model/current/ChainAtServerCurrentStatus.java
@@ -18,13 +18,6 @@
package org.apache.ignite.ci.web.model.current;
import com.google.common.base.Strings;
-import java.util.ArrayList;
-import java.util.Comparator;
-import java.util.List;
-import java.util.Map;
-import java.util.Objects;
-import java.util.stream.Stream;
-import javax.annotation.Nullable;
import org.apache.ignite.ci.analysis.FullChainRunCtx;
import org.apache.ignite.ci.analysis.IMultTestOccurrence;
import org.apache.ignite.ci.analysis.MultBuildRunCtx;
@@ -38,10 +31,12 @@ import org.apache.ignite.ci.teamcity.ignited.ITeamcityIgnited;
import org.apache.ignite.ci.util.CollectionUtil;
import org.apache.ignite.internal.util.typedef.T2;
+import javax.annotation.Nullable;
+import java.util.*;
+import java.util.stream.Stream;
+
import static org.apache.ignite.ci.util.UrlUtil.escape;
-import static org.apache.ignite.ci.web.model.current.SuiteCurrentStatus.branchForLink;
-import static org.apache.ignite.ci.web.model.current.SuiteCurrentStatus.createOccurForLogConsumer;
-import static org.apache.ignite.ci.web.model.current.SuiteCurrentStatus.createOrrucForLongRun;
+import static org.apache.ignite.ci.web.model.current.SuiteCurrentStatus.*;
/**
* Represent Run All chain results/ or RunAll+latest re-runs.
@@ -147,7 +142,7 @@ public class ChainAtServerCurrentStatus {
prUrl = pullReq.htmlUrl();
}
- if (!Strings.isNullOrEmpty(ticketFullName))
+ if (!Strings.isNullOrEmpty(ticketFullName) && jiraIntegration.config().getUrl() != null)
ticketUrl = jiraIntegration.generateTicketUrl(ticketFullName);
setPrInfo(prNum, prUrl);