From 7bdab85870bb1095e9265a416738f43aa521a172 Mon Sep 17 00:00:00 2001 From: sseifert Date: Wed, 8 May 2019 11:38:30 +0200 Subject: [PATCH 01/27] =?UTF-8?q?[jgitflow-maven-plugin]=C2=A0updating=20p?= =?UTF-8?q?oms=20for=201.2.7-SNAPSHOT=20development?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- conga-sling-plugin/pom.xml | 2 +- pom.xml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/conga-sling-plugin/pom.xml b/conga-sling-plugin/pom.xml index d2186a8..62e94ab 100644 --- a/conga-sling-plugin/pom.xml +++ b/conga-sling-plugin/pom.xml @@ -31,7 +31,7 @@ io.wcm.devops.conga.plugins io.wcm.devops.conga.plugins.sling - 1.2.5-SNAPSHOT + 1.2.7-SNAPSHOT jar CONGA Sling Plugin diff --git a/pom.xml b/pom.xml index 2e6e086..02c90c3 100644 --- a/pom.xml +++ b/pom.xml @@ -29,7 +29,7 @@ io.wcm.devops.conga.plugins io.wcm.devops.conga.plugins.sling.root - 1.2.5-SNAPSHOT + 1.2.7-SNAPSHOT pom CONGA Sling Plugin From 2da99590247f7c2a415ef2d2810369641e3db4f2 Mon Sep 17 00:00:00 2001 From: sseifert Date: Wed, 8 May 2019 11:40:04 +0200 Subject: [PATCH 02/27] =?UTF-8?q?[jgitflow-maven-plugin]=C2=A0updating=20d?= =?UTF-8?q?evelop=20poms=20to=20master=20versions=20to=20avoid=20merge=20c?= =?UTF-8?q?onflicts?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- conga-sling-plugin/pom.xml | 2 +- pom.xml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/conga-sling-plugin/pom.xml b/conga-sling-plugin/pom.xml index 62e94ab..0833d97 100644 --- a/conga-sling-plugin/pom.xml +++ b/conga-sling-plugin/pom.xml @@ -31,7 +31,7 @@ io.wcm.devops.conga.plugins io.wcm.devops.conga.plugins.sling - 1.2.7-SNAPSHOT + 1.2.6 jar CONGA Sling Plugin diff --git a/pom.xml b/pom.xml index 02c90c3..b5c70d3 100644 --- a/pom.xml +++ b/pom.xml @@ -29,7 +29,7 @@ io.wcm.devops.conga.plugins io.wcm.devops.conga.plugins.sling.root - 1.2.7-SNAPSHOT + 1.2.6 pom CONGA Sling Plugin From ca4cb04d39b4be62963f3c612b83d7c930617c66 Mon Sep 17 00:00:00 2001 From: sseifert Date: Wed, 8 May 2019 11:40:04 +0200 Subject: [PATCH 03/27] =?UTF-8?q?[jgitflow-maven-plugin]=C2=A0Updating=20d?= =?UTF-8?q?evelop=20poms=20back=20to=20pre=20merge=20state?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- conga-sling-plugin/pom.xml | 2 +- pom.xml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/conga-sling-plugin/pom.xml b/conga-sling-plugin/pom.xml index 0833d97..62e94ab 100644 --- a/conga-sling-plugin/pom.xml +++ b/conga-sling-plugin/pom.xml @@ -31,7 +31,7 @@ io.wcm.devops.conga.plugins io.wcm.devops.conga.plugins.sling - 1.2.6 + 1.2.7-SNAPSHOT jar CONGA Sling Plugin diff --git a/pom.xml b/pom.xml index b5c70d3..02c90c3 100644 --- a/pom.xml +++ b/pom.xml @@ -29,7 +29,7 @@ io.wcm.devops.conga.plugins io.wcm.devops.conga.plugins.sling.root - 1.2.6 + 1.2.7-SNAPSHOT pom CONGA Sling Plugin From 1bc8743a57fe7b12cadb822f4176472e695b0c88 Mon Sep 17 00:00:00 2001 From: sseifert Date: Wed, 8 May 2019 11:42:05 +0200 Subject: [PATCH 04/27] update dependency --- example/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/example/pom.xml b/example/pom.xml index 6082baf..0a0dffc 100644 --- a/example/pom.xml +++ b/example/pom.xml @@ -53,7 +53,7 @@ io.wcm.devops.conga.plugins io.wcm.devops.conga.plugins.sling - 1.2.5-SNAPSHOT + 1.2.7-SNAPSHOT From 03970afdc4271f3fb41a9fb6ad2adf23fa34bd94 Mon Sep 17 00:00:00 2001 From: sseifert Date: Sun, 2 Jun 2019 10:25:23 +0200 Subject: [PATCH 05/27] switch wcm.io domains to HTTPS --- .travis.maven-settings.xml | 12 ++++++------ README.md | 6 +++--- conga-sling-plugin/pom.xml | 2 +- pom.xml | 2 +- src/site/markdown/extensions.md | 2 +- src/site/markdown/index.md | 4 ++-- src/site/markdown/usage.md | 2 +- src/site/site.xml | 2 +- 8 files changed, 16 insertions(+), 16 deletions(-) diff --git a/.travis.maven-settings.xml b/.travis.maven-settings.xml index b901939..4c9c6d3 100644 --- a/.travis.maven-settings.xml +++ b/.travis.maven-settings.xml @@ -31,7 +31,7 @@ central - http://repo1.maven.org/maven2/ + https://repo1.maven.org/maven2/ default true @@ -57,7 +57,7 @@ wcm-io-apache-intermediate-release - http://wcm.io/maven/repositories/apache-intermediate-release + https://wcm.io/maven/repositories/apache-intermediate-release default true @@ -83,7 +83,7 @@ apache-snapshots - http://repository.apache.org/snapshots + https://repository.apache.org/snapshots default false @@ -100,7 +100,7 @@ central - http://repo1.maven.org/maven2/ + https://repo1.maven.org/maven2/ default true @@ -126,7 +126,7 @@ wcm-io-apache-intermediate-release - http://wcm.io/maven/repositories/apache-intermediate-release + https://wcm.io/maven/repositories/apache-intermediate-release default true @@ -152,7 +152,7 @@ apache-snapshots - http://repository.apache.org/snapshots + https://repository.apache.org/snapshots default false diff --git a/README.md b/README.md index b9e7d6c..83d13fd 100644 --- a/README.md +++ b/README.md @@ -1,9 +1,9 @@ - CONGA Plugin for Apache Sling + CONGA Plugin for Apache Sling ====== [![Build Status](https://travis-ci.org/wcm-io-devops/conga-sling-plugin.png?branch=develop)](https://travis-ci.org/wcm-io-devops/conga-sling-plugin) [![Code Coverage](https://codecov.io/gh/wcm-io-devops/conga-sling-plugin/branch/develop/graph/badge.svg)](https://codecov.io/gh/wcm-io-devops/conga-sling-plugin) -Documentation: http://devops.wcm.io/conga/plugins/sling/
+Documentation: https://devops.wcm.io/conga/plugins/sling/
Issues: https://wcm-io.atlassian.net/projects/WDCONGA
Wiki: https://wcm-io.atlassian.net/wiki/
Continuous Integration: https://travis-ci.org/conga-sling-plugin @@ -11,7 +11,7 @@ Continuous Integration: https://travis-ci.org/conga-sling-plugin ## Build from sources -If you want to build from sources make sure you have configured all [Maven Repositories](http://devops.wcm.io/maven.html) in your settings.xml. +If you want to build from sources make sure you have configured all [Maven Repositories](https://devops.wcm.io/maven.html) in your settings.xml. See [Travis Maven settings.xml](https://github.com/conga-sling-plugin/blob/master/.travis.maven-settings.xml) for an example with a full configuration. diff --git a/conga-sling-plugin/pom.xml b/conga-sling-plugin/pom.xml index 62e94ab..c9f402a 100644 --- a/conga-sling-plugin/pom.xml +++ b/conga-sling-plugin/pom.xml @@ -25,7 +25,7 @@ io.wcm.devops io.wcm.devops.parent_toplevel - 1.1.4 + 1.1.5-SNAPSHOT diff --git a/pom.xml b/pom.xml index 02c90c3..beebd64 100644 --- a/pom.xml +++ b/pom.xml @@ -23,7 +23,7 @@ io.wcm.devops io.wcm.devops.parent_toplevel - 1.1.4 + 1.1.5-SNAPSHOT diff --git a/src/site/markdown/extensions.md b/src/site/markdown/extensions.md index a1e859e..ab66a3c 100644 --- a/src/site/markdown/extensions.md +++ b/src/site/markdown/extensions.md @@ -22,5 +22,5 @@ The Sling Provisioning Model file format is described on the [Sling Website][sli You can use a Handlebars template to generate a provisioning file. When the post processor `sling-provisioning` is applied to this file the single Felix OSGi .config files are generated out of it and the provisioning file is deleted. -[conga-extensibility]: http://devops.wcm.io/conga/extensibility.html +[conga-extensibility]: https://devops.wcm.io/conga/extensibility.html [sling-slingstart]: https://sling.apache.org/documentation/development/slingstart.html diff --git a/src/site/markdown/index.md b/src/site/markdown/index.md index 40c557e..7a66090 100644 --- a/src/site/markdown/index.md +++ b/src/site/markdown/index.md @@ -23,7 +23,7 @@ This plugin extends [CONGA][conga] with: ### Further Resources -* [wcm.io CONGA training material with exercises](http://training.wcm.io/conga/) +* [wcm.io CONGA training material with exercises](https://training.wcm.io/conga/) * [adaptTo() 2015 Talk: CONGA - Configuration generation for Sling and AEM](https://adapt.to/2015/en/schedule/conga---configuration-generation-for-sling-and-aem.html) * [adaptTo() 2017 Talk: Automate AEM Deployment with Ansible and wcm.io CONGA](https://adapt.to/2017/en/schedule/automate-aem-deployment-with-ansible-and-wcm-io-conga.html) @@ -33,7 +33,7 @@ This plugin extends [CONGA][conga] with: [extensions]: extensions.html [apidocs]: conga-sling-plugin/apidocs/ [changelog]: changes-report.html -[conga]: http://devops.wcm.io/conga/ +[conga]: https://devops.wcm.io/conga/ [sling]: http://sling.apache.org/ [sling-provisioning]: https://sling.apache.org/documentation/development/slingstart.html [felix-configadmin]: http://felix.apache.org/documentation/subprojects/apache-felix-config-admin.html diff --git a/src/site/markdown/usage.md b/src/site/markdown/usage.md index fa20524..bbf726e 100644 --- a/src/site/markdown/usage.md +++ b/src/site/markdown/usage.md @@ -8,4 +8,4 @@ https://github.com/wcm-io-devops/conga-sling-plugin In a subdirectory `example`. -[conga-usage]: http://devops.wcm.io/conga/usage.html +[conga-usage]: https://devops.wcm.io/conga/usage.html diff --git a/src/site/site.xml b/src/site/site.xml index e135c2b..0e61d02 100644 --- a/src/site/site.xml +++ b/src/site/site.xml @@ -25,7 +25,7 @@ xsi:schemaLocation="http://maven.apache.org/DECORATION/1.3.0 http://maven.apache.org/xsd/decoration-1.3.0.xsd"> - ]]> + ]]> From 2d8e0d9fc9c6a7a684cca44d138889a869e82cc7 Mon Sep 17 00:00:00 2001 From: sseifert Date: Sun, 2 Jun 2019 11:53:03 +0200 Subject: [PATCH 06/27] switch to openjdk8 --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index e7d14be..0d033d6 100644 --- a/.travis.yml +++ b/.travis.yml @@ -20,7 +20,7 @@ language: java jdk: -- oraclejdk8 +- openjdk8 - openjdk11 # Make sure travis can use container-based infrastructure From 858ad01902179c19188b6288156c1704cca30452 Mon Sep 17 00:00:00 2001 From: sseifert Date: Wed, 26 Jun 2019 18:34:50 +0200 Subject: [PATCH 07/27] update dependency --- conga-sling-plugin/pom.xml | 2 +- pom.xml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/conga-sling-plugin/pom.xml b/conga-sling-plugin/pom.xml index c9f402a..5ad2e00 100644 --- a/conga-sling-plugin/pom.xml +++ b/conga-sling-plugin/pom.xml @@ -25,7 +25,7 @@ io.wcm.devops io.wcm.devops.parent_toplevel - 1.1.5-SNAPSHOT + 1.1.6 diff --git a/pom.xml b/pom.xml index beebd64..4b6313b 100644 --- a/pom.xml +++ b/pom.xml @@ -23,7 +23,7 @@ io.wcm.devops io.wcm.devops.parent_toplevel - 1.1.5-SNAPSHOT + 1.1.6 From a2031f13b99fde962c0d81a4e8983d7b22240729 Mon Sep 17 00:00:00 2001 From: sseifert Date: Wed, 14 Aug 2019 18:36:12 +0200 Subject: [PATCH 08/27] switch to latest decoration XML Schema --- src/site/site.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/site/site.xml b/src/site/site.xml index 0e61d02..86001fd 100644 --- a/src/site/site.xml +++ b/src/site/site.xml @@ -20,9 +20,9 @@ --> + xsi:schemaLocation="http://maven.apache.org/DECORATION/1.8.0 http://maven.apache.org/xsd/decoration-1.8.0.xsd"> ]]> From 93f5464123f997a49604cc40ef2e7101714656be Mon Sep 17 00:00:00 2001 From: sseifert Date: Fri, 27 Dec 2019 12:03:07 +0100 Subject: [PATCH 09/27] update dependencies fix some code style warnings --- conga-sling-plugin/pom.xml | 2 +- .../postprocessor/ProvisioningOsgiConfigPostProcessor.java | 1 - pom.xml | 2 +- 3 files changed, 2 insertions(+), 3 deletions(-) diff --git a/conga-sling-plugin/pom.xml b/conga-sling-plugin/pom.xml index 5ad2e00..e215ef4 100644 --- a/conga-sling-plugin/pom.xml +++ b/conga-sling-plugin/pom.xml @@ -25,7 +25,7 @@ io.wcm.devops io.wcm.devops.parent_toplevel - 1.1.6 + 1.1.7-SNAPSHOT diff --git a/conga-sling-plugin/src/main/java/io/wcm/devops/conga/plugins/sling/postprocessor/ProvisioningOsgiConfigPostProcessor.java b/conga-sling-plugin/src/main/java/io/wcm/devops/conga/plugins/sling/postprocessor/ProvisioningOsgiConfigPostProcessor.java index f94425b..6e4f5ec 100644 --- a/conga-sling-plugin/src/main/java/io/wcm/devops/conga/plugins/sling/postprocessor/ProvisioningOsgiConfigPostProcessor.java +++ b/conga-sling-plugin/src/main/java/io/wcm/devops/conga/plugins/sling/postprocessor/ProvisioningOsgiConfigPostProcessor.java @@ -80,7 +80,6 @@ public List apply(FileContext fileContext, PostProcessorContext con * @param model Provisioning Model * @param dir Target directory * @param context Post processor context - * @throws IOException */ private List generateOsgiConfigurations(Model model, File dir, PostProcessorContext context) throws IOException { return ProvisioningUtil.visitOsgiConfigurations(model, new ConfigConsumer() { diff --git a/pom.xml b/pom.xml index 4b6313b..69a39c2 100644 --- a/pom.xml +++ b/pom.xml @@ -23,7 +23,7 @@ io.wcm.devops io.wcm.devops.parent_toplevel - 1.1.6 + 1.1.7-SNAPSHOT From a517d784d97af54e57242ce82999f6ea81d082d6 Mon Sep 17 00:00:00 2001 From: sseifert Date: Wed, 8 Jan 2020 14:29:11 +0100 Subject: [PATCH 10/27] update git ignore settings --- .gitignore | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.gitignore b/.gitignore index 956ee98..cb0de5f 100644 --- a/.gitignore +++ b/.gitignore @@ -16,14 +16,19 @@ npm-debug.log .settings .externalToolBuilders .pmd +.eclipse-pmd .checkstyle .idea .vagrant *.iml .DS_Store +*.retry .rubygems .sass-cache .rubygems-gem-maven-plugin *.sublime-* *nbactions*.xml .temp/ +.vlt +.vlt-sync* +.brackets.json From 28b0b561c18540d911bcae39cbc317410ed07ab7 Mon Sep 17 00:00:00 2001 From: sseifert Date: Wed, 8 Jan 2020 17:12:12 +0100 Subject: [PATCH 11/27] eliminate SpotBugs/PMD warnings --- .../plugins/sling/util/ConfigurationHandler_ConfigAdmin184.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/conga-sling-plugin/src/main/java/io/wcm/devops/conga/plugins/sling/util/ConfigurationHandler_ConfigAdmin184.java b/conga-sling-plugin/src/main/java/io/wcm/devops/conga/plugins/sling/util/ConfigurationHandler_ConfigAdmin184.java index 1019308..125f03f 100644 --- a/conga-sling-plugin/src/main/java/io/wcm/devops/conga/plugins/sling/util/ConfigurationHandler_ConfigAdmin184.java +++ b/conga-sling-plugin/src/main/java/io/wcm/devops/conga/plugins/sling/util/ConfigurationHandler_ConfigAdmin184.java @@ -66,7 +66,7 @@ * */ //CHECKSTYLE:OFF -@SuppressWarnings({ "unchecked", "unused", "javadoc" }) +@SuppressWarnings({ "unchecked", "unused", "javadoc", "PMD" }) class ConfigurationHandler_ConfigAdmin184 { protected static final String ENCODING = "UTF-8"; From 9172e4fb7dfd289b7396cae4d306ede9268933e3 Mon Sep 17 00:00:00 2001 From: sseifert Date: Wed, 8 Jan 2020 17:58:11 +0100 Subject: [PATCH 12/27] eliminate SpotBugs/PMD warnings --- .../sling/util/ConfigurationHandler_ConfigAdmin184.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/conga-sling-plugin/src/main/java/io/wcm/devops/conga/plugins/sling/util/ConfigurationHandler_ConfigAdmin184.java b/conga-sling-plugin/src/main/java/io/wcm/devops/conga/plugins/sling/util/ConfigurationHandler_ConfigAdmin184.java index 125f03f..d165d91 100644 --- a/conga-sling-plugin/src/main/java/io/wcm/devops/conga/plugins/sling/util/ConfigurationHandler_ConfigAdmin184.java +++ b/conga-sling-plugin/src/main/java/io/wcm/devops/conga/plugins/sling/util/ConfigurationHandler_ConfigAdmin184.java @@ -42,6 +42,8 @@ import org.apache.felix.cm.file.FilePersistenceManager; +import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; + /* * This file is COPIED from the sources of org.apache.felix.configadmin 1.8.4 * to write the configuration using the old (single line) array style, which is required to support @@ -67,6 +69,7 @@ */ //CHECKSTYLE:OFF @SuppressWarnings({ "unchecked", "unused", "javadoc", "PMD" }) +@SuppressFBWarnings({ "PERFORMANCE", "STYLE" }) class ConfigurationHandler_ConfigAdmin184 { protected static final String ENCODING = "UTF-8"; From 68d5a06412292de8e2863c51688a5e889f512651 Mon Sep 17 00:00:00 2001 From: sseifert Date: Thu, 9 Jan 2020 13:41:12 +0100 Subject: [PATCH 13/27] update dependency --- conga-sling-plugin/pom.xml | 2 +- example/pom.xml | 2 +- pom.xml | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/conga-sling-plugin/pom.xml b/conga-sling-plugin/pom.xml index e215ef4..fd514ed 100644 --- a/conga-sling-plugin/pom.xml +++ b/conga-sling-plugin/pom.xml @@ -25,7 +25,7 @@ io.wcm.devops io.wcm.devops.parent_toplevel - 1.1.7-SNAPSHOT + 1.2.0 diff --git a/example/pom.xml b/example/pom.xml index 0a0dffc..cbd59eb 100644 --- a/example/pom.xml +++ b/example/pom.xml @@ -26,7 +26,7 @@ io.wcm.maven io.wcm.maven.global-parent - 25 + 30 diff --git a/pom.xml b/pom.xml index 69a39c2..4b6cccd 100644 --- a/pom.xml +++ b/pom.xml @@ -23,7 +23,7 @@ io.wcm.devops io.wcm.devops.parent_toplevel - 1.1.7-SNAPSHOT + 1.2.0 From a36d4511004c385730ad545eb1ce6506e277975a Mon Sep 17 00:00:00 2001 From: sseifert Date: Wed, 12 Feb 2020 12:14:41 +0100 Subject: [PATCH 14/27] switch to HTTPs maven schema URL --- conga-sling-plugin/pom.xml | 2 +- example/pom.xml | 2 +- pom.xml | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/conga-sling-plugin/pom.xml b/conga-sling-plugin/pom.xml index fd514ed..4b61b78 100644 --- a/conga-sling-plugin/pom.xml +++ b/conga-sling-plugin/pom.xml @@ -19,7 +19,7 @@ #L% --> - + 4.0.0 diff --git a/example/pom.xml b/example/pom.xml index cbd59eb..6bb6590 100644 --- a/example/pom.xml +++ b/example/pom.xml @@ -20,7 +20,7 @@ --> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 diff --git a/pom.xml b/pom.xml index 4b6cccd..90b6ca3 100644 --- a/pom.xml +++ b/pom.xml @@ -17,7 +17,7 @@ #L% --> - + 4.0.0 From 9c17d5767ab14a2adefff4c423e67f94877b8a7b Mon Sep 17 00:00:00 2001 From: Tobias Richter Date: Wed, 12 Feb 2020 14:08:11 +0100 Subject: [PATCH 15/27] Add Jenkinsfile --- Jenkinsfile | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 Jenkinsfile diff --git a/Jenkinsfile b/Jenkinsfile new file mode 100644 index 0000000..2232a71 --- /dev/null +++ b/Jenkinsfile @@ -0,0 +1,26 @@ +@Library('pipeline-library') pipelineLibrary +@Library('pv-pipeline-library') pvPipelineLibrary + + +import io.wcm.devops.jenkins.pipeline.ssh.SSHTarget + +import static de.provision.devops.jenkins.pipeline.utils.ConfigConstants.* +import static io.wcm.devops.jenkins.pipeline.utils.ConfigConstants.* + +// See: +// https://github.com/pro-vision/jenkins-pv-pipeline-library +// https://github.com/pro-vision/jenkins-pv-pipeline-library/blob/master/docs/config-structure.md +// Also have a look at https://github.com/wcm-io-devops/jenkins-pipeline-library for further configuration options + +Map config = [ + (BUILD_WRAPPER): [ + (BUILD_WRAPPER_SSH_TARGETS): [new SSHTarget("ssh-wcm.io")] + ], + (STAGE_COMPILE): [ + (MAVEN): [ + (MAVEN_GOALS): ["clean", "deploy", "site-deploy"], + ] + ] +] + +routeDefaultJenkinsFile(config) From 9fce1e3625e8153164f49f00332a26ad1c4bf911 Mon Sep 17 00:00:00 2001 From: sseifert Date: Fri, 14 Feb 2020 17:51:05 +0100 Subject: [PATCH 16/27] eliminate static code analysis warning --- .../postprocessor/ProvisioningOsgiConfigPostProcessor.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/conga-sling-plugin/src/main/java/io/wcm/devops/conga/plugins/sling/postprocessor/ProvisioningOsgiConfigPostProcessor.java b/conga-sling-plugin/src/main/java/io/wcm/devops/conga/plugins/sling/postprocessor/ProvisioningOsgiConfigPostProcessor.java index 6e4f5ec..e167b2e 100644 --- a/conga-sling-plugin/src/main/java/io/wcm/devops/conga/plugins/sling/postprocessor/ProvisioningOsgiConfigPostProcessor.java +++ b/conga-sling-plugin/src/main/java/io/wcm/devops/conga/plugins/sling/postprocessor/ProvisioningOsgiConfigPostProcessor.java @@ -28,6 +28,7 @@ import org.apache.sling.provisioning.model.Model; +import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; import io.wcm.devops.conga.generator.GeneratorException; import io.wcm.devops.conga.generator.spi.PostProcessorPlugin; import io.wcm.devops.conga.generator.spi.context.FileContext; @@ -57,6 +58,7 @@ public boolean accepts(FileContext file, PostProcessorContext context) { } @Override + @SuppressFBWarnings("RV_RETURN_VALUE_IGNORED_BAD_PRACTICE") public List apply(FileContext fileContext, PostProcessorContext context) { File file = fileContext.getFile(); try { @@ -84,6 +86,7 @@ public List apply(FileContext fileContext, PostProcessorContext con private List generateOsgiConfigurations(Model model, File dir, PostProcessorContext context) throws IOException { return ProvisioningUtil.visitOsgiConfigurations(model, new ConfigConsumer() { @Override + @SuppressFBWarnings("RV_RETURN_VALUE_IGNORED_BAD_PRACTICE") public FileContext accept(String path, Dictionary properties) throws IOException { context.getLogger().info(" Generate " + path); From 26714b5ba9689e3060032b5473d10c75d0e26784 Mon Sep 17 00:00:00 2001 From: Tobias Richter Date: Mon, 17 Feb 2020 18:06:39 +0100 Subject: [PATCH 17/27] Enable github triggers --- Jenkinsfile | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Jenkinsfile b/Jenkinsfile index 2232a71..4f69191 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -12,10 +12,16 @@ import static io.wcm.devops.jenkins.pipeline.utils.ConfigConstants.* // https://github.com/pro-vision/jenkins-pv-pipeline-library/blob/master/docs/config-structure.md // Also have a look at https://github.com/wcm-io-devops/jenkins-pipeline-library for further configuration options +List triggers = defaults.getTriggers() +triggers.push(githubPush()) + Map config = [ (BUILD_WRAPPER): [ (BUILD_WRAPPER_SSH_TARGETS): [new SSHTarget("ssh-wcm.io")] ], + (PROPERTIES) : [ + (PROPERTIES_PIPELINE_TRIGGERS): triggers + ], (STAGE_COMPILE): [ (MAVEN): [ (MAVEN_GOALS): ["clean", "deploy", "site-deploy"], From 7c1a617e64e2e2426cace311b456ea72b4866e6f Mon Sep 17 00:00:00 2001 From: Tobias Richter Date: Tue, 18 Feb 2020 13:05:10 +0100 Subject: [PATCH 18/27] Disable merge of feature branches with parent in Jenkins CI --- Jenkinsfile | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Jenkinsfile b/Jenkinsfile index 4f69191..9acec44 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -26,6 +26,11 @@ Map config = [ (MAVEN): [ (MAVEN_GOALS): ["clean", "deploy", "site-deploy"], ] + ], + (STAGE_FEATURE_PREPARATION): [ + (STAGE_FEATURE_PREPARATION_MERGE): [ + (STAGE_FEATURE_PREPARATION_MERGE_ENABLED): false + ] ] ] From b1214ba68d6121e08798ab830d1f2ba16ce69b20 Mon Sep 17 00:00:00 2001 From: sseifert Date: Tue, 10 Mar 2020 11:46:25 +0100 Subject: [PATCH 19/27] update dependency --- conga-sling-plugin/pom.xml | 2 +- pom.xml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/conga-sling-plugin/pom.xml b/conga-sling-plugin/pom.xml index 4b61b78..7c68639 100644 --- a/conga-sling-plugin/pom.xml +++ b/conga-sling-plugin/pom.xml @@ -25,7 +25,7 @@ io.wcm.devops io.wcm.devops.parent_toplevel - 1.2.0 + 1.2.1-SNAPSHOT diff --git a/pom.xml b/pom.xml index 90b6ca3..d1778a7 100644 --- a/pom.xml +++ b/pom.xml @@ -23,7 +23,7 @@ io.wcm.devops io.wcm.devops.parent_toplevel - 1.2.0 + 1.2.1-SNAPSHOT From a1ccc5045a70a220a5c2e28b0c8d593d2a340821 Mon Sep 17 00:00:00 2001 From: sseifert Date: Mon, 30 Mar 2020 10:59:05 +0200 Subject: [PATCH 20/27] Provisioning file format escaping rules: Escape variable expressions ${...} in values to ensure they are passed through and not interpreted as provisioning file variables. --- changes.xml | 6 ++++++ .../ProvisioningEscapingStrategy.java | 21 ++++++++++++++++++- .../ProvisioningEscapingStrategyTest.java | 5 +++++ ...ovisioningOsgiConfigPostProcessorTest.java | 13 ++++++++++++ .../validator/ProvisioningValidatorTest.java | 10 ++++++++- .../validProvisioningEscapedVariable.txt | 6 ++++++ 6 files changed, 59 insertions(+), 2 deletions(-) create mode 100644 conga-sling-plugin/src/test/resources/validProvisioningEscapedVariable.txt diff --git a/changes.xml b/changes.xml index 9d9c49a..853af84 100644 --- a/changes.xml +++ b/changes.xml @@ -23,6 +23,12 @@ xsi:schemaLocation="http://maven.apache.org/changes/1.0.0 http://maven.apache.org/plugins/maven-changes-plugin/xsd/changes-1.0.0.xsd"> + + + Provisioning file format escaping rules: Escape variable expressions ${...} in values to ensure they are passed through and not interpreted as provisioning file variables. + + + Read Felix ConfigAdmin configuration files with latest version (1.9.14), but write it using the old file format form ConfigAdmin 1.8.4 to support AEM 6.1 and below. diff --git a/conga-sling-plugin/src/main/java/io/wcm/devops/conga/plugins/sling/handlebars/escaping/ProvisioningEscapingStrategy.java b/conga-sling-plugin/src/main/java/io/wcm/devops/conga/plugins/sling/handlebars/escaping/ProvisioningEscapingStrategy.java index c9f538b..4d8cd34 100644 --- a/conga-sling-plugin/src/main/java/io/wcm/devops/conga/plugins/sling/handlebars/escaping/ProvisioningEscapingStrategy.java +++ b/conga-sling-plugin/src/main/java/io/wcm/devops/conga/plugins/sling/handlebars/escaping/ProvisioningEscapingStrategy.java @@ -19,6 +19,9 @@ */ package io.wcm.devops.conga.plugins.sling.handlebars.escaping; +import java.util.regex.Matcher; +import java.util.regex.Pattern; + import io.wcm.devops.conga.generator.spi.handlebars.EscapingStrategyPlugin; import io.wcm.devops.conga.generator.spi.handlebars.context.EscapingStrategyContext; import io.wcm.devops.conga.generator.util.FileUtil; @@ -34,6 +37,8 @@ public class ProvisioningEscapingStrategy implements EscapingStrategyPlugin { */ public static final String NAME = "sling-provisioning"; + private static final Pattern VARIABLE_PATTERN = Pattern.compile("\\$\\{([^\\{\\}]+)\\}"); + @Override public String getName() { return NAME; @@ -47,8 +52,22 @@ public boolean accepts(String fileExtension, EscapingStrategyContext pluginConte @Override public String escape(CharSequence value, EscapingStrategyContext pluginContext) { + if (value == null) { + return null; + } + // use same escaping rules as for OSGi configurations - return value == null ? null : OsgiConfigEscapingStrategy.ESCAPE_OSGI_CONFIG.translate(value); + String escapedValue = OsgiConfigEscapingStrategy.ESCAPE_OSGI_CONFIG.translate(value); + + // escape variables ${...} with \${...} - otherwise lead to "Unknown variable" error when validating sling provisioning file + StringBuffer result = new StringBuffer(); + Matcher matcher = VARIABLE_PATTERN.matcher(escapedValue); + while (matcher.find()) { + matcher.appendReplacement(result, "\\\\\\$\\{" + matcher.group(1) + "\\}"); + } + matcher.appendTail(result); + + return result.toString(); } } diff --git a/conga-sling-plugin/src/test/java/io/wcm/devops/conga/plugins/sling/handlebars/escaping/ProvisioningEscapingStrategyTest.java b/conga-sling-plugin/src/test/java/io/wcm/devops/conga/plugins/sling/handlebars/escaping/ProvisioningEscapingStrategyTest.java index ac59428..3b82c73 100644 --- a/conga-sling-plugin/src/test/java/io/wcm/devops/conga/plugins/sling/handlebars/escaping/ProvisioningEscapingStrategyTest.java +++ b/conga-sling-plugin/src/test/java/io/wcm/devops/conga/plugins/sling/handlebars/escaping/ProvisioningEscapingStrategyTest.java @@ -45,6 +45,11 @@ public void testValid() { assertEquals("äöü߀/", underTest.escape("äöü߀/", null)); } + @Test + public void testEscapeVariables() { + assertEquals("\\${var1}\\ and\\ \\${var2}", underTest.escape("${var1} and ${var2}", null)); + } + @Test public void testInvalid() { assertFalse(underTest.accepts("txt", null)); diff --git a/conga-sling-plugin/src/test/java/io/wcm/devops/conga/plugins/sling/postprocessor/ProvisioningOsgiConfigPostProcessorTest.java b/conga-sling-plugin/src/test/java/io/wcm/devops/conga/plugins/sling/postprocessor/ProvisioningOsgiConfigPostProcessorTest.java index 9a63791..d66201f 100644 --- a/conga-sling-plugin/src/test/java/io/wcm/devops/conga/plugins/sling/postprocessor/ProvisioningOsgiConfigPostProcessorTest.java +++ b/conga-sling-plugin/src/test/java/io/wcm/devops/conga/plugins/sling/postprocessor/ProvisioningOsgiConfigPostProcessorTest.java @@ -129,6 +129,19 @@ public void testSimpleConfigWithNewline() throws Exception { assertEquals("foo", config.get("foo")); } + @Test + public void testEscapedVariable() throws Exception { + + // post process example valid provisioning file + File provisioningFile = new File(targetDir, "provisioningExample.txt"); + FileUtils.copyFile(new File(getClass().getResource("/validProvisioningEscapedVariable.txt").toURI()), provisioningFile); + postProcess(provisioningFile); + + // validate generated configs + Dictionary config = readConfig("my.pid.config"); + assertEquals("${var1} and ${var2}", config.get("stringProperty")); + } + private void postProcess(File provisioningFile) { // post-process FileContext fileContext = new FileContext() diff --git a/conga-sling-plugin/src/test/java/io/wcm/devops/conga/plugins/sling/validator/ProvisioningValidatorTest.java b/conga-sling-plugin/src/test/java/io/wcm/devops/conga/plugins/sling/validator/ProvisioningValidatorTest.java index 8da1cc5..6c1ca8e 100644 --- a/conga-sling-plugin/src/test/java/io/wcm/devops/conga/plugins/sling/validator/ProvisioningValidatorTest.java +++ b/conga-sling-plugin/src/test/java/io/wcm/devops/conga/plugins/sling/validator/ProvisioningValidatorTest.java @@ -34,7 +34,7 @@ import io.wcm.devops.conga.generator.spi.context.FileContext; import io.wcm.devops.conga.generator.util.PluginManagerImpl; -public class ProvisioningValidatorTest { +class ProvisioningValidatorTest { private ValidatorPlugin underTest; @@ -68,4 +68,12 @@ public void testInvalidFileExtension() throws Exception { assertFalse(underTest.accepts(fileContext, null)); } + @Test + void testEscapedVariable() throws Exception { + File file = new File(getClass().getResource("/validProvisioningEscapedVariable.txt").toURI()); + FileContext fileContext = new FileContext().file(file).charset(StandardCharsets.UTF_8); + assertTrue(underTest.accepts(fileContext, null)); + underTest.apply(fileContext, null); + } + } diff --git a/conga-sling-plugin/src/test/resources/validProvisioningEscapedVariable.txt b/conga-sling-plugin/src/test/resources/validProvisioningEscapedVariable.txt new file mode 100644 index 0000000..a97d912 --- /dev/null +++ b/conga-sling-plugin/src/test/resources/validProvisioningEscapedVariable.txt @@ -0,0 +1,6 @@ +[feature name=test] + +[configurations] + + my.pid + stringProperty="\${var1} and \${var2}" From ab687c9bf8d7625531fda3d6475a904289676a5b Mon Sep 17 00:00:00 2001 From: sseifert Date: Mon, 30 Mar 2020 11:00:58 +0200 Subject: [PATCH 21/27] cosmetic: test classes do not need to be public --- .../sling/fileheader/OsgiConfigFileHeaderTest.java | 6 +++--- .../fileheader/ProvisioningFileHeaderTest.java | 6 +++--- .../escaping/OsgiConfigEscapingStrategyTest.java | 10 +++++----- .../escaping/ProvisioningEscapingStrategyTest.java | 10 +++++----- .../ProvisioningOsgiConfigPostProcessorTest.java | 14 +++++++------- .../sling/validator/ProvisioningValidatorTest.java | 8 ++++---- 6 files changed, 27 insertions(+), 27 deletions(-) diff --git a/conga-sling-plugin/src/test/java/io/wcm/devops/conga/plugins/sling/fileheader/OsgiConfigFileHeaderTest.java b/conga-sling-plugin/src/test/java/io/wcm/devops/conga/plugins/sling/fileheader/OsgiConfigFileHeaderTest.java index 8bf85d1..c17755d 100644 --- a/conga-sling-plugin/src/test/java/io/wcm/devops/conga/plugins/sling/fileheader/OsgiConfigFileHeaderTest.java +++ b/conga-sling-plugin/src/test/java/io/wcm/devops/conga/plugins/sling/fileheader/OsgiConfigFileHeaderTest.java @@ -41,17 +41,17 @@ /** * WARNING: Test is disabled, see {@link OsgiConfigFileHeader} javadocs. */ -public class OsgiConfigFileHeaderTest { +class OsgiConfigFileHeaderTest { private FileHeaderPlugin underTest; @BeforeEach - public void setUp() { + void setUp() { underTest = new PluginManagerImpl().get(OsgiConfigFileHeader.NAME, FileHeaderPlugin.class); } @Test - public void testApply() throws Exception { + void testApply() throws Exception { File file = new File("target/generation-test/fileHeader.config"); FileUtils.write(file, "myscript", StandardCharsets.UTF_8); diff --git a/conga-sling-plugin/src/test/java/io/wcm/devops/conga/plugins/sling/fileheader/ProvisioningFileHeaderTest.java b/conga-sling-plugin/src/test/java/io/wcm/devops/conga/plugins/sling/fileheader/ProvisioningFileHeaderTest.java index d21e788..392f55e 100644 --- a/conga-sling-plugin/src/test/java/io/wcm/devops/conga/plugins/sling/fileheader/ProvisioningFileHeaderTest.java +++ b/conga-sling-plugin/src/test/java/io/wcm/devops/conga/plugins/sling/fileheader/ProvisioningFileHeaderTest.java @@ -38,17 +38,17 @@ import io.wcm.devops.conga.generator.spi.context.FileHeaderContext; import io.wcm.devops.conga.generator.util.PluginManagerImpl; -public class ProvisioningFileHeaderTest { +class ProvisioningFileHeaderTest { private FileHeaderPlugin underTest; @BeforeEach - public void setUp() { + void setUp() { underTest = new PluginManagerImpl().get(ProvisioningFileHeader.NAME, FileHeaderPlugin.class); } @Test - public void testApply() throws Exception { + void testApply() throws Exception { File file = new File("target/generation-test/fileHeader.txt"); FileUtils.copyFile(new File(getClass().getResource("/validProvisioning.txt").toURI()), file); diff --git a/conga-sling-plugin/src/test/java/io/wcm/devops/conga/plugins/sling/handlebars/escaping/OsgiConfigEscapingStrategyTest.java b/conga-sling-plugin/src/test/java/io/wcm/devops/conga/plugins/sling/handlebars/escaping/OsgiConfigEscapingStrategyTest.java index 433d9bb..4c062fc 100644 --- a/conga-sling-plugin/src/test/java/io/wcm/devops/conga/plugins/sling/handlebars/escaping/OsgiConfigEscapingStrategyTest.java +++ b/conga-sling-plugin/src/test/java/io/wcm/devops/conga/plugins/sling/handlebars/escaping/OsgiConfigEscapingStrategyTest.java @@ -29,27 +29,27 @@ import io.wcm.devops.conga.generator.spi.handlebars.EscapingStrategyPlugin; import io.wcm.devops.conga.generator.util.PluginManagerImpl; -public class OsgiConfigEscapingStrategyTest { +class OsgiConfigEscapingStrategyTest { private EscapingStrategyPlugin underTest; @BeforeEach - public void setUp() { + void setUp() { underTest = new PluginManagerImpl().get(OsgiConfigEscapingStrategy.NAME, EscapingStrategyPlugin.class); } @Test - public void testValid() { + void testValid() { assertTrue(underTest.accepts("config", null)); } @Test - public void testInvalid() { + void testInvalid() { assertFalse(underTest.accepts("txt", null)); } @Test - public void testEscape() { + void testEscape() { assertEquals("\\ \\\"\\\\", underTest.escape(" \"\\", null)); assertEquals("äöü߀/", underTest.escape("äöü߀/", null)); assertEquals("aa\\=bb", underTest.escape("aa=bb", null)); diff --git a/conga-sling-plugin/src/test/java/io/wcm/devops/conga/plugins/sling/handlebars/escaping/ProvisioningEscapingStrategyTest.java b/conga-sling-plugin/src/test/java/io/wcm/devops/conga/plugins/sling/handlebars/escaping/ProvisioningEscapingStrategyTest.java index 3b82c73..197efe5 100644 --- a/conga-sling-plugin/src/test/java/io/wcm/devops/conga/plugins/sling/handlebars/escaping/ProvisioningEscapingStrategyTest.java +++ b/conga-sling-plugin/src/test/java/io/wcm/devops/conga/plugins/sling/handlebars/escaping/ProvisioningEscapingStrategyTest.java @@ -29,29 +29,29 @@ import io.wcm.devops.conga.generator.spi.handlebars.EscapingStrategyPlugin; import io.wcm.devops.conga.generator.util.PluginManagerImpl; -public class ProvisioningEscapingStrategyTest { +class ProvisioningEscapingStrategyTest { private EscapingStrategyPlugin underTest; @BeforeEach - public void setUp() { + void setUp() { underTest = new PluginManagerImpl().get(ProvisioningEscapingStrategy.NAME, EscapingStrategyPlugin.class); } @Test - public void testValid() { + void testValid() { assertTrue(underTest.accepts("provisioning", null)); assertEquals("\\ \\\"\\\\", underTest.escape(" \"\\", null)); assertEquals("äöü߀/", underTest.escape("äöü߀/", null)); } @Test - public void testEscapeVariables() { + void testEscapeVariables() { assertEquals("\\${var1}\\ and\\ \\${var2}", underTest.escape("${var1} and ${var2}", null)); } @Test - public void testInvalid() { + void testInvalid() { assertFalse(underTest.accepts("txt", null)); } diff --git a/conga-sling-plugin/src/test/java/io/wcm/devops/conga/plugins/sling/postprocessor/ProvisioningOsgiConfigPostProcessorTest.java b/conga-sling-plugin/src/test/java/io/wcm/devops/conga/plugins/sling/postprocessor/ProvisioningOsgiConfigPostProcessorTest.java index d66201f..ae47dec 100644 --- a/conga-sling-plugin/src/test/java/io/wcm/devops/conga/plugins/sling/postprocessor/ProvisioningOsgiConfigPostProcessorTest.java +++ b/conga-sling-plugin/src/test/java/io/wcm/devops/conga/plugins/sling/postprocessor/ProvisioningOsgiConfigPostProcessorTest.java @@ -47,14 +47,14 @@ import io.wcm.devops.conga.generator.spi.context.PostProcessorContext; import io.wcm.devops.conga.generator.util.PluginManagerImpl; -public class ProvisioningOsgiConfigPostProcessorTest { +class ProvisioningOsgiConfigPostProcessorTest { private PostProcessorPlugin underTest; private File targetDir; @BeforeEach - public void setUp() throws IOException { + void setUp() throws IOException { underTest = new PluginManagerImpl().get(ProvisioningOsgiConfigPostProcessor.NAME, PostProcessorPlugin.class); // prepare target dirctory @@ -65,12 +65,12 @@ public void setUp() throws IOException { } @AfterEach - public void tearDown() throws IOException { + void tearDown() throws IOException { FileUtils.deleteDirectory(targetDir); } @Test - public void testProvisioningExample() throws Exception { + void testProvisioningExample() throws Exception { // post process example valid provisioning file File provisioningFile = new File(targetDir, "provisioningExample.txt"); @@ -92,7 +92,7 @@ public void testProvisioningExample() throws Exception { } @Test - public void testSimpleConfig() throws Exception { + void testSimpleConfig() throws Exception { final String PROVISIONING_FILE = "[feature name=test]\n" + "[configurations]\n" + "com.example.ServiceConfiguration\n" @@ -111,7 +111,7 @@ public void testSimpleConfig() throws Exception { } @Test - public void testSimpleConfigWithNewline() throws Exception { + void testSimpleConfigWithNewline() throws Exception { final String PROVISIONING_FILE = "[feature name=test]\n" + "[configurations]\n" + "com.example.ServiceConfiguration\n" @@ -130,7 +130,7 @@ public void testSimpleConfigWithNewline() throws Exception { } @Test - public void testEscapedVariable() throws Exception { + void testEscapedVariable() throws Exception { // post process example valid provisioning file File provisioningFile = new File(targetDir, "provisioningExample.txt"); diff --git a/conga-sling-plugin/src/test/java/io/wcm/devops/conga/plugins/sling/validator/ProvisioningValidatorTest.java b/conga-sling-plugin/src/test/java/io/wcm/devops/conga/plugins/sling/validator/ProvisioningValidatorTest.java index 6c1ca8e..a0a3ed4 100644 --- a/conga-sling-plugin/src/test/java/io/wcm/devops/conga/plugins/sling/validator/ProvisioningValidatorTest.java +++ b/conga-sling-plugin/src/test/java/io/wcm/devops/conga/plugins/sling/validator/ProvisioningValidatorTest.java @@ -39,12 +39,12 @@ class ProvisioningValidatorTest { private ValidatorPlugin underTest; @BeforeEach - public void setUp() { + void setUp() { underTest = new PluginManagerImpl().get(ProvisioningValidator.NAME, ValidatorPlugin.class); } @Test - public void testValid() throws Exception { + void testValid() throws Exception { File file = new File(getClass().getResource("/validProvisioning.txt").toURI()); FileContext fileContext = new FileContext().file(file).charset(StandardCharsets.UTF_8); assertTrue(underTest.accepts(fileContext, null)); @@ -52,7 +52,7 @@ public void testValid() throws Exception { } @Test - public void testInvalid() throws Exception { + void testInvalid() throws Exception { File file = new File(getClass().getResource("/invalidProvisioning.txt").toURI()); FileContext fileContext = new FileContext().file(file).charset(StandardCharsets.UTF_8); assertTrue(underTest.accepts(fileContext, null)); @@ -62,7 +62,7 @@ public void testInvalid() throws Exception { } @Test - public void testInvalidFileExtension() throws Exception { + void testInvalidFileExtension() throws Exception { File file = new File(getClass().getResource("/noProvisioning.txt").toURI()); FileContext fileContext = new FileContext().file(file).charset(StandardCharsets.UTF_8); assertFalse(underTest.accepts(fileContext, null)); From 0fa27f14741a0ab03bf44af6e33c8e5ee2df411a Mon Sep 17 00:00:00 2001 From: sseifert Date: Tue, 14 Apr 2020 13:30:59 +0200 Subject: [PATCH 22/27] update dependencies --- conga-sling-plugin/pom.xml | 2 +- example/pom.xml | 2 +- pom.xml | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/conga-sling-plugin/pom.xml b/conga-sling-plugin/pom.xml index 7c68639..fc64ec5 100644 --- a/conga-sling-plugin/pom.xml +++ b/conga-sling-plugin/pom.xml @@ -25,7 +25,7 @@ io.wcm.devops io.wcm.devops.parent_toplevel - 1.2.1-SNAPSHOT + 1.2.2 diff --git a/example/pom.xml b/example/pom.xml index 6bb6590..1cdbdae 100644 --- a/example/pom.xml +++ b/example/pom.xml @@ -26,7 +26,7 @@ io.wcm.maven io.wcm.maven.global-parent - 30 + 32 diff --git a/pom.xml b/pom.xml index d1778a7..1034c31 100644 --- a/pom.xml +++ b/pom.xml @@ -23,7 +23,7 @@ io.wcm.devops io.wcm.devops.parent_toplevel - 1.2.1-SNAPSHOT + 1.2.2 From 1044467a6ab54180f0f47784cab4518e46348d8c Mon Sep 17 00:00:00 2001 From: sseifert Date: Tue, 14 Apr 2020 14:45:26 +0200 Subject: [PATCH 23/27] update dependency --- example/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/example/pom.xml b/example/pom.xml index 1cdbdae..76596f4 100644 --- a/example/pom.xml +++ b/example/pom.xml @@ -45,7 +45,7 @@ io.wcm.devops.conga conga-maven-plugin - 1.11.0 + 1.12.1-SNAPSHOT true From 27c2e3849ec4811666b54a30679f1debf8855d79 Mon Sep 17 00:00:00 2001 From: sseifert Date: Mon, 20 Apr 2020 19:52:23 +0200 Subject: [PATCH 24/27] Add support for [:repoinit] sections when generating OSGi configurations from Sling Provisioning files. --- changes.xml | 5 ++- conga-sling-plugin/pom.xml | 4 +- .../plugins/sling/util/ProvisioningUtil.java | 38 +++++++++++++++++++ ...ovisioningOsgiConfigPostProcessorTest.java | 23 ++++++----- .../src/test/resources/validProvisioning.txt | 11 ++++++ 5 files changed, 69 insertions(+), 12 deletions(-) diff --git a/changes.xml b/changes.xml index 853af84..dae59e7 100644 --- a/changes.xml +++ b/changes.xml @@ -23,7 +23,10 @@ xsi:schemaLocation="http://maven.apache.org/changes/1.0.0 http://maven.apache.org/plugins/maven-changes-plugin/xsd/changes-1.0.0.xsd"> - + + + Add support for [:repoinit] sections when generating OSGi configurations from Sling Provisioning files. + Provisioning file format escaping rules: Escape variable expressions ${...} in values to ensure they are passed through and not interpreted as provisioning file variables. diff --git a/conga-sling-plugin/pom.xml b/conga-sling-plugin/pom.xml index fc64ec5..e8f6df8 100644 --- a/conga-sling-plugin/pom.xml +++ b/conga-sling-plugin/pom.xml @@ -62,14 +62,14 @@ org.apache.felix org.apache.felix.configadmin - 1.9.14 + 1.9.16 compile org.apache.sling org.apache.sling.provisioning.model - 1.8.4 + 1.8.6 compile diff --git a/conga-sling-plugin/src/main/java/io/wcm/devops/conga/plugins/sling/util/ProvisioningUtil.java b/conga-sling-plugin/src/main/java/io/wcm/devops/conga/plugins/sling/util/ProvisioningUtil.java index 69f2847..3d766d0 100644 --- a/conga-sling-plugin/src/main/java/io/wcm/devops/conga/plugins/sling/util/ProvisioningUtil.java +++ b/conga-sling-plugin/src/main/java/io/wcm/devops/conga/plugins/sling/util/ProvisioningUtil.java @@ -38,6 +38,7 @@ import org.apache.sling.provisioning.model.ModelUtility; import org.apache.sling.provisioning.model.ModelUtility.ResolverOptions; import org.apache.sling.provisioning.model.RunMode; +import org.apache.sling.provisioning.model.Section; import org.apache.sling.provisioning.model.io.ModelReader; import com.google.common.collect.ImmutableList; @@ -60,6 +61,9 @@ public final class ProvisioningUtil { */ public static final String TEXT_FILE_EXTENSION = "txt"; + private static final String REPOINIT_SECTION = "repoinit"; + private static final String REPOINIT_PID = "org.apache.sling.jcr.repoinit.RepositoryInitializer"; + private ProvisioningUtil() { // static methods only } @@ -109,6 +113,8 @@ public static Model getModel(FileContext file) throws IOException { public static List visitOsgiConfigurations(Model model, ConfigConsumer consumer) throws IOException { List results = new ArrayList<>(); for (Feature feature : model.getFeatures()) { + + // OSGi configurations for (RunMode runMode : feature.getRunModes()) { for (Configuration configuration : runMode.getConfigurations()) { String path = getPathForConfiguration(configuration, runMode); @@ -118,6 +124,38 @@ public static List visitOsgiConfigurations(Model model, ConfigConsumer } } } + + // repoinit statements + for (Section section : feature.getAdditionalSections(REPOINIT_SECTION)) { + + // repoinit script + String script = section.getContents(); + if (StringUtils.isBlank(script)) { + continue; + } + + // associated run modes + String runModesString = section.getAttributes().get("runModes"); + RunMode runMode; + if (runModesString != null) { + runMode = new RunMode(StringUtils.split(runModesString, ",")); + } + else { + runMode = new RunMode(null); + } + + // prepare repoinit OSGi configuration + String pid = StringUtils.defaultString(feature.getName(), "conga") + + (runModesString != null ? "-" + StringUtils.replace(runModesString, ",", "-") : ""); + Configuration configuration = new Configuration(pid, REPOINIT_PID); + configuration.getProperties().put("scripts", new String[] { script }); + String path = getPathForConfiguration(configuration, runMode); + R result = consumer.accept(path, configuration.getProperties()); + if (result != null) { + results.add(result); + } + } + } return results; } diff --git a/conga-sling-plugin/src/test/java/io/wcm/devops/conga/plugins/sling/postprocessor/ProvisioningOsgiConfigPostProcessorTest.java b/conga-sling-plugin/src/test/java/io/wcm/devops/conga/plugins/sling/postprocessor/ProvisioningOsgiConfigPostProcessorTest.java index ae47dec..f5f7551 100644 --- a/conga-sling-plugin/src/test/java/io/wcm/devops/conga/plugins/sling/postprocessor/ProvisioningOsgiConfigPostProcessorTest.java +++ b/conga-sling-plugin/src/test/java/io/wcm/devops/conga/plugins/sling/postprocessor/ProvisioningOsgiConfigPostProcessorTest.java @@ -32,13 +32,12 @@ import java.io.InputStream; import java.nio.charset.StandardCharsets; import java.util.Dictionary; -import java.util.UUID; import org.apache.commons.io.FileUtils; import org.apache.felix.cm.file.ConfigurationHandler; -import org.junit.jupiter.api.AfterEach; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.TestInfo; import org.slf4j.LoggerFactory; import io.wcm.devops.conga.generator.spi.PostProcessorPlugin; @@ -54,21 +53,16 @@ class ProvisioningOsgiConfigPostProcessorTest { private File targetDir; @BeforeEach - void setUp() throws IOException { + void setUp(TestInfo testInfo) throws IOException { underTest = new PluginManagerImpl().get(ProvisioningOsgiConfigPostProcessor.NAME, PostProcessorPlugin.class); // prepare target dirctory - targetDir = new File("target/postprocessor-test_" + UUID.randomUUID().toString()); + targetDir = new File("target/postprocessor-test_" + testInfo.getDisplayName()); if (targetDir.exists()) { FileUtils.deleteDirectory(targetDir); } } - @AfterEach - void tearDown() throws IOException { - FileUtils.deleteDirectory(targetDir); - } - @Test void testProvisioningExample() throws Exception { @@ -89,6 +83,17 @@ void testProvisioningExample() throws Exception { assertExists("my.factory-my.pid.config"); assertExists("mode1/my.factory-my.pid2.config"); assertExists("mode2/my.pid2.config"); + + // validate repoinit statements + config = readConfig("org.apache.sling.jcr.repoinit.RepositoryInitializer-test.config"); + assertArrayEquals(new String[] {"create path /repoinit/test1\n" + + "create path /repoinit/test2\n" }, (String[])config.get("scripts")); + + config = readConfig("mode1/org.apache.sling.jcr.repoinit.RepositoryInitializer-test-mode1.config"); + assertArrayEquals(new String[] { "create service user mode1\n" }, (String[])config.get("scripts")); + + config = readConfig("mode1.mode2/org.apache.sling.jcr.repoinit.RepositoryInitializer-test-mode1-mode2.config"); + assertArrayEquals(new String[] { "create service user mode1_mode2" }, (String[])config.get("scripts")); } @Test diff --git a/conga-sling-plugin/src/test/resources/validProvisioning.txt b/conga-sling-plugin/src/test/resources/validProvisioning.txt index c6b45b7..4d6de17 100644 --- a/conga-sling-plugin/src/test/resources/validProvisioning.txt +++ b/conga-sling-plugin/src/test/resources/validProvisioning.txt @@ -22,3 +22,14 @@ my.pid2 stringProperty="value4" + + +[:repoinit] +create path /repoinit/test1 +create path /repoinit/test2 + +[:repoinit runModes=mode1] +create service user mode1 + +[:repoinit runModes=mode1,mode2] +create service user mode1_mode2 From 4653a3ed598ecc6df637f56d3ff8e1b140b3f5e8 Mon Sep 17 00:00:00 2001 From: sseifert Date: Thu, 23 Apr 2020 11:59:28 +0200 Subject: [PATCH 25/27] prepare release --- changes.xml | 2 +- example/pom.xml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/changes.xml b/changes.xml index dae59e7..e787f20 100644 --- a/changes.xml +++ b/changes.xml @@ -23,7 +23,7 @@ xsi:schemaLocation="http://maven.apache.org/changes/1.0.0 http://maven.apache.org/plugins/maven-changes-plugin/xsd/changes-1.0.0.xsd"> - + Add support for [:repoinit] sections when generating OSGi configurations from Sling Provisioning files. diff --git a/example/pom.xml b/example/pom.xml index 76596f4..f12febb 100644 --- a/example/pom.xml +++ b/example/pom.xml @@ -45,7 +45,7 @@ io.wcm.devops.conga conga-maven-plugin - 1.12.1-SNAPSHOT + 1.13.0 true From 5a3511934743068fd313c48dd0f7d7b2202fede0 Mon Sep 17 00:00:00 2001 From: sseifert Date: Thu, 23 Apr 2020 12:00:03 +0200 Subject: [PATCH 26/27] =?UTF-8?q?[jgitflow-maven-plugin]=C2=A0updating=20p?= =?UTF-8?q?oms=20for=201.3.0=20branch=20with=20snapshot=20versions?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- conga-sling-plugin/pom.xml | 2 +- pom.xml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/conga-sling-plugin/pom.xml b/conga-sling-plugin/pom.xml index e8f6df8..a13e060 100644 --- a/conga-sling-plugin/pom.xml +++ b/conga-sling-plugin/pom.xml @@ -31,7 +31,7 @@ io.wcm.devops.conga.plugins io.wcm.devops.conga.plugins.sling - 1.2.7-SNAPSHOT + 1.3.0-SNAPSHOT jar CONGA Sling Plugin diff --git a/pom.xml b/pom.xml index 1034c31..0e93b08 100644 --- a/pom.xml +++ b/pom.xml @@ -29,7 +29,7 @@ io.wcm.devops.conga.plugins io.wcm.devops.conga.plugins.sling.root - 1.2.7-SNAPSHOT + 1.3.0-SNAPSHOT pom CONGA Sling Plugin From be2b1a8b768c935fdd74abcb2d151548ba204b23 Mon Sep 17 00:00:00 2001 From: sseifert Date: Thu, 23 Apr 2020 12:00:08 +0200 Subject: [PATCH 27/27] =?UTF-8?q?[jgitflow-maven-plugin]=C2=A0updating=20p?= =?UTF-8?q?oms=20for=20branch'release/1.3.0'=20with=20non-snapshot=20versi?= =?UTF-8?q?ons?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- conga-sling-plugin/pom.xml | 2 +- pom.xml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/conga-sling-plugin/pom.xml b/conga-sling-plugin/pom.xml index a13e060..740fdb7 100644 --- a/conga-sling-plugin/pom.xml +++ b/conga-sling-plugin/pom.xml @@ -31,7 +31,7 @@ io.wcm.devops.conga.plugins io.wcm.devops.conga.plugins.sling - 1.3.0-SNAPSHOT + 1.3.0 jar CONGA Sling Plugin diff --git a/pom.xml b/pom.xml index 0e93b08..56bd173 100644 --- a/pom.xml +++ b/pom.xml @@ -29,7 +29,7 @@ io.wcm.devops.conga.plugins io.wcm.devops.conga.plugins.sling.root - 1.3.0-SNAPSHOT + 1.3.0 pom CONGA Sling Plugin