diff --git a/.github/workflows/maven-build.yml b/.github/workflows/maven-build.yml index e5ef1443..6a4fcd7d 100644 --- a/.github/workflows/maven-build.yml +++ b/.github/workflows/maven-build.yml @@ -42,6 +42,3 @@ jobs: sonar-run-on-java-version: 11 sonar-token: ${{ secrets.SONAR_TOKEN }} github-token: ${{ secrets.GITHUB_TOKEN }} - - - name: Build and verify example - run: ./mvnw -s ./.maven-settings.xml -Pcontinuous-integration -B -U clean verify -f example diff --git a/changes.xml b/changes.xml index a30d33b3..addd48b3 100644 --- a/changes.xml +++ b/changes.xml @@ -23,6 +23,15 @@ xsi:schemaLocation="http://maven.apache.org/changes/1.0.0 https://maven.apache.org/plugins/maven-changes-plugin/xsd/changes-1.0.0.xsd"> + + + conga-maven-plugin: Fix version resolution for references JAR maven artifacts without explicit type definition. + + + YAML model export: Avoid generating YAML alias for tenant roles arrays. + + + Update dependencies. diff --git a/generator/pom.xml b/generator/pom.xml index 6eee7fa7..b0e3f2d1 100644 --- a/generator/pom.xml +++ b/generator/pom.xml @@ -25,7 +25,7 @@ io.wcm.devops.conga io.wcm.devops.conga.parent - 1.14.6 + 1.14.8 ../parent/pom.xml @@ -44,7 +44,7 @@ io.wcm.devops.conga io.wcm.devops.conga.model - 1.14.6 + 1.14.8 compile diff --git a/generator/src/main/java/io/wcm/devops/conga/generator/plugins/export/YamlNodeModelExport.java b/generator/src/main/java/io/wcm/devops/conga/generator/plugins/export/YamlNodeModelExport.java index a7626860..28432392 100644 --- a/generator/src/main/java/io/wcm/devops/conga/generator/plugins/export/YamlNodeModelExport.java +++ b/generator/src/main/java/io/wcm/devops/conga/generator/plugins/export/YamlNodeModelExport.java @@ -141,7 +141,8 @@ private void addTenant(List> tenants, ExportNodeRoleTenantDa tenantMap.put("tenant", context.getVariableStringResolver().resolve(tenantData.getTenant(), tenantData.getConfig())); if (!tenantData.getRoles().isEmpty()) { - tenantMap.put("roles", tenantData.getRoles()); + // copy role list for each tenant to avoid alias in YAML export + tenantMap.put("roles", new ArrayList<>(tenantData.getRoles())); } tenantMap.put("config", context.getModelExportConfigProcessor().apply(tenantData.getConfig())); diff --git a/model/pom.xml b/model/pom.xml index 3d46ea96..44304447 100644 --- a/model/pom.xml +++ b/model/pom.xml @@ -25,7 +25,7 @@ io.wcm.devops.conga io.wcm.devops.conga.parent - 1.14.6 + 1.14.8 ../parent/pom.xml @@ -40,7 +40,7 @@ io.wcm.devops.conga io.wcm.devops.conga.resource - 1.14.6 + 1.14.8 diff --git a/parent/pom.xml b/parent/pom.xml index f58bdbab..3a9b64b6 100644 --- a/parent/pom.xml +++ b/parent/pom.xml @@ -25,13 +25,13 @@ io.wcm.devops io.wcm.devops.parent_toplevel - 1.3.0 + 1.3.2 io.wcm.devops.conga io.wcm.devops.conga.parent - 1.14.6 + 1.14.8 pom CONGA diff --git a/pom.xml b/pom.xml index 046efb4b..463b4532 100644 --- a/pom.xml +++ b/pom.xml @@ -25,13 +25,13 @@ io.wcm.devops.conga io.wcm.devops.conga.parent - 1.14.6 + 1.14.8 parent/pom.xml io.wcm.devops.conga io.wcm.devops.conga.root - 1.14.6 + 1.14.8 pom CONGA @@ -56,8 +56,6 @@ generator tooling/conga-cli tooling/conga-maven-plugin - - diff --git a/resource/pom.xml b/resource/pom.xml index 84e77c6a..3061c76c 100644 --- a/resource/pom.xml +++ b/resource/pom.xml @@ -25,7 +25,7 @@ io.wcm.devops.conga io.wcm.devops.conga.parent - 1.14.6 + 1.14.8 ../parent/pom.xml diff --git a/src/site/markdown/index.md b/src/site/markdown/index.md index 029e977f..c81aaf05 100644 --- a/src/site/markdown/index.md +++ b/src/site/markdown/index.md @@ -68,7 +68,6 @@ Definitions for CONGA: [usage]: usage.html [general-concepts]: general-concepts.html [extensibility]: extensibility.html -[examples]: examples.html [yaml-definitions]: yaml-definitions.html [handlebars-quickstart]: handlebars-quickstart.html [handlebars-helpers]: handlebars-helpers.html diff --git a/src/site/markdown/usage.md b/src/site/markdown/usage.md index 736351ff..5007ad84 100644 --- a/src/site/markdown/usage.md +++ b/src/site/markdown/usage.md @@ -8,10 +8,8 @@ Make sure you have installed: * Java 8 or higher * Apache Maven 3.3 or higher -To start with the example project by cloning this GIT repository: -https://github.com/wcm-io-devops/conga/ - -The example project is in a subfolder `example`. +Example project can be found at: +https://github.com/wcm-io-devops/conga/tree/develop/tooling/conga-maven-plugin/src/it/example ### Definitions diff --git a/src/site/markdown/yaml-definitions.md b/src/site/markdown/yaml-definitions.md index adc8f457..422f68e1 100644 --- a/src/site/markdown/yaml-definitions.md +++ b/src/site/markdown/yaml-definitions.md @@ -10,7 +10,7 @@ Please note that the Java Bean naming conventions are applied: For the property ### Role definitions Example role definitions:
-https://github.com/wcm-io-devops/conga/tree/develop/example/definitions/src/main/roles +https://github.com/wcm-io-devops/conga/tree/develop/tooling/conga-maven-plugin/src/it/example/definitions/src/main/roles The filename of the role YAML file is the role name. @@ -50,7 +50,7 @@ In this case the current role inherits all configuration and files from the supe ### Environment definitions Example environment definitions:
-https://github.com/wcm-io-devops/conga/tree/develop/example/environments/src/main/environments +https://github.com/wcm-io-devops/conga/tree/develop/tooling/conga-maven-plugin/src/it/example/environments/src/main/environments The filename of the environment YAML file is the environment name. diff --git a/tooling/conga-cli/pom.xml b/tooling/conga-cli/pom.xml index 38034876..586b8146 100644 --- a/tooling/conga-cli/pom.xml +++ b/tooling/conga-cli/pom.xml @@ -25,7 +25,7 @@ io.wcm.devops.conga io.wcm.devops.conga.parent - 1.14.6 + 1.14.8 ../../parent/pom.xml @@ -40,7 +40,7 @@ io.wcm.devops.conga io.wcm.devops.conga.generator - 1.14.6 + 1.14.8 compile diff --git a/tooling/conga-maven-plugin/pom.xml b/tooling/conga-maven-plugin/pom.xml index 1f0417a3..5a84cf44 100644 --- a/tooling/conga-maven-plugin/pom.xml +++ b/tooling/conga-maven-plugin/pom.xml @@ -25,7 +25,7 @@ io.wcm.devops.conga io.wcm.devops.conga.parent - 1.14.6 + 1.14.8 ../../parent/pom.xml @@ -38,6 +38,13 @@ 3.3.9 tooling/conga-maven-plugin + + + 3.6.4 + + + invoker.mavenOpts + org.jacoco.maven.* @@ -49,7 +56,7 @@ io.wcm.devops.conga io.wcm.devops.conga.generator - 1.14.6 + 1.14.8 compile @@ -113,7 +120,7 @@ org.apache.maven.plugin-tools maven-plugin-annotations - 3.6.4 + ${maven-plugin-plugin.version} @@ -132,7 +139,7 @@ org.apache.maven.plugins maven-plugin-plugin - 3.6.4 + ${maven-plugin-plugin.version} conga true @@ -153,6 +160,87 @@ + + + org.jacoco + jacoco-maven-plugin + + + before-unit-test-execution + + prepare-agent + + + ${project.build.directory}/jacoco-output/jacoco-unit-tests.exec + surefire.jacoco.args + + + + before-integration-test-execution + + prepare-agent-integration + + + ${project.build.directory}/jacoco-output/jacoco-integration-tests.exec + invoker.jacoco.args + + + + merge-unit-and-integration + post-integration-test + + merge + + + + + ${project.build.directory}/jacoco-output + + *.exec + + + + + + + + + + org.apache.maven.plugins + maven-surefire-plugin + + ${surefire.jacoco.args} + + + + + org.apache.maven.plugins + maven-invoker-plugin + + src/it + ${project.build.directory}/it + + */pom.xml + + verify + true + + org.jacoco:org.jacoco.agent:${jacoco-maven-plugin.version}:jar:runtime + + ${invoker.jacoco.args} + + + + integration-test + + install + integration-test + verify + + + + + diff --git a/example/README.md b/tooling/conga-maven-plugin/src/it/example/README.md similarity index 100% rename from example/README.md rename to tooling/conga-maven-plugin/src/it/example/README.md diff --git a/example/definitions/pom.xml b/tooling/conga-maven-plugin/src/it/example/definitions/pom.xml similarity index 84% rename from example/definitions/pom.xml rename to tooling/conga-maven-plugin/src/it/example/definitions/pom.xml index 454a332e..476edee4 100644 --- a/example/definitions/pom.xml +++ b/tooling/conga-maven-plugin/src/it/example/definitions/pom.xml @@ -37,4 +37,13 @@ CONGA Packaging Example: Definitions Example role definitions and templates. + + + io.wcm.tooling.spotbugs + io.wcm.tooling.spotbugs.annotations + 1.0.0 + compile + + + diff --git a/example/definitions/src/main/resources/sample.txt b/tooling/conga-maven-plugin/src/it/example/definitions/src/main/resources/sample.txt similarity index 100% rename from example/definitions/src/main/resources/sample.txt rename to tooling/conga-maven-plugin/src/it/example/definitions/src/main/resources/sample.txt diff --git a/example/definitions/src/main/roles/tomcat-backendconnector.yaml b/tooling/conga-maven-plugin/src/it/example/definitions/src/main/roles/tomcat-backendconnector.yaml similarity index 100% rename from example/definitions/src/main/roles/tomcat-backendconnector.yaml rename to tooling/conga-maven-plugin/src/it/example/definitions/src/main/roles/tomcat-backendconnector.yaml diff --git a/example/definitions/src/main/roles/tomcat-services.yaml b/tooling/conga-maven-plugin/src/it/example/definitions/src/main/roles/tomcat-services.yaml similarity index 92% rename from example/definitions/src/main/roles/tomcat-services.yaml rename to tooling/conga-maven-plugin/src/it/example/definitions/src/main/roles/tomcat-services.yaml index 75f4b1c1..400de8cb 100644 --- a/example/definitions/src/main/roles/tomcat-services.yaml +++ b/tooling/conga-maven-plugin/src/it/example/definitions/src/main/roles/tomcat-services.yaml @@ -60,8 +60,10 @@ files: customOption1: value1 customOption2: 123 -# Download file from maven repository, use artifact filename. +# Download files from maven repository, use artifact filename. # Derive version from maven project. +- url: mvn:io.wcm.tooling.spotbugs/io.wcm.tooling.spotbugs.annotations + dir: download - url: mvn:io.wcm.devops/io.wcm.devops.parent_toplevel//xml/site dir: download diff --git a/example/definitions/src/main/roles/webserver.yaml b/tooling/conga-maven-plugin/src/it/example/definitions/src/main/roles/webserver.yaml similarity index 100% rename from example/definitions/src/main/roles/webserver.yaml rename to tooling/conga-maven-plugin/src/it/example/definitions/src/main/roles/webserver.yaml diff --git a/example/definitions/src/main/templates/tomcat/ROOT.xml.hbs b/tooling/conga-maven-plugin/src/it/example/definitions/src/main/templates/tomcat/ROOT.xml.hbs similarity index 100% rename from example/definitions/src/main/templates/tomcat/ROOT.xml.hbs rename to tooling/conga-maven-plugin/src/it/example/definitions/src/main/templates/tomcat/ROOT.xml.hbs diff --git a/example/definitions/src/main/templates/tomcat/ROOT_importer.xml.hbs b/tooling/conga-maven-plugin/src/it/example/definitions/src/main/templates/tomcat/ROOT_importer.xml.hbs similarity index 100% rename from example/definitions/src/main/templates/tomcat/ROOT_importer.xml.hbs rename to tooling/conga-maven-plugin/src/it/example/definitions/src/main/templates/tomcat/ROOT_importer.xml.hbs diff --git a/example/definitions/src/main/templates/tomcat/backend-connector.xml.hbs b/tooling/conga-maven-plugin/src/it/example/definitions/src/main/templates/tomcat/backend-connector.xml.hbs similarity index 100% rename from example/definitions/src/main/templates/tomcat/backend-connector.xml.hbs rename to tooling/conga-maven-plugin/src/it/example/definitions/src/main/templates/tomcat/backend-connector.xml.hbs diff --git a/example/definitions/src/main/templates/tomcat/setenv.bat.hbs b/tooling/conga-maven-plugin/src/it/example/definitions/src/main/templates/tomcat/setenv.bat.hbs similarity index 100% rename from example/definitions/src/main/templates/tomcat/setenv.bat.hbs rename to tooling/conga-maven-plugin/src/it/example/definitions/src/main/templates/tomcat/setenv.bat.hbs diff --git a/example/definitions/src/main/templates/tomcat/setenv.sh.hbs b/tooling/conga-maven-plugin/src/it/example/definitions/src/main/templates/tomcat/setenv.sh.hbs similarity index 100% rename from example/definitions/src/main/templates/tomcat/setenv.sh.hbs rename to tooling/conga-maven-plugin/src/it/example/definitions/src/main/templates/tomcat/setenv.sh.hbs diff --git a/example/definitions/src/main/templates/webserver/tenant_vhost.conf.hbs b/tooling/conga-maven-plugin/src/it/example/definitions/src/main/templates/webserver/tenant_vhost.conf.hbs similarity index 100% rename from example/definitions/src/main/templates/webserver/tenant_vhost.conf.hbs rename to tooling/conga-maven-plugin/src/it/example/definitions/src/main/templates/webserver/tenant_vhost.conf.hbs diff --git a/example/environments/pom.xml b/tooling/conga-maven-plugin/src/it/example/environments/pom.xml similarity index 98% rename from example/environments/pom.xml rename to tooling/conga-maven-plugin/src/it/example/environments/pom.xml index a58fdcd4..1d450df7 100644 --- a/example/environments/pom.xml +++ b/tooling/conga-maven-plugin/src/it/example/environments/pom.xml @@ -50,7 +50,7 @@ io.wcm.devops io.wcm.devops.parent_toplevel - 1.3.0 + 1.3.2 xml site diff --git a/example/environments/src/main/environments/prod.yaml b/tooling/conga-maven-plugin/src/it/example/environments/src/main/environments/prod.yaml similarity index 100% rename from example/environments/src/main/environments/prod.yaml rename to tooling/conga-maven-plugin/src/it/example/environments/src/main/environments/prod.yaml diff --git a/tooling/conga-maven-plugin/src/it/example/invoker.properties b/tooling/conga-maven-plugin/src/it/example/invoker.properties new file mode 100644 index 00000000..e2a44e3c --- /dev/null +++ b/tooling/conga-maven-plugin/src/it/example/invoker.properties @@ -0,0 +1 @@ +invoker.goals = clean verify diff --git a/example/pom.xml b/tooling/conga-maven-plugin/src/it/example/pom.xml similarity index 77% rename from example/pom.xml rename to tooling/conga-maven-plugin/src/it/example/pom.xml index 84b5290a..6fbfdc14 100644 --- a/example/pom.xml +++ b/tooling/conga-maven-plugin/src/it/example/pom.xml @@ -26,7 +26,7 @@ io.wcm.maven io.wcm.maven.global-parent - 36 + 44 @@ -48,22 +48,12 @@ - io.wcm.devops.conga - conga-maven-plugin - 1.14.5-SNAPSHOT + @project.groupId@ + @project.artifactId@ + @project.version@ true - - - org.apache.maven.plugins - maven-deploy-plugin - false - - true - - -
diff --git a/tooling/conga-maven-plugin/src/it/example/verify.groovy b/tooling/conga-maven-plugin/src/it/example/verify.groovy new file mode 100644 index 00000000..1cb7f2ec --- /dev/null +++ b/tooling/conga-maven-plugin/src/it/example/verify.groovy @@ -0,0 +1,10 @@ + +// ensure no aliases are used in exported model YAML file +File sevices1ModelFile = new File( basedir, "environments/target/configuration/prod/services-1/model.yaml" ); +assert sevices1ModelFile.exists(); +String sevices1Model = sevices1ModelFile.getText("utf-8"); +assert !sevices1Model.contains("&id001") +assert !sevices1Model.contains("*id001") + + +return true; diff --git a/tooling/conga-maven-plugin/src/main/java/io/wcm/devops/conga/tooling/maven/plugin/util/MavenArtifactHelper.java b/tooling/conga-maven-plugin/src/main/java/io/wcm/devops/conga/tooling/maven/plugin/util/MavenArtifactHelper.java index 3206fd7c..a6ba2b3c 100644 --- a/tooling/conga-maven-plugin/src/main/java/io/wcm/devops/conga/tooling/maven/plugin/util/MavenArtifactHelper.java +++ b/tooling/conga-maven-plugin/src/main/java/io/wcm/devops/conga/tooling/maven/plugin/util/MavenArtifactHelper.java @@ -223,14 +223,8 @@ private Artifact getArtifactFromMavenCoordinatesPaxUrlStyle(String artifactCoord private Artifact createArtifact(String groupId, String artifactId, String type, String classifier, String version) throws IOException { - String artifactVersion = version; - if (artifactVersion == null) { - artifactVersion = resolveArtifactVersion(groupId, artifactId, type, classifier); - } - String artifactExtension = type; - if (artifactExtension == null) { - artifactExtension = "jar"; - } + String artifactTypeString = StringUtils.defaultString(type, "jar"); + String artifactExtension = artifactTypeString; ArtifactType artifactType = repoSession.getArtifactTypeRegistry().get(artifactExtension); if (artifactType != null) { @@ -242,6 +236,11 @@ private Artifact createArtifact(String groupId, String artifactId, String type, artifactExtension = artifactTypeMappings.get(artifactExtension); } + String artifactVersion = version; + if (artifactVersion == null) { + artifactVersion = resolveArtifactVersion(groupId, artifactId, artifactTypeString, classifier); + } + if (StringUtils.isBlank(groupId) || StringUtils.isBlank(artifactId) || StringUtils.isBlank(artifactVersion)) { throw new IOException("Invalid Maven artifact reference: " + "artifactId=" + artifactId + ", "