@@ -55,14 +55,11 @@ See `application-local.template` for details.
|
||||
| Build the artefacts and push them to the apropriate maven repository | `$ release build $trainIteration` |
|
||||
| |`$ release conclude $trainIteration` |
|
||||
| Push the created commits to GitHub |`$ github push $trainIteration` |
|
||||
| Backport changes to the backlog to other versions. | `$ git backport changelog $trainIteration --target $targets` |
|
||||
| Push the changes of the backlog to GitHub. For each `target` from above do |`$ git push $target` |
|
||||
| **Distribute documentation and static resources from tags** ||
|
||||
||`$ release distribute $trainIteration`|
|
||||
| **Post-release tasks** ||
|
||||
|Close JIRA tickets and GitHub release tickets.|`$ tracker close $trainIteration`|
|
||||
|Create new release versions for upcoming version|`$ tracker create releaseversions $trainIteration.next`|
|
||||
|Create new release tickets in GitHub |`$ tracker create releasetickets $trainIteration.next`|
|
||||
|Create new release versions and tickets for upcoming version|`$ tracker setup-next $trainIteration.next`|
|
||||
| Update versions in Sagan. `$targets` is given as comma separated lists of code names, without spaces. E.g. `Moore,Neumann` | `$ sagan update $releasetrains`|
|
||||
| Create list of docs for release announcements | `$ announcement $trainIteration`|
|
||||
| Announce release (Blog, Twitter) and notify downstream dependency projects as needed. | N.A. |
|
||||
|
||||
@@ -75,7 +75,6 @@ class ReleaseCommands extends TimedCommand {
|
||||
|
||||
build.runPreReleaseChecks(iteration);
|
||||
|
||||
misc.prepareChangelogs(iteration);
|
||||
misc.updateResources(iteration);
|
||||
build.updateProjectDescriptors(iteration, Phase.PREPARE);
|
||||
git.commit(iteration, "Prepare %s.");
|
||||
|
||||
@@ -19,12 +19,10 @@ import lombok.NonNull;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
import java.util.concurrent.Executor;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
import org.springframework.data.release.CliComponent;
|
||||
import org.springframework.data.release.TimedCommand;
|
||||
@@ -168,17 +166,6 @@ class GitCommands extends TimedCommand {
|
||||
git.removeTags(iteration);
|
||||
}
|
||||
|
||||
@CliCommand("git backport changelog")
|
||||
public void backportChangelogs(@CliOption(key = "", mandatory = true) TrainIteration iteration, //
|
||||
@CliOption(key = "target") String trains) {
|
||||
|
||||
List<Train> targets = trains == null ? Collections.emptyList() : Stream.of(trains.split(",")).//
|
||||
map(it -> ReleaseTrains.getTrainByName(it)).//
|
||||
collect(Collectors.toList());
|
||||
|
||||
git.backportChangelogs(iteration, targets);
|
||||
}
|
||||
|
||||
/**
|
||||
* List the branches with their tickets of the git repository.
|
||||
*
|
||||
|
||||
@@ -780,39 +780,6 @@ public class GitOperations {
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Back-ports the change log created for the given {@link TrainIteration} to the given release {@link Train}s. If the
|
||||
* {@link TrainIteration} is a service iteration itself, the {@code main} branch will become an additional port
|
||||
* target.
|
||||
*
|
||||
* @param iteration must not be {@literal null}.
|
||||
* @param targets must not be {@literal null}.
|
||||
*/
|
||||
public void backportChangelogs(TrainIteration iteration, List<Train> targets) {
|
||||
|
||||
Assert.notNull(iteration, "Train iteration must not be null!");
|
||||
Assert.notNull(targets, "Target trains must not be null!");
|
||||
|
||||
ExecutionUtils.run(executor, iteration, module -> {
|
||||
|
||||
BackportTargets backportTargets = new BackportTargets(module, targets);
|
||||
Project project = module.getProject();
|
||||
|
||||
doWithGit(project, git -> {
|
||||
|
||||
checkout(project, backportTargets.getSource());
|
||||
Optional<ObjectId> objectId = getChangelogUpdate(module);
|
||||
|
||||
objectId.ifPresent(it -> backportTargets.forEach(target -> cherryPickCommitToBranch(it, project, target)));
|
||||
|
||||
if (!objectId.isPresent()) {
|
||||
logger.log(project, "No changelog commit found, skipping backports!");
|
||||
}
|
||||
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Verify general Git operations.
|
||||
*/
|
||||
@@ -885,10 +852,6 @@ public class GitOperations {
|
||||
return findRequiredCommit(module, "Release");
|
||||
}
|
||||
|
||||
private Optional<ObjectId> getChangelogUpdate(ModuleIteration module) {
|
||||
return findCommit(module, "Updated changelog");
|
||||
}
|
||||
|
||||
private ObjectId findRequiredCommit(ModuleIteration module, String summary) {
|
||||
|
||||
Predicate<RevCommit> trigger = calculateFilter(module, summary);
|
||||
|
||||
@@ -17,32 +17,12 @@ package org.springframework.data.release.misc;
|
||||
|
||||
import lombok.RequiredArgsConstructor;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.ExecutorService;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import org.springframework.data.release.git.GitOperations;
|
||||
import org.springframework.data.release.io.Workspace;
|
||||
import org.springframework.data.release.issues.Changelog;
|
||||
import org.springframework.data.release.issues.IssueTracker;
|
||||
import org.springframework.data.release.issues.Ticket;
|
||||
import org.springframework.data.release.issues.TicketReference;
|
||||
import org.springframework.data.release.issues.Tickets;
|
||||
import org.springframework.data.release.model.Iteration;
|
||||
import org.springframework.data.release.model.ModuleIteration;
|
||||
import org.springframework.data.release.model.Project;
|
||||
import org.springframework.data.release.model.Train;
|
||||
import org.springframework.data.release.model.TrainIteration;
|
||||
import org.springframework.data.release.utils.ExecutionUtils;
|
||||
import org.springframework.data.release.utils.Logger;
|
||||
import org.springframework.plugin.core.PluginRegistry;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.util.Assert;
|
||||
|
||||
/**
|
||||
* @author Oliver Gierke
|
||||
@@ -52,80 +32,8 @@ import org.springframework.util.Assert;
|
||||
@RequiredArgsConstructor
|
||||
public class ReleaseOperations {
|
||||
|
||||
private static final Set<String> CHANGELOG_LOCATIONS;
|
||||
|
||||
static {
|
||||
|
||||
Set<String> locations = new HashSet<>();
|
||||
locations.add("src/main/resources/changelog.txt"); // for Maven projects
|
||||
locations.add("docs/src/info/changelog.txt"); // for Gradle projects
|
||||
|
||||
CHANGELOG_LOCATIONS = Collections.unmodifiableSet(locations);
|
||||
}
|
||||
|
||||
private final PluginRegistry<IssueTracker, Project> trackers;
|
||||
private final Workspace workspace;
|
||||
private final GitOperations git;
|
||||
private final Logger logger;
|
||||
private final ExecutorService executorService;
|
||||
|
||||
/**
|
||||
* Creates {@link Changelog} instances for all modules of the given {@link Train} and {@link Iteration}.
|
||||
*
|
||||
* @param iteration must not be {@literal null}.
|
||||
*/
|
||||
public void prepareChangelogs(TrainIteration iteration) {
|
||||
|
||||
Assert.notNull(iteration, "Iteration must not be null!");
|
||||
|
||||
TrainIteration previousIteration = git.getPreviousIteration(iteration);
|
||||
|
||||
ExecutionUtils.run(executorService, iteration,
|
||||
moduleIteration -> prepareChangelog(iteration, previousIteration, moduleIteration));
|
||||
}
|
||||
|
||||
protected void prepareChangelog(TrainIteration iteration, TrainIteration previousIteration, ModuleIteration module) {
|
||||
|
||||
IssueTracker issueTracker = trackers.getRequiredPluginFor(module.getProject(),
|
||||
() -> String.format("No issue tracker found for project %s!", module.getProject()));
|
||||
|
||||
Changelog changelog = getChangelog(iteration, previousIteration, module, issueTracker);
|
||||
|
||||
for (String location : CHANGELOG_LOCATIONS) {
|
||||
|
||||
boolean processed = workspace.processFile(location, module.getProject(), (line, number) -> {
|
||||
|
||||
if (line.startsWith("=")) {
|
||||
|
||||
StringBuilder builder = new StringBuilder();
|
||||
builder.append(line).append("\n\n");
|
||||
builder.append(changelog.toString());
|
||||
|
||||
return Optional.of(builder.toString());
|
||||
} else {
|
||||
return Optional.of(line);
|
||||
}
|
||||
});
|
||||
|
||||
if (processed) {
|
||||
|
||||
git.commit(module, "Updated changelog.");
|
||||
|
||||
logger.log(module.getProject(), "Updated changelog %s.", location);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected Changelog getChangelog(TrainIteration iteration, TrainIteration previousIteration, ModuleIteration module,
|
||||
IssueTracker issueTracker) {
|
||||
|
||||
List<String> ticketIds = git.getTicketReferencesBetween(module.getProject(), previousIteration, iteration).stream()
|
||||
.map(TicketReference::getId).collect(Collectors.toList());
|
||||
|
||||
List<Ticket> tickets = new ArrayList<>(issueTracker.findTickets(module, ticketIds).getTickets());
|
||||
|
||||
return Changelog.of(module, new Tickets(tickets));
|
||||
}
|
||||
|
||||
public void updateResources(TrainIteration iteration) {
|
||||
|
||||
|
||||
Reference in New Issue
Block a user