Only for snapshots don't we remove previous minor versions; fixes gh-78
This commit is contained in:
@@ -139,7 +139,7 @@ public class Releaser {
|
||||
|
||||
public void updateSpringGuides(ProjectVersion releaseVersion, Projects projects) {
|
||||
if (!(releaseVersion.isRelease() || releaseVersion.isServiceRelease())) {
|
||||
log.info("\nWon't updated Spring Guides for a non Release / Service Release version");
|
||||
log.info("\nWon't update Spring Guides for a non Release / Service Release version");
|
||||
return;
|
||||
}
|
||||
this.projectGitHandler.createIssueInSpringGuides(projects, releaseVersion);
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
package org.springframework.cloud.release.internal.sagan;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
@@ -24,26 +23,28 @@ public class SaganUpdater {
|
||||
|
||||
public void updateSagan(String branch, ProjectVersion originalVersion, ProjectVersion version) {
|
||||
ReleaseUpdate update = releaseUpdate(branch, originalVersion, version);
|
||||
updateSaganForGa(branch, originalVersion, version);
|
||||
updateSaganForNonSnapshot(branch, originalVersion, version);
|
||||
log.info("Updating Sagan with \n\n{}", update);
|
||||
this.saganClient.updateRelease(version.projectName, Collections.singletonList(update));
|
||||
}
|
||||
|
||||
private void updateSaganForGa(String branch, ProjectVersion originalVersion,
|
||||
private void updateSaganForNonSnapshot(String branch, ProjectVersion originalVersion,
|
||||
ProjectVersion version) {
|
||||
if (version.isRelease() || version.isServiceRelease()) {
|
||||
log.info("Version is GA [{}]. Will remove all older versions and mark this as current", version);
|
||||
if (!version.isSnapshot()) {
|
||||
log.info("Version is non snapshot [{}]. Will remove all older versions and mark this as current", version);
|
||||
Project project = this.saganClient.getProject(version.projectName);
|
||||
if (project != null) {
|
||||
removeAllSameMinorVersions(version, project);
|
||||
}
|
||||
String snapshot = toSnapshot(version.version);
|
||||
removeVersionFromSagan(version, snapshot);
|
||||
String bumpedSnapshot = toSnapshot(version.bumpedVersion());
|
||||
ReleaseUpdate snapshotUpdate =
|
||||
releaseUpdate(branch, originalVersion, new ProjectVersion(version.projectName, bumpedSnapshot));
|
||||
log.info("Updating Sagan with \n\n[{}]", snapshotUpdate);
|
||||
this.saganClient.updateRelease(version.projectName, Collections.singletonList(snapshotUpdate));
|
||||
if (version.isRelease() || version.isServiceRelease()) {
|
||||
String bumpedSnapshot = toSnapshot(version.bumpedVersion());
|
||||
ReleaseUpdate snapshotUpdate =
|
||||
releaseUpdate(branch, originalVersion, new ProjectVersion(version.projectName, bumpedSnapshot));
|
||||
log.info("Updating Sagan with bumped snapshot \n\n[{}]", snapshotUpdate);
|
||||
this.saganClient.updateRelease(version.projectName, Collections.singletonList(snapshotUpdate));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -218,8 +218,10 @@ public class AcceptanceTests {
|
||||
.contains("- Spring Cloud Bus `1.3.0.M1` ([issues](http://foo.bar.com/1.3.0.M1))");
|
||||
BDDMockito.then(this.saganClient).should().updateRelease(BDDMockito.eq("spring-cloud-consul"),
|
||||
BDDMockito.anyList());
|
||||
BDDMockito.then(this.saganClient).should(BDDMockito.never()).deleteRelease(
|
||||
BDDMockito.anyString(), BDDMockito.anyString());
|
||||
BDDMockito.then(this.saganClient).should()
|
||||
.deleteRelease("spring-cloud-consul","1.2.0.M8");
|
||||
BDDMockito.then(this.saganClient).should()
|
||||
.deleteRelease("spring-cloud-consul","1.2.0.RC1");
|
||||
// we update guides only for SR / RELEASE
|
||||
then(this.gitHandler.issueCreatedInSpringGuides).isFalse();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user