From e7b3c05824274c5b04c5454a0e56db144e87233d Mon Sep 17 00:00:00 2001 From: Oleg Zhurakousky Date: Thu, 13 Feb 2020 13:56:49 +0100 Subject: [PATCH] Disable further operation if updateSaganForNonSnapshot fails --- .../releaser/internal/sagan/SaganUpdater.java | 34 ++++++++++--------- 1 file changed, 18 insertions(+), 16 deletions(-) diff --git a/releaser-core/src/main/java/releaser/internal/sagan/SaganUpdater.java b/releaser-core/src/main/java/releaser/internal/sagan/SaganUpdater.java index f93dae16..f7ec6c2a 100644 --- a/releaser-core/src/main/java/releaser/internal/sagan/SaganUpdater.java +++ b/releaser-core/src/main/java/releaser/internal/sagan/SaganUpdater.java @@ -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 = 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 = 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); }