Create and close release milestones when creating release versions/closing release versions.
Closes #37
This commit is contained in:
@@ -29,11 +29,13 @@ import java.util.stream.StreamSupport;
|
|||||||
|
|
||||||
import org.springframework.data.release.CliComponent;
|
import org.springframework.data.release.CliComponent;
|
||||||
import org.springframework.data.release.TimedCommand;
|
import org.springframework.data.release.TimedCommand;
|
||||||
|
import org.springframework.data.release.model.Module;
|
||||||
import org.springframework.data.release.model.ModuleIteration;
|
import org.springframework.data.release.model.ModuleIteration;
|
||||||
import org.springframework.data.release.model.Project;
|
import org.springframework.data.release.model.Project;
|
||||||
import org.springframework.data.release.model.Projects;
|
import org.springframework.data.release.model.Projects;
|
||||||
import org.springframework.data.release.model.TrainIteration;
|
import org.springframework.data.release.model.TrainIteration;
|
||||||
import org.springframework.data.release.utils.ExecutionUtils;
|
import org.springframework.data.release.utils.ExecutionUtils;
|
||||||
|
import org.springframework.data.util.Streamable;
|
||||||
import org.springframework.plugin.core.PluginRegistry;
|
import org.springframework.plugin.core.PluginRegistry;
|
||||||
import org.springframework.shell.core.annotation.CliCommand;
|
import org.springframework.shell.core.annotation.CliCommand;
|
||||||
import org.springframework.shell.core.annotation.CliOption;
|
import org.springframework.shell.core.annotation.CliOption;
|
||||||
@@ -115,7 +117,7 @@ public class IssueTrackerCommands extends TimedCommand {
|
|||||||
|
|
||||||
@CliCommand(value = "tracker create releaseversions")
|
@CliCommand(value = "tracker create releaseversions")
|
||||||
public void jiraCreateReleaseVersions(@CliOption(key = "", mandatory = true) TrainIteration iteration) {
|
public void jiraCreateReleaseVersions(@CliOption(key = "", mandatory = true) TrainIteration iteration) {
|
||||||
run(executor, iteration, module -> getTrackerFor(module).createReleaseVersion(module));
|
run(executor, withReleaseProject(iteration), module -> getTrackerFor(module).createReleaseVersion(module));
|
||||||
}
|
}
|
||||||
|
|
||||||
@CliCommand(value = "tracker create releasetickets")
|
@CliCommand(value = "tracker create releasetickets")
|
||||||
@@ -188,7 +190,7 @@ public class IssueTrackerCommands extends TimedCommand {
|
|||||||
|
|
||||||
@CliCommand("tracker close")
|
@CliCommand("tracker close")
|
||||||
public void closeIteration(@CliOption(key = "", mandatory = true) TrainIteration iteration) {
|
public void closeIteration(@CliOption(key = "", mandatory = true) TrainIteration iteration) {
|
||||||
run(executor, iteration, module -> getTrackerFor(module).closeIteration(module));
|
run(executor, withReleaseProject(iteration), module -> getTrackerFor(module).closeIteration(module));
|
||||||
}
|
}
|
||||||
|
|
||||||
@CliCommand("tracker archive")
|
@CliCommand("tracker archive")
|
||||||
@@ -196,6 +198,11 @@ public class IssueTrackerCommands extends TimedCommand {
|
|||||||
run(executor, iteration, module -> getTrackerFor(module).archiveReleaseVersion(module));
|
run(executor, iteration, module -> getTrackerFor(module).archiveReleaseVersion(module));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static Streamable<ModuleIteration> withReleaseProject(TrainIteration iteration) {
|
||||||
|
ModuleIteration bom = iteration.getModule(Projects.BOM);
|
||||||
|
return iteration.and(new ModuleIteration(new Module(Projects.RELEASE, bom.getVersion()), iteration));
|
||||||
|
}
|
||||||
|
|
||||||
private IssueTracker getTrackerFor(ModuleIteration moduleIteration) {
|
private IssueTracker getTrackerFor(ModuleIteration moduleIteration) {
|
||||||
|
|
||||||
return tracker.getRequiredPluginFor(moduleIteration.getProject(),
|
return tracker.getRequiredPluginFor(moduleIteration.getProject(),
|
||||||
|
|||||||
@@ -465,7 +465,9 @@ public class GitHub extends GitHubSupport implements IssueTracker {
|
|||||||
|
|
||||||
// - if no next version exists, create
|
// - if no next version exists, create
|
||||||
|
|
||||||
closeReleaseTicket(module);
|
if (getTicketsFor(module).hasReleaseTicket(module)) {
|
||||||
|
closeReleaseTicket(module);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -41,6 +41,7 @@ class GithubMilestone {
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return module.getMediumVersionString();
|
return module.getProject().isUseShortVersionMilestones() ? module.getReleaseVersionString()
|
||||||
|
: module.getMediumVersionString();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -37,6 +37,9 @@ public class Module implements VersionAware, ProjectAware, Comparable<Module> {
|
|||||||
this(project, version, null);
|
this(project, version, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Module(Project project, Version version) {
|
||||||
|
this(project, version, null);
|
||||||
|
}
|
||||||
|
|
||||||
Module(Project project, String version, String customFirstIteration) {
|
Module(Project project, String version, String customFirstIteration) {
|
||||||
|
|
||||||
|
|||||||
@@ -116,7 +116,7 @@ public class ModuleIteration implements IterationVersion, ProjectAware {
|
|||||||
if (getTrain().usesCalver()) {
|
if (getTrain().usesCalver()) {
|
||||||
builder.append(trainIteration.getName());
|
builder.append(trainIteration.getName());
|
||||||
} else {
|
} else {
|
||||||
builder.append(trainIteration.toString());
|
builder.append(trainIteration);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
builder.append(" ").append(iteration.getName()).append(" (");
|
builder.append(" ").append(iteration.getName()).append(" (");
|
||||||
|
|||||||
@@ -44,19 +44,22 @@ public class Project implements Comparable<Project> {
|
|||||||
private final @Getter Tracker tracker;
|
private final @Getter Tracker tracker;
|
||||||
private final @With ArtifactCoordinates additionalArtifacts;
|
private final @With ArtifactCoordinates additionalArtifacts;
|
||||||
private final @With boolean skipTests;
|
private final @With boolean skipTests;
|
||||||
|
private final @Getter @With boolean useShortVersionMilestones; // use a short version 2.3.0-RC1 instead of 2.3 RC1 if
|
||||||
|
// true
|
||||||
|
|
||||||
Project(String key, String name, Tracker tracker) {
|
Project(String key, String name, Tracker tracker) {
|
||||||
this(key, name, null, tracker);
|
this(key, name, null, tracker);
|
||||||
}
|
}
|
||||||
|
|
||||||
private Project(String key, String name, String fullName, Tracker tracker) {
|
private Project(String key, String name, String fullName, Tracker tracker) {
|
||||||
this(new ProjectKey(key), name, fullName, Collections.emptySet(), tracker, ArtifactCoordinates.SPRING_DATA, true);
|
this(new ProjectKey(key), name, fullName, Collections.emptySet(), tracker, ArtifactCoordinates.SPRING_DATA, true,
|
||||||
|
false);
|
||||||
}
|
}
|
||||||
|
|
||||||
@java.beans.ConstructorProperties({ "key", "name", "fullName", "dependencies", "tracker", "additionalArtifacts",
|
@java.beans.ConstructorProperties({ "key", "name", "fullName", "dependencies", "tracker", "additionalArtifacts",
|
||||||
"skipTests" })
|
"skipTests", "plainVersionMilestones" })
|
||||||
private Project(ProjectKey key, String name, String fullName, Collection<Project> dependencies, Tracker tracker,
|
private Project(ProjectKey key, String name, String fullName, Collection<Project> dependencies, Tracker tracker,
|
||||||
ArtifactCoordinates additionalArtifacts, boolean skipTests) {
|
ArtifactCoordinates additionalArtifacts, boolean skipTests, boolean useShortVersionMilestones) {
|
||||||
|
|
||||||
this.key = key;
|
this.key = key;
|
||||||
this.name = name;
|
this.name = name;
|
||||||
@@ -65,6 +68,7 @@ public class Project implements Comparable<Project> {
|
|||||||
this.tracker = tracker;
|
this.tracker = tracker;
|
||||||
this.additionalArtifacts = additionalArtifacts;
|
this.additionalArtifacts = additionalArtifacts;
|
||||||
this.skipTests = skipTests;
|
this.skipTests = skipTests;
|
||||||
|
this.useShortVersionMilestones = useShortVersionMilestones;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean uses(Tracker tracker) {
|
public boolean uses(Tracker tracker) {
|
||||||
@@ -105,8 +109,8 @@ public class Project implements Comparable<Project> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public Project withDependencies(Project... project) {
|
public Project withDependencies(Project... project) {
|
||||||
|
return new Project(key, name, fullName, Arrays.asList(project), tracker, additionalArtifacts, skipTests,
|
||||||
return new Project(key, name, fullName, Arrays.asList(project), tracker, additionalArtifacts, skipTests);
|
useShortVersionMilestones);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -44,9 +44,12 @@ public class Projects {
|
|||||||
public static final List<Project> PROJECTS;
|
public static final List<Project> PROJECTS;
|
||||||
public static final Project SMOKE_TESTS = new Project("SMOKE_TESTS", "Smoke Tests", Tracker.GITHUB);
|
public static final Project SMOKE_TESTS = new Project("SMOKE_TESTS", "Smoke Tests", Tracker.GITHUB);
|
||||||
|
|
||||||
|
public static final Project RELEASE = new Project("RELEASE", "Release", Tracker.GITHUB)
|
||||||
|
.withUseShortVersionMilestones(true);
|
||||||
|
|
||||||
static {
|
static {
|
||||||
|
|
||||||
BOM = new Project("DATABOM", "BOM", Tracker.GITHUB);
|
BOM = new Project("DATABOM", "BOM", Tracker.GITHUB).withUseShortVersionMilestones(true);
|
||||||
|
|
||||||
BUILD = new Project("DATABUILD", "Build", Tracker.GITHUB) //
|
BUILD = new Project("DATABUILD", "Build", Tracker.GITHUB) //
|
||||||
.withAdditionalArtifacts(ArtifactCoordinates.forGroupId("org.springframework.data.build")
|
.withAdditionalArtifacts(ArtifactCoordinates.forGroupId("org.springframework.data.build")
|
||||||
|
|||||||
@@ -23,6 +23,7 @@ import org.springframework.data.release.model.Iteration;
|
|||||||
import org.springframework.data.release.model.ModuleIteration;
|
import org.springframework.data.release.model.ModuleIteration;
|
||||||
import org.springframework.data.release.model.Projects;
|
import org.springframework.data.release.model.Projects;
|
||||||
import org.springframework.data.release.model.ReleaseTrains;
|
import org.springframework.data.release.model.ReleaseTrains;
|
||||||
|
import org.springframework.data.release.model.TrainIteration;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Unit tests for {@link GithubMilestone}.
|
* Unit tests for {@link GithubMilestone}.
|
||||||
@@ -83,6 +84,17 @@ class GithubMilestoneUnitTests {
|
|||||||
assertThat(version.getDescription()).isEqualTo("Dijkstra M2");
|
assertThat(version.getDescription()).isEqualTo("Dijkstra M2");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void rendersShortBomAndReleaseMilestoneVersions() {
|
||||||
|
|
||||||
|
TrainIteration iteration = new TrainIteration(ReleaseTrains.ULLMAN, Iteration.SR1);
|
||||||
|
ModuleIteration module = iteration.getModule(Projects.BOM);
|
||||||
|
|
||||||
|
GithubMilestone milestone = new GithubMilestone(module);
|
||||||
|
assertThat(milestone.toMilestone().getTitle()).isEqualTo("2023.0.1");
|
||||||
|
assertThat(milestone.toMilestone().getDescription()).isEqualTo("2023.0.1");
|
||||||
|
}
|
||||||
|
|
||||||
private void assertIterationVersion(Iteration iteration, String expected) {
|
private void assertIterationVersion(Iteration iteration, String expected) {
|
||||||
|
|
||||||
ModuleIteration module = ReleaseTrains.DIJKSTRA.getModuleIteration(Projects.COMMONS, iteration);
|
ModuleIteration module = ReleaseTrains.DIJKSTRA.getModuleIteration(Projects.COMMONS, iteration);
|
||||||
|
|||||||
@@ -45,4 +45,5 @@ class ModuleIterationUnitTests {
|
|||||||
assertThat(module.getMediumVersionString()).isEqualTo("1.6.1 (Dijkstra SR1)");
|
assertThat(module.getMediumVersionString()).isEqualTo("1.6.1 (Dijkstra SR1)");
|
||||||
assertThat(module.getFullVersionString()).isEqualTo("1.6.1.RELEASE (Dijkstra SR1)");
|
assertThat(module.getFullVersionString()).isEqualTo("1.6.1.RELEASE (Dijkstra SR1)");
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user