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/03/07 17:17:22 UTC
[ignite-teamcity-bot] branch master updated: IGNITE-11491 Display
build GitHub Commit for the finished build (#113)
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 3e12562 IGNITE-11491 Display build GitHub Commit for the finished build (#113)
3e12562 is described below
commit 3e12562109002715116c8dd72405ec37774fcf35
Author: Dmitriy Pavlov <dp...@apache.org>
AuthorDate: Thu Mar 7 20:17:18 2019 +0300
IGNITE-11491 Display build GitHub Commit for the finished build (#113)
---
.../org/apache/ignite/ci/github/PullRequest.java | 3 ++-
.../ci/tcbot/visa/ContributionCheckStatus.java | 3 +++
.../tcbot/visa/TcBotTriggerAndSignOffService.java | 25 ++++++++++++++++++++++
.../teamcity/ignited/change/ChangeCompacted.java | 7 ++++++
.../ignited/fatbuild/FatBuildCompacted.java | 2 +-
ignite-tc-helper-web/src/main/webapp/js/prs-1.1.js | 11 ++++++++--
6 files changed, 47 insertions(+), 4 deletions(-)
diff --git a/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/github/PullRequest.java b/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/github/PullRequest.java
index 1a52921..75c04cd 100644
--- a/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/github/PullRequest.java
+++ b/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/github/PullRequest.java
@@ -31,6 +31,7 @@ import org.jetbrains.annotations.Nullable;
@Persisted
public class PullRequest implements IVersionedEntity {
public static final String OPEN = "open";
+ public static final int INCLUDE_SHORT_VER = 7;
/** Latest version. */
private static final int LATEST_VERSION = 7;
@@ -162,6 +163,6 @@ public class PullRequest implements IVersionedEntity {
@Nullable public String lastCommitShaShort() {
String sha = head().sha();
- return Strings.isNullOrEmpty(sha) ? null : sha.substring(0, 7);
+ return Strings.isNullOrEmpty(sha) ? null : sha.substring(0, INCLUDE_SHORT_VER);
}
}
diff --git a/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/tcbot/visa/ContributionCheckStatus.java b/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/tcbot/visa/ContributionCheckStatus.java
index 078a4f9..1f86394 100644
--- a/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/tcbot/visa/ContributionCheckStatus.java
+++ b/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/tcbot/visa/ContributionCheckStatus.java
@@ -36,6 +36,9 @@ import java.util.List;
/** Branch with finished/cancelled suite results, null if suite is running or in case there was no run suite at all. */
public String branchWithFinishedSuite;
+ /** Finished suite commit hash short. */
+ public String finishedSuiteCommit;
+
/** Suite finished for brach {@link #branchWithFinishedSuite}. Determines trigger button color. */
public Boolean suiteIsFinished;
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 aca9cfb..e539678 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
@@ -60,6 +60,7 @@ 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.teamcity.ignited.change.ChangeCompacted;
import org.apache.ignite.ci.teamcity.ignited.fatbuild.FatBuildCompacted;
import org.apache.ignite.ci.user.ICredentialsProv;
import org.apache.ignite.ci.web.model.ContributionKey;
@@ -604,9 +605,33 @@ public class TcBotTriggerAndSignOffService {
status.suiteIsFinished = !buildRefCompacted.isCancelled(compactor);
status.branchWithFinishedSuite = buildRefCompacted.branchName(compactor);
+
+ FatBuildCompacted fatBuild = teamcity.getFatBuild(buildRefCompacted.id(), SyncMode.NONE);
+
+ int changeMax = -1;
+ int[] changes = fatBuild.changes();
+ for (int i = 0; i < changes.length; i++) {
+ int change = changes[i];
+ if (change > changeMax)
+ changeMax = change;
+ }
+
+ if (changeMax > 0) {
+ final Collection<ChangeCompacted> allChanges = teamcity.getAllChanges(new int[] {changeMax});
+ allChanges.stream().findAny().ifPresent(
+ compacted -> {
+ String commit = compacted.commitFullVersion();
+ if (!Strings.isNullOrEmpty(commit)) {
+ status.finishedSuiteCommit
+ = commit.substring(0, PullRequest.INCLUDE_SHORT_VER).toLowerCase();
+ }
+ }
+ );
+ }
}
else {
status.branchWithFinishedSuite = null;
+ status.finishedSuiteCommit = null;
status.suiteIsFinished = false;
}
diff --git a/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/teamcity/ignited/change/ChangeCompacted.java b/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/teamcity/ignited/change/ChangeCompacted.java
index e1ddd24..d582102 100644
--- a/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/teamcity/ignited/change/ChangeCompacted.java
+++ b/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/teamcity/ignited/change/ChangeCompacted.java
@@ -142,4 +142,11 @@ public class ChangeCompacted implements IVersionedEntity {
@Override public int hashCode() {
return Objects.hashCode(_ver, id, vcsUsername, tcUserId, tcUserUsername, tcUserFullname, version, date);
}
+
+ /**
+ *
+ */
+ public String commitFullVersion() {
+ return DatatypeConverter.printHexBinary(version);
+ }
}
diff --git a/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/teamcity/ignited/fatbuild/FatBuildCompacted.java b/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/teamcity/ignited/fatbuild/FatBuildCompacted.java
index 360310e..8606a71 100644
--- a/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/teamcity/ignited/fatbuild/FatBuildCompacted.java
+++ b/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/teamcity/ignited/fatbuild/FatBuildCompacted.java
@@ -47,7 +47,7 @@ import java.util.stream.Collectors;
import java.util.stream.Stream;
/**
- *
+ * Composed data from {@link Build} and other classes, compressed for storage.
*/
@Persisted
public class FatBuildCompacted extends BuildRefCompacted implements IVersionedEntity {
diff --git a/ignite-tc-helper-web/src/main/webapp/js/prs-1.1.js b/ignite-tc-helper-web/src/main/webapp/js/prs-1.1.js
index 28c93a1..924efcf 100644
--- a/ignite-tc-helper-web/src/main/webapp/js/prs-1.1.js
+++ b/ignite-tc-helper-web/src/main/webapp/js/prs-1.1.js
@@ -404,8 +404,15 @@ function showContributionStatus(status, prId, row, srvId, suiteIdSelected) {
if (buildIsCompleted) {
let finishedBranch = status.branchWithFinishedSuite;
- tdForPr.html("<a id='showReportlink_" + prId + "' href='" + prShowHref(srvId, suiteIdSelected, finishedBranch) + "'>" +
- "<button id='show_" + prId + "'>Show " + finishedBranch + " report</button></a>");
+ let reportLink = "<a id='showReportlink_" + prId + "' href='" + prShowHref(srvId, suiteIdSelected, finishedBranch) + "'>" +
+ "<button id='show_" + prId + "'>Show " + finishedBranch + " report</button>" +
+ "</a>";
+ if(isDefinedAndFilled(status.finishedSuiteCommit)) {
+ reportLink += "<br>(" + status.finishedSuiteCommit + ")";
+ }
+
+
+ tdForPr.html(reportLink);
if (hasJiraIssue) {
let jiraBtn = "<button onclick='" +