#24 - Improved release steps.

Updating versions back to development ones is now contained in the conclude step. GitOperations does less pulls now to make sure we don't accidentally drop local commits. The step to create maintenance branches now uses the module version explicitly to create a branch with the right name.
This commit is contained in:
Oliver Gierke
2016-04-06 22:03:13 +02:00
parent 4d07a1c37f
commit 27db3a1b8a
3 changed files with 39 additions and 21 deletions

View File

@@ -107,9 +107,6 @@ class ReleaseCommands extends TimedCommand {
List<DeploymentInformation> deploymentInformation = build.performRelease(iteration);
deploymentInformation.forEach(deployment::promote);
build.prepareVersions(iteration, Phase.CLEANUP);
git.commit(iteration, "Prepare next development iteration.");
}
}
@@ -124,22 +121,31 @@ class ReleaseCommands extends TimedCommand {
Assert.notNull(iteration, "Train iteration must not be null!");
// Tag release
git.tagRelease(iteration);
build.prepareVersions(iteration, Phase.CLEANUP);
git.commit(iteration, "Prepare next development iteration.");
// Prepare master branch
build.updateProjectDescriptors(iteration, Phase.CLEANUP);
git.commit(iteration, "After release cleanups.");
// Tag release
git.tagRelease(iteration);
// Prepare maintenance branches
if (iteration.getIteration().isGAIteration()) {
// Create bugfix branches
git.createMaintenanceBranches(iteration);
build.updateProjectDescriptors(iteration, Phase.MAINTENANCE);
// Set project version to maintenance once
build.prepareVersions(iteration, Phase.MAINTENANCE);
git.commit(iteration, "Prepare next development iteration.");
// Update inter-project dependencies and repositories
build.updateProjectDescriptors(iteration, Phase.MAINTENANCE);
git.commit(iteration, "After release cleanups.");
// Back to master branch
git.checkout(iteration);
}
}

View File

@@ -59,7 +59,7 @@ public class Branch implements Comparable<Branch> {
return from(versioned.getVersion());
}
private static Branch from(Version version) {
public static Branch from(Version version) {
return from(version.toString().concat(".x"));
}

View File

@@ -148,8 +148,6 @@ public class GitOperations {
Assert.notNull(iteration, "Train iteration must not be null!");
update(iteration.getTrain());
ExecutionUtils.run(iteration, module -> {
Project project = module.getProject();
@@ -319,23 +317,23 @@ public class GitOperations {
});
}
/**
* Tags the release commits for the given {@link TrainIteration}.
*
* @param iteration
*/
public void tagRelease(TrainIteration iteration) {
Assert.notNull(iteration, "Train iteration must not be null!");
ExecutionUtils.run(iteration, module -> {
Branch branch = Branch.from(module);
Project project = module.getProject();
ObjectId hash = getReleaseHash(module);
Tag tag = getTags(project).createTag(module);
doWithGit(project, git -> {
checkout(project, branch);
logger.log(module, "git pull", branch);
git.pull().call();
ObjectId hash = getReleaseHash(module);
Tag tag = getTags(project).createTag(module);
try (RevWalk walk = new RevWalk(git.getRepository())) {
RevCommit commit = walk.parseCommit(hash);
@@ -423,11 +421,11 @@ public class GitOperations {
}
/**
* Checks out the given {@link Branch} of the given {@link Project}.
* Checks out the given {@link Branch} of the given {@link Project}. If the given branch doesn't exist yet, a tracking
* branch is created assuming the branch exists in the {@code origin} remote.
*
* @param project must not be {@literal null}.
* @param branch must not be {@literal null}.
* @throws Exception
*/
public void checkout(Project project, Branch branch) {
@@ -462,9 +460,14 @@ public class GitOperations {
public void createMaintenanceBranches(TrainIteration iteration) {
if (!iteration.getIteration().isGAIteration()) {
return;
}
checkout(iteration);
ExecutionUtils.run(iteration, module -> {
Branch branch = createMaintenanceBranch(module);
checkout(module.getProject(), branch);
});
@@ -539,11 +542,20 @@ public class GitOperations {
});
}
/**
* Creates a version branch for the given {@link ModuleIteration}.
*
* @param module must not be {@literal null}.
* @return
*/
private Branch createMaintenanceBranch(ModuleIteration module) {
Branch branch = Branch.from(module);
Assert.notNull(module, "Module iteration must not be null!");
Branch branch = Branch.from(module.getVersion());
doWithGit(module.getProject(), git -> {
logger.log(module, "git checkout -b %s", branch);
git.branchCreate().setName(branch.toString()).call();
});