Disable further operation if updateSaganForNonSnapshot fails

This commit is contained in:
Oleg Zhurakousky
2020-02-13 13:56:49 +01:00
parent 1b7981c113
commit e7b3c05824

View File

@@ -61,22 +61,24 @@ public class SaganUpdater {
ReleaseUpdate update = releaseUpdate(branch, originalVersion, currentVersion,
projects);
Exception updateReleaseException = updateSaganForNonSnapshot(branch, originalVersion, currentVersion, projects);
log.info("Updating Sagan releases with \n\n{}", update);
Project project = this.saganClient.updateRelease(currentVersion.projectName,
Collections.singletonList(update));
Optional<ProjectVersion> projectVersion = latestVersion(currentVersion, project);
log.info("Found the following latest project version [{}]", projectVersion);
boolean present = projectVersion.isPresent();
if (present && currentVersionNewerOrEqual(currentVersion, projectVersion)) {
updateDocumentationIfNecessary(projectFile, project);
}
else {
log.info(present
? "Latest version [" + projectVersion.get() + "] present and "
+ "the current version [" + currentVersion
+ "] is older than that one. " + "Will do nothing."
: "No latest version found. Will do nothing.");
return ExecutionResult.skipped();
if (updateReleaseException == null) {
log.info("Updating Sagan releases with \n\n{}", update);
Project project = this.saganClient.updateRelease(currentVersion.projectName,
Collections.singletonList(update));
Optional<ProjectVersion> projectVersion = latestVersion(currentVersion, project);
log.info("Found the following latest project version [{}]", projectVersion);
boolean present = projectVersion.isPresent();
if (present && currentVersionNewerOrEqual(currentVersion, projectVersion)) {
updateDocumentationIfNecessary(projectFile, project);
}
else {
log.info(present
? "Latest version [" + projectVersion.get() + "] present and "
+ "the current version [" + currentVersion
+ "] is older than that one. " + "Will do nothing."
: "No latest version found. Will do nothing.");
return ExecutionResult.skipped();
}
}
return updateReleaseException == null ? ExecutionResult.success() : ExecutionResult.unstable(updateReleaseException);
}