Skip to content
Permalink
Browse files
Run All should be default instead of Run All Nightly; automatic selec…
…ting default configuration
  • Loading branch information
dspavlov committed Jul 31, 2019
1 parent 397be32 commit d574430d2bcaee7739e4cb90b0903e4bd6371a50
Showing 5 changed files with 39 additions and 16 deletions.
@@ -51,9 +51,20 @@
/** Web links to queued suites. */
public List<String> webLinksQueuedSuites = new LinkedList<>();

public ContributionCheckStatus() {
/** Default build type. */
public boolean defaultBuildType = false;

/**
* @param suiteId Suite id.
*/
public ContributionCheckStatus(String suiteId) {
this.suiteId = suiteId;
}

/**
* @param suiteId Suite id.
* @param resolvedBranch Resolved branch.
*/
public ContributionCheckStatus(String suiteId, String resolvedBranch) {
this.suiteId = suiteId;
this.resolvedBranch = resolvedBranch;
@@ -577,29 +577,36 @@ private String branchForTcB(String prId) {
}

/**
* @param srvCode Server (service) internal code.
* @param srvCodeOrAlias Server (service) internal code.
* @param prov Prov.
* @param prId Pr id from {@link ContributionToCheck#prNumber}. Negative value imples branch number (with
* appropriate prefix from GH config).
*/
public Set<ContributionCheckStatus> contributionStatuses(String srvCode, ITcBotUserCreds prov,
public Set<ContributionCheckStatus> contributionStatuses(String srvCodeOrAlias, ITcBotUserCreds prov,
String prId) {
Set<ContributionCheckStatus> statuses = new LinkedHashSet<>();

ITeamcityIgnited teamcity = tcIgnitedProv.server(srvCode, prov);
ITeamcityIgnited teamcity = tcIgnitedProv.server(srvCodeOrAlias, prov);

String defaultBuildType = findDefaultBuildType(srvCodeOrAlias);

IGitHubConnIgnited ghConn = gitHubConnIgnitedProvider.server(srvCode);
IGitHubConnIgnited ghConn = gitHubConnIgnitedProvider.server(srvCodeOrAlias);

Preconditions.checkState(ghConn.config().code().equals(srvCode));
Preconditions.checkState(ghConn.config().code().equals(srvCodeOrAlias));

List<String> compositeBuildTypeIds = findApplicableBuildTypes(srvCode, teamcity);
List<String> compositeBuildTypeIds = findApplicableBuildTypes(srvCodeOrAlias, teamcity);

for (String btId : compositeBuildTypeIds) {
List<BuildRefCompacted> buildsForBt = findBuildsForPr(btId, prId, ghConn, teamcity);

statuses.add(buildsForBt.isEmpty()
ContributionCheckStatus contributionAgainstSuite = buildsForBt.isEmpty()
? new ContributionCheckStatus(btId, branchForTcDefault(prId, ghConn))
: contributionStatus(srvCode, btId, buildsForBt, teamcity, ghConn, prId));
: contributionStatus(srvCodeOrAlias, btId, buildsForBt, teamcity, ghConn, prId);

if(Objects.equals(btId, defaultBuildType))
contributionAgainstSuite.defaultBuildType = true;

statuses.add(contributionAgainstSuite);
}

return statuses;
@@ -678,9 +685,7 @@ private String findDefaultBuildType(String srvIdOrAlias) {
*/
public ContributionCheckStatus contributionStatus(String srvId, String suiteId, List<BuildRefCompacted> builds,
ITeamcityIgnited teamcity, IGitHubConnIgnited ghConn, String prId) {
ContributionCheckStatus status = new ContributionCheckStatus();

status.suiteId = suiteId;
ContributionCheckStatus status = new ContributionCheckStatus(suiteId);

List<BuildRefCompacted> finishedOrCancelled = builds.stream()
.filter(t -> t.isFinished(compactor)).collect(Collectors.toList());
@@ -28,7 +28,7 @@
public static final String GITHUB_REF = "https://github.com/apache/ignite-teamcity-bot";

/** TC Bot Version. */
public static final String VERSION = "20190729";
public static final String VERSION = "20190731";

/** Java version, where Web App is running. */
public String javaVer;
@@ -313,19 +313,26 @@ function formatContributionDetails(row, srvId) {
function (result) {
let selectHtml = "<select id='selectChain_" + prId + "' style='width: 350px'>";

let isCompleted = [],
let isDefault = [],
isCompleted = [],
isIncompleted = [],
suites = new Map();

//See also org.apache.ignite.ci.tcbot.visa.ContributionCheckStatus
for (let status of result) {
suites.set(status.suiteId, status);

if (isDefinedAndFilled(status.branchWithFinishedSuite))
if (isDefinedAndFilled(status.defaultBuildType) && status.defaultBuildType === true)
isDefault.push(status);
else if (isDefinedAndFilled(status.branchWithFinishedSuite))
isCompleted.push(status);
else
isIncompleted.push(status);
}

for (let status of isDefault)
selectHtml += "<option value='true' style='font-weight: bold; color: darkblue'>" + status.suiteId + "</option>";

for (let status of isCompleted)
selectHtml += "<option value='true'>" + status.suiteId + "</option>";

@@ -19,7 +19,7 @@

<script src="js/common-1.6.js"></script>
<script src="js/testfails-2.2.js"></script>
<script src="js/prs-1.1.js"></script>
<script src="js/prs-1.2.js"></script>

<style>

0 comments on commit d574430

Please sign in to comment.