From 1e7cb5d7f253f8c55cd835feee69f662cc2ff5f3 Mon Sep 17 00:00:00 2001 From: Mark Paluch Date: Fri, 14 Feb 2025 15:59:16 +0100 Subject: [PATCH] Add spring-enterprise profile to commercial builds. --- ci/build-and-distribute.template | 1 + .../data/release/build/MavenBuildSystem.java | 17 +++++++++++------ .../deployment/ArtifactoryCommands.java | 18 +++++++++++++----- 3 files changed, 25 insertions(+), 11 deletions(-) diff --git a/ci/build-and-distribute.template b/ci/build-and-distribute.template index 0989a8c..0f91d5a 100755 --- a/ci/build-and-distribute.template +++ b/ci/build-and-distribute.template @@ -1,5 +1,6 @@ workspace cleanup git update ${VERSION} release build ${VERSION} +artifactory release create ${VERSION} release distribute ${VERSION} quit diff --git a/src/main/java/org/springframework/data/release/build/MavenBuildSystem.java b/src/main/java/org/springframework/data/release/build/MavenBuildSystem.java index ea05943..a2065dd 100644 --- a/src/main/java/org/springframework/data/release/build/MavenBuildSystem.java +++ b/src/main/java/org/springframework/data/release/build/MavenBuildSystem.java @@ -182,17 +182,20 @@ class MavenBuildSystem implements BuildSystem { if (BOM.equals(module.getProject())) { mvn.execute(project, goals.and(arg("newVersion").withValue(information.getReleaseTrainVersion())) // - .and(arg("generateBackupPoms").withValue("false"))); + .and(arg("generateBackupPoms").withValue("false")) // + .andIf(module.isCommercial(), profile("spring-enterprise"))); mvn.execute(project, goals.and(arg("newVersion").withValue(information.getReleaseTrainVersion())) // .and(arg("generateBackupPoms").withValue("false")) // .and(arg("processAllModules").withValue("true")) // - .and(Argument.of("-pl").withValue("bom"))); + .and(Argument.of("-pl").withValue("bom")) // + .andIf(module.isCommercial(), profile("spring-enterprise"))); } else { mvn.execute(project, goals.and(arg("newVersion").withValue(information.getProjectVersionToSet(project.getProject()))) - .and(arg("generateBackupPoms").withValue("false"))); + .and(arg("generateBackupPoms").withValue("false")) // + .andIf(module.isCommercial(), profile("spring-enterprise"))); } if (BUILD.equals(module.getProject())) { @@ -201,10 +204,11 @@ class MavenBuildSystem implements BuildSystem { mvn.execute(project, goals.and(arg("newVersion").withValue(information.getReleaseTrainVersion())) // .and(arg("generateBackupPoms").withValue("false")) // .and(arg("groupId").withValue("org.springframework.data")) // - .and(arg("artifactId").withValue("spring-data-releasetrain"))); + .and(arg("artifactId").withValue("spring-data-releasetrain")) // + .andIf(module.isCommercial(), profile("spring-enterprise"))); } - mvn.execute(project, CommandLine.of(Goal.INSTALL)); + mvn.execute(project, CommandLine.of(Goal.INSTALL).andIf(module.isCommercial(), profile("spring-enterprise"))); } return module; @@ -277,8 +281,9 @@ class MavenBuildSystem implements BuildSystem { @Override public M triggerBuild(M module) { + Argument profile = module.isCommercial() ? profile("ci,release,spring-enterprise") : profile("ci,release"); CommandLine arguments = CommandLine.of(Goal.CLEAN, Goal.INSTALL, // - profile("ci,release"), // + profile, // arg("gpg.executable").withValue(gpg.getExecutable()), // arg("gpg.keyname").withValue(gpg.getKeyname()), // arg("gpg.passphrase").withValue(gpg.getPassphrase()))// diff --git a/src/main/java/org/springframework/data/release/deployment/ArtifactoryCommands.java b/src/main/java/org/springframework/data/release/deployment/ArtifactoryCommands.java index 351ca82..bf60d9b 100644 --- a/src/main/java/org/springframework/data/release/deployment/ArtifactoryCommands.java +++ b/src/main/java/org/springframework/data/release/deployment/ArtifactoryCommands.java @@ -26,6 +26,7 @@ import org.springframework.data.release.TimedCommand; import org.springframework.data.release.model.ModuleIteration; import org.springframework.data.release.model.SupportStatus; import org.springframework.data.release.model.TrainIteration; +import org.springframework.data.release.utils.Logger; import org.springframework.shell.core.annotation.CliCommand; import org.springframework.shell.core.annotation.CliOption; @@ -40,6 +41,7 @@ class ArtifactoryCommands extends TimedCommand { private final @NonNull DeploymentOperations deployment; private final @NonNull ArtifactoryOperations operations; + private final @NonNull Logger log; @CliCommand(value = "artifactory verify", help = "Verifies authentication at Artifactory.") public void verify() { @@ -51,17 +53,23 @@ class ArtifactoryCommands extends TimedCommand { @SneakyThrows public void createArtifactoryReleases(@CliOption(key = "", mandatory = true) TrainIteration trainIteration) { - for (ModuleIteration moduleIteration : trainIteration) { - operations.createArtifactoryRelease(moduleIteration); - } + if (trainIteration.isCommercial()) { - // aggregator creation requires a bit of time + log.log(trainIteration, "Creating Artifactory Release bundle"); + + for (ModuleIteration moduleIteration : trainIteration) { + operations.createArtifactoryRelease(moduleIteration); + } + + // aggregator creation requires a bit of time // otherwise we will see 16:19:04 "message" : "Release Bundle path not found: // spring-release-bundles-v2/TNZ-spring-data-rest-commercial/4.0.15/release-bundle.json.evd" Thread.sleep(2000); operations.createArtifactoryReleaseAggregator(trainIteration); - + } else { + log.log(trainIteration, "Skipping Artifactory Release bundle creation, not a commercial release"); + } } @CliCommand(value = "artifactory release distribute")