Introduce command to perform an rc-release on a maven central repository.

See #38
This commit is contained in:
Greg L. Turnquist
2023-03-23 17:03:05 -05:00
committed by Mark Paluch
parent 9ae6e3b9f1
commit 2311977d8d
5 changed files with 55 additions and 6 deletions

View File

@@ -55,10 +55,8 @@ A job should have started. Click on the active job, and then click on *Open Blue
|===
* For a Maven central release, go to https://s01.oss.sonatype.org/ and login.
** After logging in, you will find a closed Spring Data Release repository.
** Click the repository and then choose "Release".
* For an artifactory release, the release will already have been staged and promoted, so there is nothing more to do.
* For a Maven central release, if the smoke test has passed, the repository will already have been released, so there is nothing more to do.
* For an Artifactory release, if the smoke test has passed, the release will already have been staged and promoted, so there is nothing more to do.
* 🚥 Continue with `Post-release tasks`
[[post-release]]
@@ -98,7 +96,6 @@ Congratulations 🥳 You completed the release ❤️.
===== Infrastructure requirements
* Ensure you have the credentials for `buildmaster` accounts on https://repo.spring.io.
* Ensure you have the credentials for https://oss.sonatype.org (to deploy and promote GA and service releases, need deployment permissions for `org.springframework.data`) in `settings.xml` for server with id `sonatype`.
Both are available in the Spring/Pivotal Last Pass repository.
@@ -137,7 +134,7 @@ See `application-local.template` for details.
| |`$ release prepare $trainIteration`
| |`$ release conclude $trainIteration`
2+| *Build the release*
|Build the artifacts from tag and push them to the appropriate maven repository |`$ release build $trainIteration`
|Build the artifacts from tag and push them to the appropriate maven repository. Also runs smoke tests, does Sonatype "release" if applicable, and does Artifactory "promote" if applicable. |`$ release build $trainIteration`
|Distribute documentation and static resources from tag |`$ release distribute $trainIteration`
|Push the created commits to GitHub |`$ github push $trainIteration`
|Push new maintenance branches if the release version was a GA release (`X.Y.0` version) |`$ git push $trainIteration.next`

View File

@@ -45,6 +45,7 @@ import org.springframework.util.Assert;
/**
* @author Oliver Gierke
* @author Mark Paluch
* @author Greg Turnquist
*/
@Component
@RequiredArgsConstructor
@@ -162,6 +163,20 @@ public class BuildOperations {
});
}
/**
* Releases a repository of staged artifacts for this {@link ModuleIteration}.
*
* @param iteration
* @param stagingRepository
*/
public void release(ModuleIteration iteration, StagingRepository stagingRepository) {
doWithBuildSystem(iteration, (buildSystem, moduleIteration) -> {
buildSystem.release(stagingRepository);
return null;
});
}
public void buildDocumentation(TrainIteration iteration) {
executor.doWithBuildSystemOrdered(Streamable.of(iteration.getModulesExcept(BOM, COMMONS, BUILD)),
@@ -202,6 +217,10 @@ public class BuildOperations {
logger.log(iteration, "Release: %s", summary);
if (iteration.getIteration().isPublic() && stagingRepository.isPresent()) {
release(module, stagingRepository);
}
return summary.getExecutions().stream().map(BuildExecutor.ExecutionResult::getResult).collect(Collectors.toList());
}

View File

@@ -30,6 +30,7 @@ import org.springframework.plugin.core.Plugin;
*
* @author Oliver Gierke
* @author Mark Paluch
* @author Greg Turnquist
*/
interface BuildSystem extends Plugin<Project> {
@@ -68,6 +69,11 @@ interface BuildSystem extends Plugin<Project> {
*/
void close(StagingRepository stagingRepository);
/**
* Release a remote repository of staged artifacts.
*/
void release(StagingRepository stagingRepository);
<M extends ProjectAware> M triggerBuild(M module);
<M extends ProjectAware> M triggerDocumentationBuild(M module);

View File

@@ -387,6 +387,23 @@ class MavenBuildSystem implements BuildSystem {
logger.log(iteration, "✅ Smoke tests passed. Do not smoke 🚭. It's unhealthy.");
}
/**
* Perform a {@literal nexus-staging:rc-release}.
*/
@Override
public void release(StagingRepository stagingRepository) {
Assert.notNull(stagingRepository, "StagingRepository must not be null");
Assert.isTrue(stagingRepository.isPresent(), "StagingRepository must be present");
CommandLine arguments = CommandLine.of(goal("nexus-staging:rc-release"), //
profile("central"), //
arg("stagingRepositoryId").withValue(stagingRepository.getId()))
.andIf(!ObjectUtils.isEmpty(properties.getSettingsXml()), () -> settingsXml(properties.getSettingsXml()));
mvn.execute(BUILD, arguments);
}
@Override
public <M extends ProjectAware> M triggerDocumentationBuild(M module) {

View File

@@ -46,6 +46,7 @@ import org.springframework.util.Assert;
/**
* @author Oliver Gierke
* @author Greg Turnquist
*/
@CliComponent
@RequiredArgsConstructor
@@ -149,6 +150,15 @@ class ReleaseCommands extends TimedCommand {
}
}
@CliCommand(value = "release repository")
public void repositoryRelease(@CliOption(key = "", mandatory = true) TrainIteration iteration,
@CliOption(key = "stagingRepositoryId", mandatory = true) String stagingRepositoryId) {
if (iteration.getIteration().isPublic()) {
build.release(iteration.getModule(Projects.BUILD), StagingRepository.of(stagingRepositoryId));
}
}
@CliCommand(value = "release build")
public void buildRelease(@CliOption(key = "", mandatory = true) TrainIteration iteration, //
@CliOption(key = "project", mandatory = false) String projectName) {