Skip to content

Commit

Permalink
🐛 Fix SpringBootIntegrationBuilder deploy on OCP
Browse files Browse the repository at this point in the history
  • Loading branch information
mcarlett committed Oct 18, 2022
1 parent 23df77c commit e052ce6
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public OpenshiftSpringBootApp(AbstractIntegrationBuilder<?> integrationBuilder)
Path baseDirectory;
if (integrationBuilder instanceof AbstractMavenGitIntegrationBuilder) {
AbstractMavenGitIntegrationBuilder<?> mavenGitIntegrationBuilder = (AbstractMavenGitIntegrationBuilder<?>) integrationBuilder;
baseDirectory = mavenGitApp.getProjectLocation();
baseDirectory = mavenGitApp != null ? mavenGitApp.getProjectLocation() : TestConfiguration.appLocation().resolve(name);
finalName = mavenGitIntegrationBuilder.getFinalName().orElse(getName());
} else {
baseDirectory = TestConfiguration.appLocation().resolve(name);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ public final class SpringBootIntegrationBuilder extends AbstractMavenGitIntegrat

public SpringBootIntegrationBuilder(String integrationName) {
super(integrationName);
withFinalName(integrationName);
}

protected SpringBootIntegrationBuilder self() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,12 @@ public void preDeploy() {
//patch to avoid too characters on OCP resource names
final Model model = Maven.loadPom(pomFile);
model.setArtifactId(model.getArtifactId().replaceAll("camel-example-spring-boot-", "csb-"));

//set final name if present
((AbstractMavenGitIntegrationBuilder) integrationBuilder).getFinalName().ifPresent(finalName -> {
model.getBuild().setFinalName((String) finalName);
});

Maven.writePom(pomFile, model);
}

Expand Down

0 comments on commit e052ce6

Please sign in to comment.