in commit-status-publisher-server/src/main/java/jetbrains/buildServer/commitPublisher/github/GitHubPublisher.java [253:288]
private boolean updateQueuedBuildStatus(@NotNull BuildPromotion buildPromotion, @NotNull BuildRevision revision,
@NotNull AdditionalTaskInfo additionalTaskInfo, boolean addingToQueue) throws PublisherException {
Map<String, String> params;
try {
params = getParams(buildPromotion);
} catch (GitHubContextResolveException e) {
SBuildType buildType = buildPromotion.getBuildType();
LOG.debug(String.format("Custom GitHub context for build type \"%s\" contains variables that can be not resolved. Status won't be published",
buildType != null ? buildType.getFullName() : buildPromotion.getBuildTypeId()));
return false;
}
final ChangeStatusUpdater.Handler h = myUpdater.getHandler(revision.getRoot(), params, this);
if (!revision.getRoot().getVcsName().equals("jetbrains.git")) {
LOG.warn("No revisions were found to update GitHub status. Please check you have Git VCS roots in the build configuration");
return false;
}
String viewUrl = getViewUrl(additionalTaskInfo.isPromotionReplaced() ? additionalTaskInfo.getReplacingPromotion() : buildPromotion);
if (viewUrl == null) {
LOG.debug(String.format("Can not build view URL for the build #%d. Probadly build configuration was removed. Status won't be published",
buildPromotion.getId()));
return false;
}
boolean statusUpdated;
if (addingToQueue) {
statusUpdated = h.changeQueued(revision, buildPromotion, additionalTaskInfo, viewUrl);
} else {
statusUpdated = h.changeRemovedFromQueue(revision, buildPromotion, additionalTaskInfo, viewUrl);
}
if (statusUpdated) {
String context = params.get(Constants.GITHUB_CONTEXT);
myStatusesCache.removeStatusFromCache(revision, context);
}
return statusUpdated;
}