Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handle RC and milestone calver comparison. #320

Merged
merged 2 commits into from
Dec 3, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2013-2019 the original author or authors.
* Copyright 2013-2024 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -46,6 +46,7 @@ enum ReleaseType {
* version;
*
* @author Marcin Grzejszczak
* @author Olga Maciaszek-Sharma
*/
public class ProjectVersion implements Comparable<ProjectVersion>, Serializable {

Expand Down Expand Up @@ -842,6 +843,9 @@ else if (thisOldTrain) {
else if (thatOldTrain) {
return -1 * compareWithOldTrain(thisVersion, thatVersion);
}
if (thisVersion.major().equals(thatVersion.major())) {
return calVerSuffixComparison(thatVersion);
}
// new train comparison
return thisVersion.compareTo(thatVersion);
}
Expand Down Expand Up @@ -896,6 +900,19 @@ private int letterBasedReleaseTrainComparison(TrainVersionNumber o) {
return thisNumber.compareTo(thatNumber);
}

private int calVerSuffixComparison(ProjectVersion thatVersion) {
// With calVer if this project version doesn't have suffix,
// and the other has suffix, but is not snapshot is when this project version is a GA
// and the other project version is a milestone or RC
if (this.version.assertVersion().suffix.isEmpty()) {
if (!(thatVersion.assertVersion().suffix.isEmpty() || thatVersion.isSnapshot())) {
return 1;
}
}
return this.version.compareTo(thatVersion);

}

}

}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2013-2022 the original author or authors.
* Copyright 2013-2024 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -41,6 +41,7 @@

/**
* @author Marcin Grzejszczak
* @author Olga Maciaszek-Sharma
*/
public class ReleaseTrainContentsUpdaterTests {

Expand Down Expand Up @@ -129,6 +130,24 @@ public void should_update_the_contents_of_wiki_when_release_train_greater() thro
.contains("Updating project page to release train [Edgware.SR7]");
}

@Test
public void should_update_the_contents_of_wiki_on_GA_when_previous_release_RC() throws GitAPIException, IOException {
this.properties.getMetaRelease().setEnabled(true);
this.properties.getGit().setUpdateReleaseTrainWiki(true);
this.properties.getGit()
.setReleaseTrainWikiUrl(this.wikiRepo.getAbsolutePath() + "/");

File file = this.updater.updateReleaseTrainWiki(newGACalver());

BDDAssertions.then(file).isNotNull();
BDDAssertions.then(calverWithRCWikiEntryContent(file)).contains("# 2024.0.0")
.contains(
"Spring Cloud Consul `4.2.0` ([issues](https://github.com/spring-cloud/spring-cloud-consul/releases/tag/v4.2.0))");
BDDAssertions.then(GitTestUtils.openGitProject(file).log().call().iterator()
.next().getShortMessage())
.contains("Updating project page to release train [2024.0.0]");
}

@Test
public void should_generate_the_contents_of_wiki_when_release_train_missing() throws GitAPIException, IOException {
this.properties.getMetaRelease().setEnabled(true);
Expand Down Expand Up @@ -172,6 +191,10 @@ private String calverWikiEntryContent(File file) throws IOException {
return string(file, "Spring-Cloud-2020.0-Release-Notes.md");
}

private String calverWithRCWikiEntryContent(File file) throws IOException {
return string(file, "Spring-Cloud-2024.0-Release-Notes.md");
}

private String string(File file, String s) throws IOException {
return new String(Files.readAllBytes(new File(file, s).toPath()));
}
Expand Down Expand Up @@ -272,4 +295,27 @@ Projects freshNewReleaseTrainCalver() {
new ProjectVersion("spring-cloud-function", "1.0.0.RELEASE"));
}

Projects newGACalver() {
return new Projects(
new ProjectVersion("spring-cloud-bus", "4.2.0"),
new ProjectVersion("spring-cloud-commons", "4.2.0"),
new ProjectVersion("spring-cloud-contract", "4.2.0"),
new ProjectVersion("spring-cloud-config", "4.2.0"),
new ProjectVersion("spring-cloud-consul", "4.2.0"),
new ProjectVersion("spring-cloud-netflix", "4.2.0"),
new ProjectVersion("spring-cloud-consul", "4.2.0"),
new ProjectVersion("spring-cloud-stream", "4.2.0"),
new ProjectVersion("spring-cloud-zookeeper", "4.2.0"),
new ProjectVersion("spring-boot", "3.4.0"),
new ProjectVersion("spring-cloud-task", "3.2.0"),
// newer release train, current version in file is 2024.0.0-RC1
new ProjectVersion("spring-cloud-release", "2024.0.0"),
new ProjectVersion("spring-cloud-vault", "4.2.0"),
new ProjectVersion("spring-cloud-gateway", "4.2.0"),
new ProjectVersion("spring-cloud-openfeign", "4.2.0"),
new ProjectVersion("spring-cloud-circuitbreaker", "3.2.0"),
new ProjectVersion("spring-cloud-kubernetes", "3.2.0"),
new ProjectVersion("spring-cloud-function", "4.2.0"));
}

}
Original file line number Diff line number Diff line change
@@ -1,12 +1,28 @@
Spring Cloud provides tools for developers to quickly build some of the common patterns in distributed systems (e.g. configuration management, service discovery, circuit breakers, intelligent routing, micro-proxy, control bus, one-time tokens, global locks, leadership election, distributed sessions, cluster state).
Coordination of distributed systems leads to boiler plate patterns, and using Spring Cloud developers can quickly stand up services and applications that implement those patterns.
They will work well in any distributed environment, including the developer's own laptop, bare metal data centres, and managed platforms such as Cloud Foundry.
# NOTICE

This wiki is no longer updated and is here for historical purposes.

Please see
https://github.com/spring-cloud/spring-cloud-release/wiki for up to date information.

---

Spring Cloud provides tools for developers to quickly build some of
the common patterns in distributed systems (e.g. configuration
management, service discovery, circuit breakers, intelligent routing,
micro-proxy, control bus, one-time tokens, global locks, leadership
election, distributed sessions, cluster state). Coordination of
distributed systems leads to boiler plate patterns, and using Spring
Cloud developers can quickly stand up services and applications that
implement those patterns. They will work well in any distributed
environment, including the developer's own laptop, bare metal data
centres, and managed platforms such as Cloud Foundry.

See https://projects.spring.io/spring-cloud[projects.spring.io/spring-cloud] for details.

== Release Notes

See the following release notes for upgrade instructions and "new and noteworthy" features:
See the following release notes for upgrade instructions and "new and noteworthy" features (newer release trains at the end):

- link:Spring-Cloud-Angel-Release-Notes[Angel]

Expand All @@ -18,4 +34,10 @@ See the following release notes for upgrade instructions and "new and noteworthy

- link:Spring-Cloud-Edgware-Release-Notes[Edgware]

- link:Spring-Cloud-Finchley-Release-Notes[Finchley]
- link:Spring-Cloud-Finchley-Release-Notes[Finchley]

- link:Spring-Cloud-Greenwich-Release-Notes[Greenwich]

- link:https://github.com/spring-cloud/spring-cloud-release/wiki/Spring-Cloud-Hoxton-Release-Notes[Hoxton]

- link:https://github.com/spring-cloud/spring-cloud-release/wiki/Spring-Cloud-2020.0-Release-Notes[2020.0 (code name ilford)]
Loading
Loading