Updates for new sagain api, s-c-build 3.1 and boot 2.6 (#243)

Updates releaser to use spring cloud build 3.1.0

Transitively uses boot 2.6

Updates releaser to use new Sagan API

Fixes gh-196
Fixes gh-194
This commit is contained in:
Spencer Gibb
2022-02-18 14:29:17 -05:00
committed by GitHub
parent 2e7d318f13
commit e83cda4fed
195 changed files with 2914 additions and 4881 deletions

View File

@@ -27,8 +27,7 @@ import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication
public class ReleaserApplication extends ReleaserCommandLineRunner {
public ReleaserApplication(SpringReleaser releaser,
ExecutionResultHandler executionResultHandler, Parser parser) {
public ReleaserApplication(SpringReleaser releaser, ExecutionResultHandler executionResultHandler, Parser parser) {
super(releaser, executionResultHandler, parser);
}

View File

@@ -24,8 +24,7 @@ final class SpringCloudBomConstants {
// boot
static final String SPRING_BOOT = "spring-boot";
static final String BOOT_STARTER_ARTIFACT_ID = "spring-boot-starter";
static final String BOOT_STARTER_PARENT_ARTIFACT_ID = BOOT_STARTER_ARTIFACT_ID
+ "-parent";
static final String BOOT_STARTER_PARENT_ARTIFACT_ID = BOOT_STARTER_ARTIFACT_ID + "-parent";
static final String BOOT_DEPENDENCIES_ARTIFACT_ID = "spring-boot-dependencies";
// sc-build

View File

@@ -51,17 +51,15 @@ import static releaser.cloud.buildsystem.SpringCloudBomConstants.STREAM_STARTER_
class SpringCloudStreamMavenBomParser implements CustomBomParser {
private static final Logger log = LoggerFactory
.getLogger(SpringCloudStreamMavenBomParser.class);
private static final Logger log = LoggerFactory.getLogger(SpringCloudStreamMavenBomParser.class);
@Override
public VersionsFromBom parseBom(File root, ReleaserProperties properties) {
VersionsFromBom springCloudBuild = springCloudBuild(root, properties);
VersionsFromBom boot = bootVersion(root, properties);
log.debug("Added Spring Cloud Build [{}] and boot versions [{}]",
springCloudBuild, boot);
return new VersionsFromBomBuilder().thisProjectRoot(root)
.releaserProperties(properties).projects(springCloudBuild, boot).merged();
log.debug("Added Spring Cloud Build [{}] and boot versions [{}]", springCloudBuild, boot);
return new VersionsFromBomBuilder().thisProjectRoot(root).releaserProperties(properties)
.projects(springCloudBuild, boot).merged();
}
private VersionsFromBom springCloudBuild(File root, ReleaserProperties properties) {
@@ -69,8 +67,8 @@ class SpringCloudStreamMavenBomParser implements CustomBomParser {
if (StringUtils.isEmpty(buildVersion)) {
return VersionsFromBom.EMPTY_VERSION;
}
VersionsFromBom scBuild = new VersionsFromBomBuilder().thisProjectRoot(root)
.releaserProperties(properties).merged();
VersionsFromBom scBuild = new VersionsFromBomBuilder().thisProjectRoot(root).releaserProperties(properties)
.merged();
scBuild.add(BUILD_ARTIFACT_ID, buildVersion);
scBuild.add(CLOUD_DEPENDENCIES_PARENT_ARTIFACT_ID, buildVersion);
return scBuild;
@@ -87,11 +85,9 @@ class SpringCloudStreamMavenBomParser implements CustomBomParser {
}
Model model = PomReader.pom(root, properties.getPom().getThisTrainBom());
String buildArtifact = model.getParent().getArtifactId();
log.debug("[{}] artifact id is equal to [{}]",
CLOUD_DEPENDENCIES_PARENT_ARTIFACT_ID, buildArtifact);
log.debug("[{}] artifact id is equal to [{}]", CLOUD_DEPENDENCIES_PARENT_ARTIFACT_ID, buildArtifact);
if (!CLOUD_DEPENDENCIES_PARENT_ARTIFACT_ID.equals(buildArtifact)) {
throw new IllegalStateException(
"The pom doesn't have a [spring-cloud-dependencies-parent] artifact id");
throw new IllegalStateException("The pom doesn't have a [spring-cloud-dependencies-parent] artifact id");
}
buildVersion = model.getParent().getVersion();
log.debug("Spring Cloud Build version is equal to [{}]", buildVersion);
@@ -103,8 +99,7 @@ class SpringCloudStreamMavenBomParser implements CustomBomParser {
if (StringUtils.hasText(bootVersion)) {
return bootVersion;
}
String pomWithBootStarterParent = properties.getPom()
.getPomWithBootStarterParent();
String pomWithBootStarterParent = properties.getPom().getPomWithBootStarterParent();
File pom = new File(root, pomWithBootStarterParent);
if (!pom.exists()) {
return "";
@@ -117,8 +112,8 @@ class SpringCloudStreamMavenBomParser implements CustomBomParser {
log.debug("Boot artifact id is equal to [{}]", bootArtifactId);
if (!BOOT_STARTER_PARENT_ARTIFACT_ID.equals(bootArtifactId)) {
if (log.isDebugEnabled()) {
throw new IllegalStateException("The pom doesn't have a ["
+ BOOT_STARTER_PARENT_ARTIFACT_ID + "] artifact id");
throw new IllegalStateException(
"The pom doesn't have a [" + BOOT_STARTER_PARENT_ARTIFACT_ID + "] artifact id");
}
return "";
}
@@ -131,8 +126,8 @@ class SpringCloudStreamMavenBomParser implements CustomBomParser {
return VersionsFromBom.EMPTY_VERSION;
}
log.debug("Boot version is equal to [{}]", bootVersion);
VersionsFromBom versionsFromBom = new VersionsFromBomBuilder()
.thisProjectRoot(root).releaserProperties(properties).merged();
VersionsFromBom versionsFromBom = new VersionsFromBomBuilder().thisProjectRoot(root)
.releaserProperties(properties).merged();
versionsFromBom.add(SPRING_BOOT, bootVersion);
versionsFromBom.add(BOOT_STARTER_PARENT_ARTIFACT_ID, bootVersion);
versionsFromBom.add(BOOT_DEPENDENCIES_ARTIFACT_ID, bootVersion);
@@ -140,8 +135,7 @@ class SpringCloudStreamMavenBomParser implements CustomBomParser {
}
@Override
public Set<Project> setVersion(Set<Project> projects, String projectName,
String version) {
public Set<Project> setVersion(Set<Project> projects, String projectName, String version) {
Set<Project> newProjects = new LinkedHashSet<>(projects);
switch (projectName) {
case SPRING_BOOT:

View File

@@ -27,8 +27,7 @@ import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
@SpringBootTest(
classes = { ReleaserApplicationTests.Config.class, ReleaserApplication.class },
@SpringBootTest(classes = { ReleaserApplicationTests.Config.class, ReleaserApplication.class },
properties = { "releaser.sagan.update-sagan=false" })
class ReleaserApplicationTests {