Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WAIT-FOR-BRANCH] Remove JIB plugin from apps generator. #595

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -138,39 +138,18 @@
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
{{#app.bootPluginConfiguration}}
<configuration>
<image>
<name>{{app.containerImage.orgName}}/${project.artifactId}:{{app.containerImage.tag}}</name>
</image>
<!-- extra configuration -->
{{#app.bootPluginConfiguration}}
{{this}}
{{/app.bootPluginConfiguration}}
<!-- (end) extra configuration -->
</configuration>
{{/app.bootPluginConfiguration}}
</plugin>

<plugin>
<groupId>com.google.cloud.tools</groupId>
<artifactId>jib-maven-plugin</artifactId>
<version>3.3.0</version>
<configuration>
<from>
<image>{{app.containerImage.baseImage}}</image>
</from>
<to>
<image>{{app.containerImage.orgName}}/${project.artifactId}:{{app.containerImage.tag}}</image>
</to>
<container>
<creationTime>USE_CURRENT_TIMESTAMP</creationTime>
<format>{{app.containerImage.format}}</format>
{{#app.containerImage.enableMetadata}}
<labels>
<org.springframework.cloud.dataflow.spring-configuration-metadata.json>
${org.springframework.cloud.dataflow.spring.configuration.metadata.json}
</org.springframework.cloud.dataflow.spring-configuration-metadata.json>
<application.name>${project.artifactId}</application.name>
<application.version>${project.version}</application.version>
</labels>
{{/app.containerImage.enableMetadata}}
</container>
</configuration>
</plugin>

{{#app.containerImage.enableMetadata}}
<!--
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,15 +78,6 @@
<url>https://repo.spring.io/libs-snapshot-local;buildName=${buildName};buildNumber=${buildNumber}</url>
</snapshotRepository>
</distributionManagement>
<build>
<plugins>
<plugin>
<groupId>com.google.cloud.tools</groupId>
<artifactId>jib-maven-plugin</artifactId>
<version>3.3.0</version>
</plugin>
</plugins>
</build>
<profiles>
<profile>
<id>milestone</id>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ void httpSourceAppsGeneration() throws Exception {

Parent parent = pomModel.getParent();
assertThat(parent.getArtifactId()).isEqualTo("spring-boot-starter-parent");
assertThat(parent.getVersion()).isEqualTo("3.3.0.M3");
assertThat(parent.getVersion()).isEqualTo("3.3.6");
assertThat(pomModel.getArtifactId()).isEqualTo("http-source-kafka");
assertThat(pomModel.getGroupId()).isEqualTo("org.springframework.cloud.stream.app.test");
assertThat(pomModel.getName()).isEqualTo("http-source-kafka");
Expand All @@ -93,15 +93,6 @@ void httpSourceAppsGeneration() throws Exception {
List<Plugin> plugins = pomModel.getBuild().getPlugins();
assertThat(plugins.stream().filter(p -> p.getArtifactId().equals("spring-boot-maven-plugin")).count()).isEqualTo(1);
assertThat(plugins.stream().filter(p -> p.getArtifactId().equals("properties-maven-plugin")).count()).isEqualTo(1);
assertThat(plugins.stream().filter(p -> p.getArtifactId().equals("jib-maven-plugin")).count()).isEqualTo(1);

Plugin jibPlugin = plugins.stream().filter(p -> p.getArtifactId().equals("jib-maven-plugin")).findFirst().get();
assertThat(jibPlugin.getConfiguration().toString())
.contains("<org.springframework.cloud.dataflow.spring-configuration-metadata.json>" +
"${org.springframework.cloud.dataflow.spring.configuration.metadata.json}" +
"</org.springframework.cloud.dataflow.spring-configuration-metadata.json>");
assertThat(jibPlugin.getConfiguration().toString()).contains("<image>testspringcloud/${project.artifactId}:3.0.0.BUILD-SNAPSHOT</image>");
assertThat(jibPlugin.getConfiguration().toString()).contains("<image>globalBaseImage</image>");

assertThat(pomModel.getRepositories().size()).isEqualTo(5);
assertThat(pomModel.getRepositories().stream().map(r -> r.getId()).collect(Collectors.toList()))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ public void prepareForTest() throws NoSuchFieldException {
application.getMaven().getDependencies().add(dep);

// BOM
application.setBootVersion("3.3.0.M3");
application.setBootVersion("3.3.6");
application.getMetadata().setMavenPluginVersion("1.0.2.BUILD-SNAPSHOT");

setMojoProperty("application", application);
Expand Down Expand Up @@ -126,13 +126,6 @@ public void testWithDisabledContainerMetadata() throws Exception {
// The properties-maven-plugin should not be defined if the container metadata is not enabled.
assertThat(plugins.stream().filter(p -> p.getArtifactId().equals("properties-maven-plugin")).count()).isEqualTo(0);

assertThat(plugins.stream().filter(p -> p.getArtifactId().equals("jib-maven-plugin")).count()).isEqualTo(1);

Plugin jibPlugin = plugins.stream().filter(p -> p.getArtifactId().equals("jib-maven-plugin")).findFirst().get();
assertThat(jibPlugin.getConfiguration().toString())
.doesNotContain("<org.springframework.cloud.dataflow.spring-configuration-metadata.json>" +
"${org.springframework.cloud.dataflow.spring.configuration.metadata.json}" +
"</org.springframework.cloud.dataflow.spring-configuration-metadata.json>");
}

@Test
Expand Down Expand Up @@ -166,9 +159,11 @@ public void testCustomBootMavenPluginConfiguration() throws Exception {
assertThat(bootPlugin.isPresent()).isTrue();
final Plugin plugin = bootPlugin.get();
final Xpp3Dom configuration = (Xpp3Dom) plugin.getConfiguration();
assertThat(configuration.getValue().contains("<requiresUnpack>")).isTrue();
assertThat(configuration.getValue().contains("jython-standalone")).isTrue();
assertThat(configuration.getValue().contains("</requiresUnpack>")).isTrue();
assertThat(configuration).isNotNull();
String configurationString = configuration.toString();
assertThat(configurationString).contains("<requiresUnpack>");
assertThat(configurationString).contains("jython-standalone");
assertThat(configurationString).contains("</requiresUnpack>");
}

private void assertGeneratedPomXml(File rootPath) {
Expand All @@ -186,7 +181,7 @@ private void assertGeneratedPomXml(File rootPath) {

Parent parent = pomModel.getParent();
assertThat(parent.getArtifactId()).isEqualTo("spring-boot-starter-parent");
assertThat(parent.getVersion()).isEqualTo("3.3.0.M3");
assertThat(parent.getVersion()).isEqualTo("3.3.6");

assertThat(pomModel.getArtifactId()).isEqualTo("log-sink-kafka");
assertThat(pomModel.getGroupId()).isEqualTo("org.springframework.cloud.stream.app");
Expand All @@ -197,14 +192,6 @@ private void assertGeneratedPomXml(File rootPath) {
List<Plugin> plugins = pomModel.getBuild().getPlugins();
assertThat(plugins.stream().filter(p -> p.getArtifactId().equals("spring-boot-maven-plugin")).count()).isEqualTo(1);
assertThat(plugins.stream().filter(p -> p.getArtifactId().equals("properties-maven-plugin")).count()).isEqualTo(1);
assertThat(plugins.stream().filter(p -> p.getArtifactId().equals("jib-maven-plugin")).count()).isEqualTo(1);

Plugin jibPlugin = plugins.stream().filter(p -> p.getArtifactId().equals("jib-maven-plugin")).findFirst().get();
assertThat(jibPlugin.getConfiguration().toString())
.contains("<org.springframework.cloud.dataflow.spring-configuration-metadata.json>" +
"${org.springframework.cloud.dataflow.spring.configuration.metadata.json}" +
"</org.springframework.cloud.dataflow.spring-configuration-metadata.json>");
assertThat(jibPlugin.getConfiguration().toString()).contains("<image>base/image</image>");

assertThat(pomModel.getRepositories().size()).isEqualTo(2);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
<packaging>jar</packaging>

<properties>
<spring-boot.version>3.3.0.M3</spring-boot.version>
<spring-boot.version>3.3.6</spring-boot.version>
<stream-apps-core.version>5.0.0-SNAPSHOT</stream-apps-core.version>
<java-cfenv-boot.version>3.2.0</java-cfenv-boot.version>
<app-metadata-maven-plugin-version>1.1.0-SNAPSHOT</app-metadata-maven-plugin-version>
Expand Down Expand Up @@ -44,7 +44,7 @@
<application>
<bootVersion>${spring-boot.version}</bootVersion>
<metadata>
<mavenPluginVersion>3.3.0-M1</mavenPluginVersion>
<mavenPluginVersion>3.3.0</mavenPluginVersion>
</metadata>
<containerImage>
<orgName>globalOrgName</orgName>
Expand Down
Loading