Skip to content
Permalink
Browse files
Board: Suites problem support, migration to new displaying of issues …
…lists;

Board: Web links supported to refer to the tests
Board: Commit author, hidden email

Queue builds: separate monitoring of all suites triggering for debug

UI: fixes for Authorisation from board; Chain Href fixed for build and history - Fixes #154.
Signed-off-by: Dmitriy Pavlov <dpavlov@apache.org>
  • Loading branch information
dspavlov committed Aug 16, 2019
1 parent 47c4121 commit e2c8ab9b0f840d02bbfd9df6c0d912987db30cde
Showing 10 changed files with 234 additions and 188 deletions.
@@ -55,7 +55,7 @@ public class CheckQueueJob implements Runnable {

/** Percentage of free agents required to trigger build. */
private static final int CHECK_QUEUE_MIN_FREE_AGENTS_PERCENT =
Integer.getInteger("CHECK_QUEUE_MIN_FREE_AGENTS_PERCENT", 20);
Integer.getInteger("CHECK_QUEUE_MIN_FREE_AGENTS_PERCENT", 15);

/** */
private ITcBotUserCreds creds;
@@ -94,7 +94,7 @@ public void init(ITcBotUserCreds creds) {
/** */
@SuppressWarnings({"WeakerAccess", "UnusedReturnValue"})
@AutoProfiling
@MonitoredTask(name = "Check Queue")
@MonitoredTask(name = "Check Servers Queue")
protected String runEx() {
if (Boolean.valueOf(System.getProperty(AUTO_TRIGGERING_BUILD_DISABLED))) {
final String msg = "Automatic build triggering was disabled.";
@@ -145,8 +145,8 @@ protected String runEx() {
@SuppressWarnings({"WeakerAccess", "UnusedReturnValue"})
@AutoProfiling
@MonitoredTask(name = "Check Server Queue", nameExtArgIndex = 0)
protected String checkQueue(String srvId, List<ITrackedChain> chains) {
ITeamcityIgnited tcIgn = tcIgnitedProv.server(srvId, creds);
protected String checkQueue(String srvCode, List<ITrackedChain> chains) {
ITeamcityIgnited tcIgn = tcIgnitedProv.server(srvCode, creds);

List<Agent> agents = tcIgn.agents(true, true);

@@ -170,96 +170,97 @@ protected String checkQueue(String srvId, List<ITrackedChain> chains) {
logger.info("There are more than {}% free agents (total={}, free={}).", CHECK_QUEUE_MIN_FREE_AGENTS_PERCENT,
total, total - running);

String selfLogin = creds.getUser(srvId);
String selfLogin = creds.getUser(srvCode);

tcIgn.actualizeRecentBuildRefs();

StringBuilder res = new StringBuilder();

for (ITrackedChain chain : chains) {
if(!Objects.equals(chain.serverCode(), srvId))
if (!Objects.equals(chain.serverCode(), srvCode))
continue;

boolean trigger = true;
String result = checkIfChainTriggerable(chain.serverCode(), chain.tcSuiteId(), chain.tcBranch(), tcIgn, selfLogin, chain);

List<BuildRefCompacted> buildsForBr = tcIgn.getQueuedBuildsCompacted(chain.tcBranch());
res.append(result).append("; ");
}

for (BuildRefCompacted refComp : buildsForBr) {
Integer buildId = refComp.getId();
if (buildId == null)
continue; // should not occur;
return res.toString();
}

final FatBuildCompacted fatBuild = tcIgn.getFatBuild(buildId);
final Build build = fatBuild.toBuild(compactor);
final Triggered triggered = build.getTriggered();
@SuppressWarnings("WeakerAccess")
@MonitoredTask(name = "Check Server Queue", nameExtArgsIndexes = {0, 1, 2})
protected String checkIfChainTriggerable(String serverCode,
String buildTypeId,
String tcBranch,
ITeamcityIgnited tcIgn,
String selfLogin,
ITrackedChain chain) {
List<BuildRefCompacted> buildsForBr = tcIgn.getQueuedBuildsCompacted(tcBranch);

if (triggered == null) {
logger.info("Unable to get triggering info for queued build {} (type={}).", buildId, build.buildTypeId);
for (BuildRefCompacted refComp : buildsForBr) {
Integer buildId = refComp.getId();
if (buildId == null)
continue; // should not occur;

continue;
}
final FatBuildCompacted fatBuild = tcIgn.getFatBuild(buildId);
final Build build = fatBuild.toBuild(compactor);
final Triggered triggered = build.getTriggered();

User user = build.getTriggered().getUser();
if (triggered == null) {
logger.info("Unable to get triggering info for queued build {} (type={}).", buildId, build.buildTypeId);

if (user == null) {
logger.info("Unable to get username for queued build {} (type={}).", buildId, build.buildTypeId);
continue;
}

continue;
}
User user = build.getTriggered().getUser();

String login = user.username;
if (user == null) {
logger.info("Unable to get username for queued build {} (type={}).", buildId, build.buildTypeId);

if (selfLogin.equalsIgnoreCase(login)) {
final String msg
= MessageFormat.format("Queued build {0} was early triggered " +
"(user {1}, branch {2}, suite {3})." +
" Will not start Ignite build.", buildId, login, chain.tcBranch(), build.buildTypeId);
continue;
}

logger.info(msg);
String login = user.username;

res.append(msg).append("; ");
if (selfLogin.equalsIgnoreCase(login)) {
final String msg
= MessageFormat.format("Queued build {0} was early triggered " +
"(user {1}, branch {2}, suite {3})." +
" Will not start new build.", buildId, login, tcBranch, build.buildTypeId);

trigger = false;
logger.info(msg);

break;
}
return msg;
}
}

if (!trigger)
continue;

long curr = System.currentTimeMillis();
long delay = chain.triggerBuildQuietPeriod();

if (delay > 0) {
Long lastStart = startTimes.get(chain);
long curr = System.currentTimeMillis();
long delay = chain.triggerBuildQuietPeriod();

long minsPassed;
if (delay > 0) {
Long lastStart = startTimes.get(chain);

if (lastStart != null &&
(minsPassed = TimeUnit.MILLISECONDS.toMinutes(curr - lastStart)) < delay) {
long minsPassed;

final String msg = MessageFormat.format("Skip triggering build, timeout has not expired " +
"(server={0}, suite={1}, branch={2}, delay={3} mins, passed={4} mins)",
chain.serverCode(), chain.tcSuiteId(), chain.tcBranch(),
chain.triggerBuildQuietPeriod(), minsPassed);
logger.info(msg);
if (lastStart != null &&
(minsPassed = TimeUnit.MILLISECONDS.toMinutes(curr - lastStart)) < delay) {

res.append(msg).append("; ");
final String msg = MessageFormat.format("Skip triggering build, timeout has not expired " +
"(server={0}, suite={1}, branch={2}, delay={3} mins, passed={4} mins)",
serverCode, buildTypeId, tcBranch,
chain.triggerBuildQuietPeriod(), minsPassed);
logger.info(msg);

continue;
}
return msg;
}
}

startTimes.put(chain, curr);

tcIgn.triggerBuild(chain.tcSuiteId(), chain.tcBranch(), true, false,
chain.generateBuildParameters());
startTimes.put(chain, curr);

res.append(chain.tcBranch()).append(" ").append(chain.tcBranch()).append(" triggered; ");
}
tcIgn.triggerBuild(buildTypeId, tcBranch, true, false, chain.generateBuildParameters());

return res.toString();
return buildTypeId + " " + tcBranch + " triggered; ";
}

/**
@@ -53,10 +53,10 @@
{text: 'Suites', value: 'suitesSummary'},
{text: "Commits", value: 'blameCandidateSummary'},
{text: "Issues", value: 'cntissues'},
{text: "Fixed", value: 'fixedissues'},
{text: "Fixed", value: 'cntfixedissues'},
{text: "Ignored", value: 'cntignoredissues'},
{text: "Not Fixed", value: 'cntfailingissues'},
{text: "Unclear", value: 'unclearissues'}
{text: "Unclear", value: 'cntunclearissues'}
]
},
methods: {
@@ -197,7 +197,14 @@
</td>

<td>{{ issue.issueType }}</td>
<td>{{ issue.name }}</td>
<td>
<a v-if="issue.webUrl != null" :href="issue.webUrl">
{{ issue.name }}
</a>
<span v-else>
{{ issue.name }}
</span>
</td>
</tr>
</table>

@@ -220,20 +227,26 @@
<template v-slot:item.cntIssues="{ item }">
{{ item.cntIssues }}
</template>
<template v-slot:item.fixedIssues="{ item }">
<span class='visaStage' style="background: #12AD5E" v-if="item.fixedIssues!=null" > {{ item.fixedIssues }} </span>
<template v-slot:item.cntFixedIssues="{ item }">
<span class='visaStage' style="background: #12AD5E"
v-if="item.cntFixedIssues!=0"
:title="item.summaryFixedIssues"> {{ item.cntFixedIssues }} </span>
</template>
<template v-slot:item.cntIgnoredIssues="{ item }">
<span class='visaStage' style="background: darkorange"
v-if="item.cntIgnoredIssues!=0"
:title="item.summaryIgnoredIssues"> {{ item.cntIgnoredIssues }} </span>
</template>
<template v-slot:item.cntFailingIssues="{ item }" >
<span class='visaStage' style="background: red" v-if="item.cntFailingIssues!=0" :title="item.summaryFailingIssues"> {{ item.cntFailingIssues }} </span>
<span class='visaStage' style="background: red"
v-if="item.cntFailingIssues!=0"
:title="item.summaryFailingIssues"> {{ item.cntFailingIssues }} </span>
</template>

<template v-slot:item.unclearIssues="{ item }" >
<span class='visaStage' style="background: grey" v-if="item.unclearIssues!=null" > {{ item.unclearIssues }} </span>
<template v-slot:item.cntUnclearIssues="{ item }" >
<span class='visaStage' style="background: grey"
v-if="item.cntUnclearIssues!=0"
:title="item.summaryUnclearIssues" > {{ item.cntUnclearIssues }} </span>
</template>

</v-data-table>
@@ -198,7 +198,7 @@ function showMenu(menuData) {
function authorizeServer() {
$.ajax({
type: "POST",
url: "rest/user/authorize",
url: "/rest/user/authorize",
success: resetMenu,
error: showErrInLoadStatus
});
@@ -131,12 +131,21 @@ function showChainCurrentStatusData(chain, settings) {

if (isDefinedAndFilled(findGetParameter("suiteId")))
parentSuitId = findGetParameter("suiteId");
else if (isDefinedAndFilled(chain))
parentSuitId = findGetParameter("buildTypeId", chain.webToHist);

if (isDefinedAndFilled(parentSuitId)) {
res += "<tr><td><b> Suite: </b></td><td>[" + parentSuitId + "] ";
res += " <a href='" + chain.webToHist + "'>[TC history]</a>";
else if (isDefinedAndFilled(chain.suiteId))
parentSuitId = chain.suiteId;

if (isDefinedAndFilled(parentSuitId) || isDefinedAndFilled(chain.webToHist)) {
res += "<tr><td>";
if (isDefinedAndFilled(parentSuitId)) {
res += "<b> Suite: </b></td>" +
"<td>[" + parentSuitId + "] ";
}
if (isDefinedAndFilled(chain.webToHist)) {
res += " <a href='" + chain.webToHist + "' title='Chain history'>[TC history]</a>";
}
if (isDefinedAndFilled(chain.webToBuild)) {
res += " <a href='" + chain.webToBuild + "' title='Build without applying re-runs'>[Build]</a>";
}
res += "</td></tr>";
}

@@ -155,9 +164,6 @@ function showChainCurrentStatusData(chain, settings) {
res += "empty";

res += " ";
res += "<a href='longRunningTestsReport.html'>";
res += "Long running tests report";
res += "</a>";

var moreInfoTxt = "";

0 comments on commit e2c8ab9

Please sign in to comment.