diff --git a/.github/workflows/apps-plugin-milestone.yml b/.github/workflows/apps-plugin-milestone.yml index 29eb51074..92091b960 100644 --- a/.github/workflows/apps-plugin-milestone.yml +++ b/.github/workflows/apps-plugin-milestone.yml @@ -6,10 +6,6 @@ on: milestoneVersion: description: "Milestone version (no dash, eg. 'M1')" required: true - -env: - MAVEN_THREADS: '-T 0.5C' - jobs: build_deploy_milestone: if: ${{ github.repository == 'spring-cloud/stream-applications' }} @@ -21,8 +17,8 @@ jobs: - uses: actions/checkout@v3 - uses: actions/setup-java@v3 with: - java-version: 17 - distribution: temurin + java-version: 8 + distribution: liberica - uses: jvalkeal/setup-maven@v1 with: maven-version: 3.8.8 @@ -39,6 +35,7 @@ jobs: restore-keys: | ${{ runner.os }}-m2- - name: Configure JFrog Cli + shell: bash run: | jfrog rt mvnc \ --server-id-resolve=repo.spring.io \ @@ -50,9 +47,10 @@ jobs: echo JFROG_CLI_BUILD_NAME=spring-cloud-dataflow-apps-plugin-main-milestone >> $GITHUB_ENV echo JFROG_CLI_BUILD_NUMBER=$GITHUB_RUN_NUMBER >> $GITHUB_ENV - name: Build and Publish + shell: bash run: | jfrog rt mvn build-helper:parse-version versions:set \ - -gs settings.xml \ + -s settings.xml \ -Pstagingmilestone \ -DprocessAllModules=true \ -DgenerateBackupPoms=false \ diff --git a/.github/workflows/apps-plugin-next-dev-version.yml b/.github/workflows/apps-plugin-next-dev-version.yml index bad9ba859..ec610ae5e 100644 --- a/.github/workflows/apps-plugin-next-dev-version.yml +++ b/.github/workflows/apps-plugin-next-dev-version.yml @@ -17,8 +17,8 @@ jobs: - uses: actions/checkout@v3 - uses: actions/setup-java@v3 with: - java-version: 17 - distribution: temurin + java-version: 8 + distribution: liberica - uses: jvalkeal/setup-maven@v1 with: maven-version: 3.8.8 @@ -57,7 +57,7 @@ jobs: -B jfrog rt build-clean mvn clean - jfrog rt mvn -gs settings.xml install -DskipTests -B + jfrog rt mvn -s settings.xml install -DskipTests -B jfrog rt build-publish - name: Commit next snapshot version changes uses: jvalkeal/build-zoo-handler@v0.0.4 diff --git a/.github/workflows/apps-plugin-pr.yml b/.github/workflows/apps-plugin-pr.yml new file mode 100644 index 000000000..f71a6078a --- /dev/null +++ b/.github/workflows/apps-plugin-pr.yml @@ -0,0 +1,59 @@ +name: 'CI - PR' + +on: + pull_request: + paths-ignore: + - 'applications/**' + - 'stream-applications-build/**' + - 'stream-applications-release-train/**' + +env: + MAIN_PATH: 'build-dir' + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + MAVEN_THREADS: 'true' +jobs: + build: + if: github.repository == 'spring-cloud/stream-applications' + runs-on: ubuntu-latest + defaults: + run: + working-directory: spring-cloud-dataflow-apps-plugin + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-java@v3 + with: + java-version: 8 + distribution: liberica + - uses: jvalkeal/setup-maven@v1 + with: + maven-version: 3.8.8 + maven-mirror: 'https://dlcdn.apache.org/maven/maven-3/' + - uses: jfrog/setup-jfrog-cli@v3 + with: + version: 1.46.4 + env: + JF_ARTIFACTORY_SPRING: ${{ secrets.JF_ARTIFACTORY_SPRING }} + - uses: actions/cache@v2 + with: + path: ~/.m2/repository + key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }} + restore-keys: | + ${{ runner.os }}-m2- + - name: Build and Publish + shell: bash + env: + ARTIFACTORY_USERNAME: ${{ secrets.ARTIFACTORY_USERNAME }} + ARTIFACTORY_PASSWORD: ${{ secrets.ARTIFACTORY_PASSWORD }} + run: | + ./mvnw -s settings.xml -B install + - name: Capture Test Results + if: ${{ always() }} + uses: actions/upload-artifact@v3 + with: + name: test-results + path: '**/target/surefire-reports/**/*.*' + retention-days: 7 + if-no-files-found: ignore + - name: Clean cache + run: | + find ~/.m2/repository -type d -name '*SNAPSHOT' | xargs rm -fr diff --git a/.github/workflows/apps-plugin-release.yml b/.github/workflows/apps-plugin-release.yml index 6292f8911..7f64a4dd1 100644 --- a/.github/workflows/apps-plugin-release.yml +++ b/.github/workflows/apps-plugin-release.yml @@ -3,8 +3,6 @@ name: Apps Plugin (Release) on: workflow_dispatch: -env: - MAVEN_THREADS: '-T 0.5C' jobs: build_deploy_release: @@ -17,8 +15,8 @@ jobs: - uses: actions/checkout@v3 - uses: actions/setup-java@v3 with: - java-version: 17 - distribution: temurin + java-version: 8 + distribution: liberica - uses: jvalkeal/setup-maven@v1 with: maven-version: 3.8.8 @@ -52,7 +50,7 @@ jobs: - name: Build and Publish run: | jfrog rt mvn build-helper:parse-version versions:set \ - -gs settings.xml \ + -s settings.xml \ -Pstagingrelease \ -DprocessAllModules=true \ -DgenerateBackupPoms=false \ diff --git a/.github/workflows/apps-plugin-snapshot.yml b/.github/workflows/apps-plugin-snapshot.yml index fa62952b4..7f55215fd 100644 --- a/.github/workflows/apps-plugin-snapshot.yml +++ b/.github/workflows/apps-plugin-snapshot.yml @@ -25,8 +25,8 @@ jobs: - uses: actions/checkout@v3 - uses: actions/setup-java@v3 with: - java-version: 17 - distribution: temurin + java-version: 8 + distribution: liberica - uses: jvalkeal/setup-maven@v1 with: maven-version: 3.8.8 @@ -56,7 +56,7 @@ jobs: - name: Build and Publish run: | jfrog rt build-clean - jfrog rt mvn -gs settings.xml -B install + jfrog rt mvn -s settings.xml -B install jfrog rt build-publish - name: Capture Test Results if: ${{ always() }} diff --git a/.github/workflows/ci-pr.yml b/.github/workflows/ci-pr.yml index 21746752f..5295d850f 100644 --- a/.github/workflows/ci-pr.yml +++ b/.github/workflows/ci-pr.yml @@ -2,6 +2,8 @@ name: 'CI - PR' on: pull_request: + paths-ignore: + - 'spring-cloud-dataflow-apps-plugin/**' env: MAIN_PATH: 'build-dir' @@ -29,7 +31,7 @@ jobs: if: ${{ github.base_ref != 'main' }} uses: actions/setup-java@v1 with: - java-version: ${{ needs.parameters.outputs.jdk_build }} + java-version: '8' - name: 'Configure: Install GraalVM' if: ${{ github.base_ref == 'main' }} uses: graalvm/setup-graalvm@v1 @@ -52,6 +54,8 @@ jobs: - name: 'Action: verify changed modules' shell: bash env: + ARTIFACTORY_USERNAME: ${{ secrets.ARTIFACTORY_USERNAME }} + ARTIFACTORY_PASSWORD: ${{ secrets.ARTIFACTORY_PASSWORD }} VERBOSE: ${{ github.debug && 'true' || '' }} run: | PR=$(echo "${{ github.ref_name }}" | grep -o '[[:digit:]]*') diff --git a/spring-cloud-dataflow-apps-plugin/pom.xml b/spring-cloud-dataflow-apps-plugin/pom.xml index 1a481422f..24169ec57 100644 --- a/spring-cloud-dataflow-apps-plugin/pom.xml +++ b/spring-cloud-dataflow-apps-plugin/pom.xml @@ -3,7 +3,7 @@ 4.0.0 org.springframework.cloud spring-cloud-dataflow-apps-plugin-parent - 1.0.15-SNAPSHOT + 1.1.0-SNAPSHOT spring-cloud-dataflow-apps-plugin-parent Spring Cloud Dataflow Apps Plugin Parent pom diff --git a/spring-cloud-dataflow-apps-plugin/settings.xml b/spring-cloud-dataflow-apps-plugin/settings.xml index a36e075d4..c6f9602af 100644 --- a/spring-cloud-dataflow-apps-plugin/settings.xml +++ b/spring-cloud-dataflow-apps-plugin/settings.xml @@ -1,4 +1,31 @@ + + + repo.spring.io + ${env.ARTIFACTORY_USERNAME} + ${env.ARTIFACTORY_PASSWORD} + + + spring-snapshots + ${env.ARTIFACTORY_USERNAME} + ${env.ARTIFACTORY_PASSWORD} + + + spring-milestones + ${env.ARTIFACTORY_USERNAME} + ${env.ARTIFACTORY_PASSWORD} + + + spring-staging + ${env.ARTIFACTORY_USERNAME} + ${env.ARTIFACTORY_PASSWORD} + + + spring-releases + ${env.ARTIFACTORY_USERNAME} + ${env.ARTIFACTORY_PASSWORD} + + pr diff --git a/spring-cloud-dataflow-apps-plugin/spring-cloud-dataflow-apps-docs-plugin/pom.xml b/spring-cloud-dataflow-apps-plugin/spring-cloud-dataflow-apps-docs-plugin/pom.xml index 07f5991af..f7a10e2b6 100644 --- a/spring-cloud-dataflow-apps-plugin/spring-cloud-dataflow-apps-docs-plugin/pom.xml +++ b/spring-cloud-dataflow-apps-plugin/spring-cloud-dataflow-apps-docs-plugin/pom.xml @@ -5,7 +5,7 @@ org.springframework.cloud spring-cloud-dataflow-apps-plugin-parent - 1.0.15-SNAPSHOT + 1.1.0-SNAPSHOT .. diff --git a/spring-cloud-dataflow-apps-plugin/spring-cloud-dataflow-apps-docs-plugin/src/main/java/org/springframework/cloud/dataflow/app/plugin/ConfigurationMetadataDocumentationMojo.java b/spring-cloud-dataflow-apps-plugin/spring-cloud-dataflow-apps-docs-plugin/src/main/java/org/springframework/cloud/dataflow/app/plugin/ConfigurationMetadataDocumentationMojo.java index 714baf085..7ef62e497 100644 --- a/spring-cloud-dataflow-apps-plugin/spring-cloud-dataflow-apps-docs-plugin/src/main/java/org/springframework/cloud/dataflow/app/plugin/ConfigurationMetadataDocumentationMojo.java +++ b/spring-cloud-dataflow-apps-plugin/spring-cloud-dataflow-apps-docs-plugin/src/main/java/org/springframework/cloud/dataflow/app/plugin/ConfigurationMetadataDocumentationMojo.java @@ -30,6 +30,7 @@ import java.util.Arrays; import java.util.Collections; import java.util.Comparator; +import java.util.HashMap; import java.util.Iterator; import java.util.LinkedHashMap; import java.util.LinkedList; @@ -76,10 +77,12 @@ public class ConfigurationMetadataDocumentationMojo extends AbstractMojo { static final String CONFIGURATION_PROPERTIES_END_TAG = "//end::configuration-properties[]"; - private static final Map APPTYPE_TO_FUNCTIONTYPE = Map.of( - "source", "supplier", - "processor", "function", - "sink", "consumer"); + private static final Map APPTYPE_TO_FUNCTIONTYPE = new HashMap<>(); + static { + APPTYPE_TO_FUNCTIONTYPE.put("source", "supplier"); + APPTYPE_TO_FUNCTIONTYPE.put("processor", "function"); + APPTYPE_TO_FUNCTIONTYPE.put("sink", "consumer"); + } private BootApplicationConfigurationMetadataResolver metadataResolver = new BootApplicationConfigurationMetadataResolver( imageName -> null); @@ -166,8 +169,8 @@ private void handleExternalLinkToFunctionsCatalog(Artifact artifact, PrintWriter String appName = artifactId.substring(0, artifactId.lastIndexOf('-')); String appType = artifactId.substring(artifactId.lastIndexOf('-') + 1); String functionType = APPTYPE_TO_FUNCTIONTYPE.get(appType); - String functionName = "spring-%s-%s".formatted(appName, functionType); - String url = "https://github.com/spring-cloud/spring-functions-catalog/tree/main/%s/%s#configuration-options[See Spring Functions Catalog for configuration options].".formatted(functionType, functionName); + String functionName = String.format("spring-%s-%s", appName, functionType); + String url = String.format("https://github.com/spring-cloud/spring-functions-catalog/tree/main/%s/%s#configuration-options[See Spring Functions Catalog for configuration options].", functionType, functionName); out.println(url); } diff --git a/spring-cloud-dataflow-apps-plugin/spring-cloud-dataflow-apps-generator-plugin/pom.xml b/spring-cloud-dataflow-apps-plugin/spring-cloud-dataflow-apps-generator-plugin/pom.xml index 6c2bee41d..5008bd078 100644 --- a/spring-cloud-dataflow-apps-plugin/spring-cloud-dataflow-apps-generator-plugin/pom.xml +++ b/spring-cloud-dataflow-apps-plugin/spring-cloud-dataflow-apps-generator-plugin/pom.xml @@ -10,7 +10,7 @@ org.springframework.cloud spring-cloud-dataflow-apps-plugin-parent - 1.0.15-SNAPSHOT + 1.1.0-SNAPSHOT .. @@ -19,7 +19,7 @@ 3.9.2 3.9.0 1.15 - 6.0.8 + 5.3.36 2.12.0 diff --git a/spring-cloud-dataflow-apps-plugin/spring-cloud-dataflow-apps-generator-plugin/src/main/java/org/springframework/cloud/dataflow/app/plugin/SpringCloudStreamAppGeneratorMojo.java b/spring-cloud-dataflow-apps-plugin/spring-cloud-dataflow-apps-generator-plugin/src/main/java/org/springframework/cloud/dataflow/app/plugin/SpringCloudStreamAppGeneratorMojo.java index ecd80e2d3..9acc462c3 100644 --- a/spring-cloud-dataflow-apps-plugin/spring-cloud-dataflow-apps-generator-plugin/src/main/java/org/springframework/cloud/dataflow/app/plugin/SpringCloudStreamAppGeneratorMojo.java +++ b/spring-cloud-dataflow-apps-plugin/spring-cloud-dataflow-apps-generator-plugin/src/main/java/org/springframework/cloud/dataflow/app/plugin/SpringCloudStreamAppGeneratorMojo.java @@ -129,6 +129,22 @@ public void execute() throws MojoFailureException, MojoExecutionException { this.global.getApplication().getFunctionDefinition() : this.application.getFunctionDefinition(); app.setFunctionDefinition(applicationFunctionDefinition); //TODO is applicationFunctionDefinition required? + String appBootPluginConfiguration = StringUtils.hasText(this.application.getBootPluginConfiguration()) ? + this.application.getBootPluginConfiguration() : this.global.getApplication().getBootPluginConfiguration(); + app.setBootPluginConfiguration(appBootPluginConfiguration); + + String appBootExecution = StringUtils.hasText(this.application.getBootExecution()) ? + this.application.getBootExecution() : this.global.getApplication().getBootExecution(); + app.setBootExecution(appBootExecution); + + Boolean skipNativeTests = this.application.skipNativeTests != null ? this.application.skipNativeTests : + this.global.application.skipNativeTests != null ? this.global.application.skipNativeTests : Boolean.FALSE; + app.setSkipNativeTests(skipNativeTests); + + String nativeConfiguration = StringUtils.hasText(this.application.getNativeConfiguration()) ? this.application.getNativeConfiguration() : + this.global.getApplication().getNativeConfiguration(); + app.setNativeConfiguration(nativeConfiguration); + String metadataMavenPluginVersion = StringUtils.isEmpty(this.application.getMetadata().getMavenPluginVersion()) ? this.global.getApplication().getMetadata().getMavenPluginVersion() : this.application.getMetadata().getMavenPluginVersion(); if (StringUtils.isEmpty(metadataMavenPluginVersion)) { @@ -306,8 +322,6 @@ else if (StringUtils.hasText(this.global.getApplication().getContainerImage().ge }) .collect(Collectors.toList()); - app.setBootPluginConfiguration(this.application.getBootPluginConfiguration()); - // ---------------------------------------------------------------------------------------------------------- // Project Generator // ---------------------------------------------------------------------------------------------------------- @@ -465,6 +479,9 @@ public static class Application { private final Maven maven = new Maven(); private String bootPluginConfiguration; + private String bootExecution; + private Boolean skipNativeTests; + private String nativeConfiguration; public String getBootPluginConfiguration() { return bootPluginConfiguration; @@ -474,6 +491,30 @@ public void setBootPluginConfiguration(String bootPluginConfiguration) { this.bootPluginConfiguration = bootPluginConfiguration; } + public String getBootExecution() { + return bootExecution; + } + + public void setBootExecution(String bootExecution) { + this.bootExecution = bootExecution; + } + + public Boolean getSkipNativeTests() { + return skipNativeTests; + } + + public void setSkipNativeTests(Boolean skipNativeTests) { + this.skipNativeTests = skipNativeTests; + } + + public String getNativeConfiguration() { + return nativeConfiguration; + } + + public void setNativeConfiguration(String nativeConfiguration) { + this.nativeConfiguration = nativeConfiguration; + } + public Map getProperties() { return properties; } @@ -631,7 +672,7 @@ public static class ContainerImage { /** * Base images to be used by the target container image. */ - private String baseImage; + private String baseImage = "${project.artifactId}"; /** * Enable or disable the inclusion of application's metadata into the image's labels. diff --git a/spring-cloud-dataflow-apps-plugin/spring-cloud-dataflow-apps-generator-plugin/src/main/java/org/springframework/cloud/dataflow/app/plugin/generator/AppDefinition.java b/spring-cloud-dataflow-apps-plugin/spring-cloud-dataflow-apps-generator-plugin/src/main/java/org/springframework/cloud/dataflow/app/plugin/generator/AppDefinition.java index ae33ec9d3..d239c7285 100644 --- a/spring-cloud-dataflow-apps-plugin/spring-cloud-dataflow-apps-generator-plugin/src/main/java/org/springframework/cloud/dataflow/app/plugin/generator/AppDefinition.java +++ b/spring-cloud-dataflow-apps-plugin/spring-cloud-dataflow-apps-generator-plugin/src/main/java/org/springframework/cloud/dataflow/app/plugin/generator/AppDefinition.java @@ -87,8 +87,18 @@ public class AppDefinition { * Application metadata related configurations to be applied for this App definition. */ private final Metadata metadata = new Metadata(); - + private String bootExecution; private String bootPluginConfiguration; + private Boolean skipNativeTests; + private String nativeConfiguration; + + public String getBootExecution() { + return bootExecution; + } + + public void setBootExecution(String bootExecution) { + this.bootExecution = bootExecution; + } public String getBootPluginConfiguration() { return bootPluginConfiguration; @@ -98,6 +108,22 @@ public void setBootPluginConfiguration(String bootPluginConfiguration) { this.bootPluginConfiguration = bootPluginConfiguration; } + public String getNativeConfiguration() { + return nativeConfiguration; + } + + public void setNativeConfiguration(String nativeConfiguration) { + this.nativeConfiguration = nativeConfiguration; + } + + public Boolean getSkipNativeTests() { + return skipNativeTests; + } + + public void setSkipNativeTests(Boolean skipNativeTests) { + this.skipNativeTests = skipNativeTests; + } + public String getName() { return name; } diff --git a/spring-cloud-dataflow-apps-plugin/spring-cloud-dataflow-apps-generator-plugin/src/main/resources/template/app-pom.xml b/spring-cloud-dataflow-apps-plugin/spring-cloud-dataflow-apps-generator-plugin/src/main/resources/template/app-pom.xml index 6ff785817..398960de3 100644 --- a/spring-cloud-dataflow-apps-plugin/spring-cloud-dataflow-apps-generator-plugin/src/main/resources/template/app-pom.xml +++ b/spring-cloud-dataflow-apps-plugin/spring-cloud-dataflow-apps-generator-plugin/src/main/resources/template/app-pom.xml @@ -138,49 +138,28 @@ org.springframework.boot spring-boot-maven-plugin - {{#app.bootPluginConfiguration}} - + {{#app.bootExecution}} + + {{this}} - - {{/app.bootPluginConfiguration}} - - - - com.google.cloud.tools - jib-maven-plugin - 3.3.0 + + {{/app.bootExecution}} - - {{app.containerImage.baseImage}} - - - {{app.containerImage.orgName}}/${project.artifactId}:{{app.containerImage.tag}} - - - USE_CURRENT_TIMESTAMP - {{app.containerImage.format}} - {{#app.containerImage.enableMetadata}} - - - ${org.springframework.cloud.dataflow.spring.configuration.metadata.json} - - ${project.artifactId} - ${project.version} - - {{/app.containerImage.enableMetadata}} - + {{#app.bootPluginConfiguration}} + + {{this}} + {{/app.bootPluginConfiguration}} + + {{app.containerImage.orgName}}/{{app.containerImage.baseImage}}:{{app.containerImage.tag}} + - {{#app.containerImage.enableMetadata}} - + org.codehaus.mojo properties-maven-plugin - 1.0.0 + 1.2.1 process-classes @@ -205,15 +184,18 @@ {{app.metadata.mavenPluginVersion}} {{#app.containerImage.enableMetadata}} + true {{#app.metadataNameFilters}} + {{this}} {{/app.metadataNameFilters}} {{#app.metadata.sourceTypeFilters}} + {{this}} {{/app.metadata.sourceTypeFilters}} @@ -232,7 +214,7 @@ maven-surefire-plugin - 2.21.0 + 3.2.5 1 1 diff --git a/spring-cloud-dataflow-apps-plugin/spring-cloud-dataflow-apps-generator-plugin/src/main/resources/template/apps-modules-pom.xml b/spring-cloud-dataflow-apps-plugin/spring-cloud-dataflow-apps-generator-plugin/src/main/resources/template/apps-modules-pom.xml index e3c8d34bf..07b4a1d8e 100644 --- a/spring-cloud-dataflow-apps-plugin/spring-cloud-dataflow-apps-generator-plugin/src/main/resources/template/apps-modules-pom.xml +++ b/spring-cloud-dataflow-apps-plugin/spring-cloud-dataflow-apps-generator-plugin/src/main/resources/template/apps-modules-pom.xml @@ -8,7 +8,7 @@ {{app.version}} pom - Apps Modules + {{app.name}}-{{app.type}}-apps Parent project for generated apps project modules http://spring.io/spring-cloud diff --git a/spring-cloud-dataflow-apps-plugin/spring-cloud-dataflow-apps-generator-plugin/src/test/java/org/springframework/cloud/dataflow/app/plugin/MojoHarnessTest.java b/spring-cloud-dataflow-apps-plugin/spring-cloud-dataflow-apps-generator-plugin/src/test/java/org/springframework/cloud/dataflow/app/plugin/MojoHarnessTest.java index 46f759f15..cede24d8f 100644 --- a/spring-cloud-dataflow-apps-plugin/spring-cloud-dataflow-apps-generator-plugin/src/test/java/org/springframework/cloud/dataflow/app/plugin/MojoHarnessTest.java +++ b/spring-cloud-dataflow-apps-plugin/spring-cloud-dataflow-apps-generator-plugin/src/test/java/org/springframework/cloud/dataflow/app/plugin/MojoHarnessTest.java @@ -74,7 +74,7 @@ public void testSomething() throws Exception { Model pomModel = getModel(new File("./target/apps")); List dependencies = pomModel.getDependencies(); - assertThat(dependencies.size()).isEqualTo(15); + assertThat(dependencies.size()).isGreaterThanOrEqualTo(15); assertThat(dependencies.stream() .filter(d -> d.getArtifactId().equals("http-supplier")).count()).isEqualTo(1); @@ -87,7 +87,7 @@ public void testSomething() 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.2"); assertThat(pomModel.getArtifactId()).isEqualTo("http-source-kafka"); assertThat(pomModel.getGroupId()).isEqualTo("org.springframework.cloud.stream.app.test"); @@ -99,17 +99,19 @@ public void testSomething() throws Exception { 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}" + - ""); - assertThat(jibPlugin.getConfiguration().toString()).contains("testspringcloud/${project.artifactId}:3.0.0.BUILD-SNAPSHOT"); - assertThat(jibPlugin.getConfiguration().toString()).contains("globalBaseImage"); - assertThat(pomModel.getRepositories().size()).isEqualTo(5); + Plugin springBootPlugin = plugins.stream().filter(p -> p.getArtifactId().equals("spring-boot-maven-plugin")).findFirst().get(); + assertThat(springBootPlugin).isNotNull(); + assertThat(springBootPlugin.getConfiguration()).isNotNull(); + assertThat(springBootPlugin.getConfiguration().toString()).containsPattern("\\\\s*" + + "\\.+/\\$\\{project.artifactId\\}:\\d+\\.\\d+\\.\\d+.*\\\\s*" + + "\\"); + + List executions = springBootPlugin.getExecutions().stream().map(pluginExecution -> pluginExecution.getId() + ":" + pluginExecution.getPhase() + ":" + pluginExecution.getGoals()).collect(Collectors.toList()); + assertThat(executions).as("Expected executions").isNotEmpty(); + assertThat(executions.toString()).contains("process-aot"); + + assertThat(pomModel.getRepositories().size()).isEqualTo(5); assertThat(pomModel.getRepositories().stream().map(r -> r.getId()).collect(Collectors.toList())) .contains("bintray-global", "bintray-application", "bintray-binder"); } diff --git a/spring-cloud-dataflow-apps-plugin/spring-cloud-dataflow-apps-generator-plugin/src/test/java/org/springframework/cloud/dataflow/app/plugin/SpringCloudStreamAppGeneratorMojoTest.java b/spring-cloud-dataflow-apps-plugin/spring-cloud-dataflow-apps-generator-plugin/src/test/java/org/springframework/cloud/dataflow/app/plugin/SpringCloudStreamAppGeneratorMojoTest.java index 19ef4ff73..2e096f6ef 100644 --- a/spring-cloud-dataflow-apps-plugin/spring-cloud-dataflow-apps-generator-plugin/src/test/java/org/springframework/cloud/dataflow/app/plugin/SpringCloudStreamAppGeneratorMojoTest.java +++ b/spring-cloud-dataflow-apps-plugin/spring-cloud-dataflow-apps-generator-plugin/src/test/java/org/springframework/cloud/dataflow/app/plugin/SpringCloudStreamAppGeneratorMojoTest.java @@ -31,7 +31,6 @@ import org.apache.maven.model.Parent; import org.apache.maven.model.Plugin; import org.apache.maven.model.io.xpp3.MavenXpp3Reader; -import org.codehaus.plexus.util.xml.Xpp3Dom; import org.codehaus.plexus.util.xml.pull.XmlPullParserException; import org.junit.Before; import org.junit.Rule; @@ -85,8 +84,8 @@ public void before() throws NoSuchFieldException { application.getMaven().getDependencies().add(dep); // BOM - application.setBootVersion("3.3.0.M3"); - application.getMetadata().setMavenPluginVersion("1.0.2.BUILD-SNAPSHOT"); + application.setBootVersion("3.3.0"); + application.getMetadata().setMavenPluginVersion("1.1.0-SNAPSHOT"); setMojoProperty("application", application); @@ -128,13 +127,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}" + - ""); } @Test @@ -150,27 +142,27 @@ public void testDefaultProjectCreationByPlugin() throws Exception { } @Test - public void testCustomBootMavenPluginConfiguration() throws Exception { - application.setBootPluginConfiguration("\n" + - " \n" + - " org.python\n" + - " jython-standalone\n" + - " \n" + - " \n" + - " ]]>"); - + public void testCustomBootMavenExecutionsAndPluginConfiguration() throws Exception { + application.setBootPluginConfiguration("" + + "" + + "org.python" + + "jython-standalone" + + "" + + ""); + application.setBootExecution("process-aot" + + "" + + "process-aot" + + ""); springCloudStreamAppMojo.execute(); Model pomModel = getModel(new File(projectHome.getRoot().getAbsolutePath())); List plugins = pomModel.getBuild().getPlugins(); final Optional bootPlugin = plugins.stream().filter(p -> p.getArtifactId().equals("spring-boot-maven-plugin")).findFirst(); assertThat(bootPlugin.isPresent()).isTrue(); - final Plugin plugin = bootPlugin.get(); - final Xpp3Dom configuration = (Xpp3Dom) plugin.getConfiguration(); - assertThat(configuration.getValue().contains("")).isTrue(); - assertThat(configuration.getValue().contains("jython-standalone")).isTrue(); - assertThat(configuration.getValue().contains("")).isTrue(); + assertThat(bootPlugin.get().getConfiguration().toString()).contains("requiresUnpack"); + assertThat(bootPlugin.get().getExecutions()).as("Expected executions").isNotEmpty(); + assertThat(bootPlugin.get().getExecutions().get(0).getGoals()).as("Expected goals").isNotEmpty(); + assertThat(bootPlugin.get().getExecutions().get(0).getGoals().get(0)).isEqualTo("process-aot"); } private void assertGeneratedPomXml(File rootPath) { @@ -178,7 +170,7 @@ private void assertGeneratedPomXml(File rootPath) { Model pomModel = getModel(rootPath); List dependencies = pomModel.getDependencies(); - assertThat(dependencies.size()).isEqualTo(3); + assertThat(dependencies.size()).isGreaterThanOrEqualTo(3); assertThat(dependencies.stream() .filter(d -> d.getArtifactId().equals("log-consumer")).count()).isEqualTo(1); @@ -188,7 +180,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.0"); assertThat(pomModel.getArtifactId()).isEqualTo("log-sink-kafka"); assertThat(pomModel.getGroupId()).isEqualTo("org.springframework.cloud.stream.app"); @@ -199,14 +191,7 @@ private void assertGeneratedPomXml(File rootPath) { List 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}" + - ""); - assertThat(jibPlugin.getConfiguration().toString()).contains("base/image"); + assertThat(pomModel.getRepositories().size()).isEqualTo(2); } diff --git a/spring-cloud-dataflow-apps-plugin/spring-cloud-dataflow-apps-generator-plugin/src/test/resources/unit/http-source-apps/pom.xml b/spring-cloud-dataflow-apps-plugin/spring-cloud-dataflow-apps-generator-plugin/src/test/resources/unit/http-source-apps/pom.xml index 9911b0f11..004b17862 100644 --- a/spring-cloud-dataflow-apps-plugin/spring-cloud-dataflow-apps-generator-plugin/src/test/resources/unit/http-source-apps/pom.xml +++ b/spring-cloud-dataflow-apps-plugin/spring-cloud-dataflow-apps-generator-plugin/src/test/resources/unit/http-source-apps/pom.xml @@ -11,10 +11,10 @@ jar - 3.3.0.M3 + 3.3.2 5.0.0-SNAPSHOT 2.4.1 - 1.0.13-SNAPSHOT + 1.1.0-SNAPSHOT 5.0.0-SNAPSHOT @@ -29,7 +29,7 @@ org.springframework.cloud spring-cloud-dataflow-apps-generator-plugin - 1.0.0-SNAPSHOT + ${app-metadata-maven-plugin-version} app-gen @@ -43,8 +43,24 @@ ${spring-boot.version} + true + + true + + 22.1 + ]]> + + + process-aot + + process-aot + + + ]]> - 3.3.0-M1 + 3.3.0 globalOrgName @@ -281,7 +297,7 @@ org.springframework.cloud spring-cloud-app-starter-metadata-maven-plugin - 2.0.0.BUILD-SNAPSHOT + 3.3.0 true diff --git a/spring-cloud-dataflow-apps-plugin/spring-cloud-dataflow-apps-metadata-plugin/pom.xml b/spring-cloud-dataflow-apps-plugin/spring-cloud-dataflow-apps-metadata-plugin/pom.xml index 0200db619..e250f8c42 100644 --- a/spring-cloud-dataflow-apps-plugin/spring-cloud-dataflow-apps-metadata-plugin/pom.xml +++ b/spring-cloud-dataflow-apps-plugin/spring-cloud-dataflow-apps-metadata-plugin/pom.xml @@ -8,7 +8,7 @@ org.springframework.cloud spring-cloud-dataflow-apps-plugin-parent - 1.0.15-SNAPSHOT + 1.1.0-SNAPSHOT .. @@ -17,8 +17,8 @@ 4.12 3.11.1 1.8 - 5.2.8.RELEASE - 1.26 + 5.3.36 + 1.33 diff --git a/spring-cloud-dataflow-apps-plugin/spring-cloud-dataflow-apps-metadata-plugin/src/main/java/org/springframework/cloud/dataflow/app/plugin/MetadataAggregationMojo.java b/spring-cloud-dataflow-apps-plugin/spring-cloud-dataflow-apps-metadata-plugin/src/main/java/org/springframework/cloud/dataflow/app/plugin/MetadataAggregationMojo.java index 485657b4f..a9862509d 100644 --- a/spring-cloud-dataflow-apps-plugin/spring-cloud-dataflow-apps-metadata-plugin/src/main/java/org/springframework/cloud/dataflow/app/plugin/MetadataAggregationMojo.java +++ b/spring-cloud-dataflow-apps-plugin/spring-cloud-dataflow-apps-metadata-plugin/src/main/java/org/springframework/cloud/dataflow/app/plugin/MetadataAggregationMojo.java @@ -196,7 +196,7 @@ private void storeFilteredMetadata() throws MojoExecutionException { new File(projectMetaInfFolder, "spring-configuration-metadata-encoded.properties"))) { ConfigurationMetadata metadata = gatherConfigurationMetadata(metadataFilter); String escapedJson = StringEscapeUtils.escapeJson(toJson(metadata)); - fileWriter.write("org.springframework.cloud.dataflow.spring.configuration.metadata.json=" + escapedJson); + fileWriter.write("org.springframework.cloud.dataflow.spring.configuration.metadata.json=\"" + escapedJson + "\""); } catch (IOException e) { throw new MojoExecutionException("Error creating file ", e); diff --git a/stream-applications-release-train/stream-applications-docs/src/main/asciidoc/overview.adoc b/stream-applications-release-train/stream-applications-docs/src/main/asciidoc/overview.adoc index 4495ab425..2f8e71fe0 100644 --- a/stream-applications-release-train/stream-applications-docs/src/main/asciidoc/overview.adoc +++ b/stream-applications-release-train/stream-applications-docs/src/main/asciidoc/overview.adoc @@ -118,7 +118,12 @@ cd applications/sink/log-sink/apps/log-sink-rabbit ---- ==== Building a Docker image -The apps use the https://github.com/GoogleContainerTools/jib/tree/master/jib-maven-plugin[Jib Maven Plugin] to build and publish the Docker image. + +[source,shell] +---- +./mvnw spring-boot:build-image +---- + If you have made some changes to an app, you may want to build the image and test it locally. NOTE: If you plan to use the image with minikube, run the following command before building the image: @@ -132,17 +137,19 @@ To build the image in your local registry: [source,shell] ---- -./mvnw clean package jib:dockerBuild +./mvnw clean package spring-boot:build-image ---- To publish the image to a remote registry: [source,shell] ---- -./mvnw jib:build \ - -Djib.to.image=myregistry/myimage:latest \ - -Djib.to.auth.username=$USERNAME \ - -Djib.to.auth.password=$PASSWORD +./mvnw spring-boot:build-image \ + -Ddocker.publishRegistry.username=registry-user \ + -Ddocker.publishRegistry.password=registry-secret \ + -Ddocker.publishRegistry.url=docker.private-registry.com \ + -Dspring-boot.build-image.publish=true \ + -Dspring-boot.build-image.imageName=docker.private-registry.com/library/my-app:v1 ---- == Patching Pre-built Applications @@ -240,7 +247,7 @@ For example, if we have to update Spring Cloud Stream to `3.2.4-SNAPSHOT`, this org.springframework.cloud spring-cloud-stream-dependencies - 4.0.3 + 4.1.2 pom import