in commit-status-publisher-server/src/main/java/jetbrains/buildServer/commitPublisher/github/ChangeStatusUpdater.java [418:453]
public boolean update(@NotNull BuildRevision revision,
@NotNull BuildPromotion buildPromotion,
@NotNull GitHubChangeState targetStatus,
@NotNull Repository repo,
@NotNull AdditionalTaskInfo additionalTaskInfo,
@NotNull String viewUrl) throws PublisherException {
final RepositoryVersion version = revision.getRepositoryVersion();
SQueuedBuild queuedBuild = buildPromotion.getQueuedBuild();
String buildIdentificator = queuedBuild != null ? "queuedBuildId: " + queuedBuild.getItemId() : "buildPromotionId: " + buildPromotion.getId();
final AtomicBoolean shouldRetry = new AtomicBoolean();
final String hash = resolveCommitHash(version, repo, targetStatus, buildIdentificator, shouldRetry);
if (isHashInvalid(hash, version, revision.getRoot(), buildIdentificator)) {
if (shouldRetry.get()) {
throw new PublisherException("Failed to resolve commit hash for GitHub").setShouldRetry();
}
return false;
}
String compiledMessage = additionalTaskInfo.getComment();
boolean prMergeBranch = !hash.equals(version.getVersion());
try {
myApi.setChangeStatus(
repo.owner(),
repo.repositoryName(),
hash,
targetStatus,
viewUrl,
compiledMessage,
prMergeBranch ? myContext + " - merge" : myContext
);
LOG.debug("Updated GitHub status for hash: " + hash + ", buildId: " + buildPromotion.getAssociatedBuildId() + ", status: " + targetStatus);
} catch (PublisherException | IOException e) {
throw new PublisherException("Commit Status Publisher error. " + e, e);
}
return true;
}