#4 - First draft of marking versions as released.
JIRA implementation. Fails currently as the server complains about the user not being a project admin (which is not the case).
This commit is contained in:
@@ -111,4 +111,11 @@ public interface IssueTracker extends Plugin<Project> {
|
|||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
Changelog getChangelogFor(ModuleIteration module);
|
Changelog getChangelogFor(ModuleIteration module);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Closes the given {@link ModuleIteration}.
|
||||||
|
*
|
||||||
|
* @param module must not be {@literal null}.
|
||||||
|
*/
|
||||||
|
void closeIteration(ModuleIteration module);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -106,6 +106,11 @@ class IssueTrackerCommands extends TimedCommand {
|
|||||||
stream().map(it -> it.toString()).collect(Collectors.joining("\n"));
|
stream().map(it -> it.toString()).collect(Collectors.joining("\n"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@CliCommand("tracker close")
|
||||||
|
public void closeIteration(@CliOption(key = "", mandatory = true) TrainIteration iteration) {
|
||||||
|
iteration.forEach(module -> getTrackerFor(module).closeIteration(module));
|
||||||
|
}
|
||||||
|
|
||||||
private Changelog getChangelog(ModuleIteration module) {
|
private Changelog getChangelog(ModuleIteration module) {
|
||||||
return getTrackerFor(module).getChangelogFor(module);
|
return getTrackerFor(module).getChangelogFor(module);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -326,6 +326,15 @@ class GitHub implements IssueTracker {
|
|||||||
return Optional.empty();
|
return Optional.empty();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* (non-Javadoc)
|
||||||
|
* @see org.springframework.data.release.issues.IssueTracker#closeIteration(org.springframework.data.release.model.ModuleIteration)
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public void closeIteration(ModuleIteration module) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
private Tickets getTicketsFor(ModuleIteration moduleIteration, boolean forCurrentUser) {
|
private Tickets getTicketsFor(ModuleIteration moduleIteration, boolean forCurrentUser) {
|
||||||
|
|
||||||
return getIssuesFor(moduleIteration, forCurrentUser).//
|
return getIssuesFor(moduleIteration, forCurrentUser).//
|
||||||
|
|||||||
@@ -63,6 +63,7 @@ class Jira implements JiraConnector {
|
|||||||
private static final String PROJECT_VERSIONS_TEMPLATE = BASE_URI + "/project/{project}/version?startAt={startAt}";
|
private static final String PROJECT_VERSIONS_TEMPLATE = BASE_URI + "/project/{project}/version?startAt={startAt}";
|
||||||
private static final String PROJECT_COMPONENTS_TEMPLATE = BASE_URI + "/project/{project}/components";
|
private static final String PROJECT_COMPONENTS_TEMPLATE = BASE_URI + "/project/{project}/components";
|
||||||
private static final String VERSIONS_TEMPLATE = BASE_URI + "/version";
|
private static final String VERSIONS_TEMPLATE = BASE_URI + "/version";
|
||||||
|
private static final String VERSION_TEMPLATE = BASE_URI + "/version/{id}";
|
||||||
private static final String SEARCH_TEMPLATE = BASE_URI + "/search?jql={jql}&fields={fields}&startAt={startAt}";
|
private static final String SEARCH_TEMPLATE = BASE_URI + "/search?jql={jql}&fields={fields}&startAt={startAt}";
|
||||||
|
|
||||||
public static final String INFRASTRUCTURE_COMPONENT_NAME = "Infrastructure";
|
public static final String INFRASTRUCTURE_COMPONENT_NAME = "Infrastructure";
|
||||||
@@ -354,7 +355,7 @@ class Jira implements JiraConnector {
|
|||||||
* @see org.springframework.data.release.jira.JiraConnector#closeIteration(org.springframework.data.release.model.Train, org.springframework.data.release.model.Iteration)
|
* @see org.springframework.data.release.jira.JiraConnector#closeIteration(org.springframework.data.release.model.Train, org.springframework.data.release.model.Iteration)
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void closeIteration(TrainIteration iteration) {
|
public void closeIteration(ModuleIteration module) {
|
||||||
|
|
||||||
// for each module
|
// for each module
|
||||||
|
|
||||||
@@ -364,6 +365,19 @@ class Jira implements JiraConnector {
|
|||||||
// -- close tickets
|
// -- close tickets
|
||||||
|
|
||||||
// - mark version as releases
|
// - mark version as releases
|
||||||
|
|
||||||
|
findJiraReleaseVersion(module).//
|
||||||
|
map(JiraReleaseVersion::markReleased).//
|
||||||
|
ifPresent(version -> {
|
||||||
|
|
||||||
|
logger.log(module, "Marking version %s as released.", version);
|
||||||
|
|
||||||
|
Map<String, Object> parameters = newUrlTemplateVariables();
|
||||||
|
parameters.put("id", version.getId());
|
||||||
|
|
||||||
|
operations.put(VERSION_TEMPLATE, version, parameters);
|
||||||
|
});
|
||||||
|
|
||||||
// - if no next version exists, create
|
// - if no next version exists, create
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -36,13 +36,6 @@ interface JiraConnector extends IssueTracker {
|
|||||||
*/
|
*/
|
||||||
void verifyBeforeRelease(TrainIteration iteration);
|
void verifyBeforeRelease(TrainIteration iteration);
|
||||||
|
|
||||||
/**
|
|
||||||
* Closes the given {@link TrainIteration}.
|
|
||||||
*
|
|
||||||
* @param iteration must not be {@literal null}.
|
|
||||||
*/
|
|
||||||
void closeIteration(TrainIteration iteration);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Lookup a JIRA release version.
|
* Lookup a JIRA release version.
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -30,6 +30,7 @@ import org.springframework.util.Assert;
|
|||||||
class JiraReleaseVersion {
|
class JiraReleaseVersion {
|
||||||
|
|
||||||
String id, name, project, description;
|
String id, name, project, description;
|
||||||
|
boolean released;
|
||||||
|
|
||||||
public static JiraReleaseVersion of(ModuleIteration moduleIteration, JiraVersion jiraVersion) {
|
public static JiraReleaseVersion of(ModuleIteration moduleIteration, JiraVersion jiraVersion) {
|
||||||
|
|
||||||
@@ -37,7 +38,11 @@ class JiraReleaseVersion {
|
|||||||
Assert.notNull(jiraVersion, "JiraVersion must not be null.");
|
Assert.notNull(jiraVersion, "JiraVersion must not be null.");
|
||||||
|
|
||||||
return new JiraReleaseVersion(null, jiraVersion.toString(), moduleIteration.getProjectKey().getKey(),
|
return new JiraReleaseVersion(null, jiraVersion.toString(), moduleIteration.getProjectKey().getKey(),
|
||||||
jiraVersion.getDescription());
|
jiraVersion.getDescription(), false);
|
||||||
|
}
|
||||||
|
|
||||||
|
public JiraReleaseVersion markReleased() {
|
||||||
|
return new JiraReleaseVersion(id, name, project, description, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean hasSameNameAs(JiraVersion jiraVersion) {
|
public boolean hasSameNameAs(JiraVersion jiraVersion) {
|
||||||
|
|||||||
Reference in New Issue
Block a user