Skip to content

Commit

Permalink
Merge pull request #131 from gsmet/adjust-lts
Browse files Browse the repository at this point in the history
Make sure we don't list future LTS for backports
  • Loading branch information
gsmet authored Jul 17, 2024
2 parents 07ff8ae + 195e2d6 commit 1f1c144
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 9 deletions.
10 changes: 2 additions & 8 deletions src/main/java/io/quarkus/bot/release/step/CreateBranch.java
Original file line number Diff line number Diff line change
Expand Up @@ -265,15 +265,9 @@ private static String getBranchEmail(ReleaseInformation releaseInformation, Stri
+ "\n"
+ "- for anything required in " + releaseInformation.getBranch() + " (currently open pull requests included), please add the " + Labels.BACKPORT_LABEL + " label\n";

if (!Branches.LTS_BRANCHES.contains(previousMinorBranch)) {
email += "- for fixes we also want in future " + previousMinorBranch + ", please add the " + Labels.backportForVersion(previousMinorBranch) + " label\n";
}

for (String ltsBranch : Branches.LTS_BRANCHES) {
if (ltsBranch.equals(releaseInformation.getBranch())) {
continue;
}
email += "- for fixes we also want in future " + previousMinorBranch + ", please add the " + Labels.backportForVersion(previousMinorBranch) + " label\n";

for (String ltsBranch : Branches.getLtsVersionsReleasedBefore(previousMinorBranch).reversed()) {
// 2.13 is not an official LTS so we have to special case it
email += "- for fixes we also want in future " + ltsBranch
+ (Branches.BRANCH_2_13.equals(ltsBranch) ? "" : " LTS") + ", please add the " + Labels.backportForVersion(ltsBranch)
Expand Down
18 changes: 17 additions & 1 deletion src/main/java/io/quarkus/bot/release/util/Branches.java
Original file line number Diff line number Diff line change
@@ -1,13 +1,18 @@
package io.quarkus.bot.release.util;

import java.util.List;
import java.util.Set;
import java.util.TreeSet;
import java.util.stream.Collectors;

import org.apache.maven.artifact.versioning.ComparableVersion;

import io.quarkus.bot.release.ReleaseInformation;

public class Branches {

public static final String MAIN = "main";
public static final List<String> LTS_BRANCHES = List.of("3.15", "3.8", "3.2", "2.13");
private static final List<String> LTS_BRANCHES = List.of("3.15", "3.8", "3.2", "2.13");
public static final String BRANCH_2_13 = "2.13";

public static String getPlatformPreparationBranch(ReleaseInformation releaseInformation) {
Expand All @@ -33,6 +38,17 @@ public static boolean isLts(String branch) {
return LTS_BRANCHES.contains(branch);
}

public static List<String> getLtsVersionsReleasedBefore(String version) {
ComparableVersion comparableVersion = new ComparableVersion(version);

return LTS_BRANCHES.stream()
.map(v -> new ComparableVersion(v))
.filter(lts -> lts.compareTo(comparableVersion) < 0)
.sorted()
.map(v -> v.toString())
.toList();
}

private Branches() {
}
}
10 changes: 10 additions & 0 deletions src/test/java/io/quarkus/bot/release/BranchesTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -43,4 +43,14 @@ void testLts() {
assertThat(Branches.isLts("3.8")).isTrue();
assertThat(Branches.isLts("3.9")).isFalse();
}

@Test
void testGetLtsVersionsReleasedBefore() {
assertThat(Branches.getLtsVersionsReleasedBefore("3.1")).containsExactly("2.13");
assertThat(Branches.getLtsVersionsReleasedBefore("3.2")).containsExactly("2.13");
assertThat(Branches.getLtsVersionsReleasedBefore("3.3")).containsExactly("2.13", "3.2");
assertThat(Branches.getLtsVersionsReleasedBefore("3.8")).containsExactly("2.13", "3.2");
assertThat(Branches.getLtsVersionsReleasedBefore("3.9")).containsExactly("2.13", "3.2", "3.8");
assertThat(Branches.getLtsVersionsReleasedBefore("3.16")).containsExactly("2.13", "3.2", "3.8", "3.15");
}
}

0 comments on commit 1f1c144

Please sign in to comment.