Skip to content

Commit a08e8c7

Browse files
committed
Merge branch 'develop' into master
2 parents bfbde8b + 76ab745 commit a08e8c7

17 files changed

Lines changed: 387 additions & 104 deletions

File tree

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
<img src="https://wcm.io/images/favicon-16@2x.png"/> CONGA Plugin for AEM
22
======
3-
[![Build Status](https://travis-ci.org/wcm-io-devops/conga-aem-plugin.png?branch=develop)](https://travis-ci.org/wcm-io-devops/conga-aem-plugin)
3+
[![Build Status](https://travis-ci.com/wcm-io-devops/conga-aem-plugin.png?branch=develop)](https://travis-ci.com/wcm-io-devops/conga-aem-plugin)
44
[![Code Coverage](https://codecov.io/gh/wcm-io-devops/conga-aem-plugin/branch/develop/graph/badge.svg)](https://codecov.io/gh/wcm-io-devops/conga-aem-plugin)
55

66
Documentation: https://devops.wcm.io/conga/plugins/aem/<br/>
77
Issues: https://wcm-io.atlassian.net/projects/WDCONGA<br/>
88
Wiki: https://wcm-io.atlassian.net/wiki/<br/>
9-
Continuous Integration: https://travis-ci.org/conga-aem-plugin<br/>
9+
Continuous Integration: https://travis-ci.com/conga-aem-plugin<br/>
1010
Commercial support: https://wcm.io/commercial-support.html
1111

1212

changes.xml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,18 @@
2323
xsi:schemaLocation="http://maven.apache.org/changes/1.0.0 https://maven.apache.org/plugins/maven-changes-plugin/xsd/changes-1.0.0.xsd">
2424
<body>
2525

26+
<release version="1.14.0" date="2020-12-21">
27+
<action type="add" dev="sseifert">
28+
conga-aem-maven-plugin:cloudmanager-all-package: Add "singlePackage" flag to alternatively build single "all" content package for all environments and nodes.
29+
</action>
30+
<action type="add" dev="sseifert">
31+
conga-aem-maven-plugin:cloudmanager-all-package: Add "attachArtifact" flag to attach "all" content package(s) as artifacts to maven build lifecycle.
32+
</action>
33+
<action type="fix" dev="sseifert">
34+
conga-aem-maven-plugin:cloudmanager-all-package: Fix auto dependency generation for package that already contain dependencies.
35+
</action>
36+
</release>
37+
2638
<release version="1.13.0" date="2020-07-10">
2739
<action type="add" dev="sseifert">
2840
aem-contentpackage post processor: Add "fileMatch" property to include a list of binary files matching the pattern into a content package.

conga-aem-plugin/pom.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131

3232
<groupId>io.wcm.devops.conga.plugins</groupId>
3333
<artifactId>io.wcm.devops.conga.plugins.aem</artifactId>
34-
<version>1.13.0</version>
34+
<version>1.14.0</version>
3535
<packaging>jar</packaging>
3636

3737
<name>CONGA AEM Plugin</name>
@@ -107,7 +107,7 @@
107107
<dependency>
108108
<groupId>io.wcm.tooling.commons</groupId>
109109
<artifactId>io.wcm.tooling.commons.crx-packmgr-helper</artifactId>
110-
<version>1.7.2</version>
110+
<version>1.7.4</version>
111111
<scope>compile</scope>
112112
</dependency>
113113

example/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@
6565
<dependency>
6666
<groupId>io.wcm.devops.conga.plugins</groupId>
6767
<artifactId>io.wcm.devops.conga.plugins.aem</artifactId>
68-
<version>1.12.1-SNAPSHOT</version>
68+
<version>1.13.1-SNAPSHOT</version>
6969
</dependency>
7070

7171
</dependencies>

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929

3030
<groupId>io.wcm.devops.conga.plugins</groupId>
3131
<artifactId>io.wcm.devops.conga.plugins.aem.root</artifactId>
32-
<version>1.13.0</version>
32+
<version>1.14.0</version>
3333
<packaging>pom</packaging>
3434

3535
<name>CONGA AEM Plugin</name>

src/site/markdown/index.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,8 @@ Additionally the CONGA AEM Maven plugin is provided which allows to deploy a bun
3434
* [wcm.io CONGA training material with exercises](https://training.wcm.io/conga/)
3535
* [adaptTo() 2015 Talk: CONGA - Configuration generation for Sling and AEM](https://adapt.to/2015/en/schedule/conga---configuration-generation-for-sling-and-aem.html)
3636
* [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)
37+
* [adaptTo() 2018 Talk: Maven Archetypes for AEM & Cloud Deployment](https://adapt.to/2018/en/schedule/maven-archetypes-for-aem.html)
38+
* [adaptTo() 2020 Talk: Use Cloud Manager to deploy CONGA-based AEM Applications](https://adapt.to/2020/en/schedule/use-cloud-manager-to-deploy-conga-based-aem-applications.html)
3739

3840

3941

tooling/conga-aem-crypto-cli/pom.xml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
<groupId>io.wcm.devops.conga.plugins</groupId>
3333
<artifactId>conga-aem-crypto-cli</artifactId>
3434
<packaging>jar</packaging>
35-
<version>1.13.0</version>
35+
<version>1.14.0</version>
3636

3737
<name>CONGA AEM Crypto Command Line Interface</name>
3838
<description>Command line tool to generate Crypto keys for AEM.</description>
@@ -42,7 +42,7 @@
4242
<dependency>
4343
<groupId>io.wcm.devops.conga.plugins</groupId>
4444
<artifactId>io.wcm.devops.conga.plugins.aem</artifactId>
45-
<version>1.13.0</version>
45+
<version>1.14.0</version>
4646
<scope>compile</scope>
4747
<exclusions>
4848
<!-- Exclude all deps - only crypto util classes are used -->
@@ -104,7 +104,7 @@
104104
<dependency>
105105
<groupId>io.wcm.devops.conga.plugins</groupId>
106106
<artifactId>io.wcm.devops.conga.plugins.ansible</artifactId>
107-
<version>1.3.0</version>
107+
<version>1.3.2</version>
108108
<scope>compile</scope>
109109
<exclusions>
110110
<!-- Exclude all deps - only Ansible Vault util classes are used -->

tooling/conga-aem-maven-plugin/pom.xml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
<groupId>io.wcm.devops.conga.plugins</groupId>
3333
<artifactId>conga-aem-maven-plugin</artifactId>
3434
<packaging>maven-plugin</packaging>
35-
<version>1.13.0</version>
35+
<version>1.14.0</version>
3636

3737
<name>CONGA AEM Maven Plugin</name>
3838
<description>wcm.io DevOps CONGA - CONfiguration GenerAtor Maven Plugin for AEM</description>
@@ -57,13 +57,13 @@
5757
<dependency>
5858
<groupId>io.wcm.devops.conga.plugins</groupId>
5959
<artifactId>io.wcm.devops.conga.plugins.aem</artifactId>
60-
<version>1.13.0</version>
60+
<version>1.14.0</version>
6161
<scope>compile</scope>
6262
</dependency>
6363
<dependency>
6464
<groupId>io.wcm.devops.conga.plugins</groupId>
6565
<artifactId>io.wcm.devops.conga.plugins.ansible</artifactId>
66-
<version>1.3.0</version>
66+
<version>1.3.2</version>
6767
<scope>compile</scope>
6868
</dependency>
6969

@@ -106,7 +106,7 @@
106106
<dependency>
107107
<groupId>io.wcm.tooling.commons</groupId>
108108
<artifactId>io.wcm.tooling.commons.crx-packmgr-helper</artifactId>
109-
<version>1.7.2</version>
109+
<version>1.7.4</version>
110110
<scope>compile</scope>
111111
</dependency>
112112

tooling/conga-aem-maven-plugin/src/main/java/io/wcm/devops/conga/plugins/aem/maven/CloudManagerAllPackageMojo.java

Lines changed: 112 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,11 @@
2929

3030
import org.apache.maven.plugin.MojoExecutionException;
3131
import org.apache.maven.plugin.MojoFailureException;
32+
import org.apache.maven.plugins.annotations.Component;
3233
import org.apache.maven.plugins.annotations.Mojo;
3334
import org.apache.maven.plugins.annotations.Parameter;
35+
import org.apache.maven.project.MavenProject;
36+
import org.apache.maven.project.MavenProjectHelper;
3437

3538
import io.wcm.devops.conga.plugins.aem.maven.allpackage.AllPackageBuilder;
3639
import io.wcm.devops.conga.plugins.aem.maven.model.ContentPackageFile;
@@ -39,6 +42,16 @@
3942
/**
4043
* Builds an "all" content package dedicated for deployment via Adobe Cloud Manager
4144
* for the given environment and node(s).
45+
* <p>
46+
* By default, it builds one "all" package per environment and node without adding any Cloud Manager
47+
* environment-specific run mode suffixes to the folders. By defining a parameter <code>cloudManager.target</code>
48+
* (contains a list of string values) in the CONGA environment it is possible:
49+
* </p>
50+
* <ul>
51+
* <li>If it contains <code>none</code> no "all" package is build.</li>
52+
* <li>If set to one or multiple environment names (normally dev/stage/prod) one "all" package for each of
53+
* them is defined, and the environment name is added as runmode suffix to all config and install folders.</li>
54+
* </ul>
4255
*/
4356
@Mojo(name = "cloudmanager-all-package", threadSafe = true)
4457
public final class CloudManagerAllPackageMojo extends AbstractCloudManagerMojo {
@@ -55,6 +68,19 @@ public final class CloudManagerAllPackageMojo extends AbstractCloudManagerMojo {
5568
@Parameter(property = "conga.cloudManager.allPackage.group", required = true)
5669
private String group;
5770

71+
/**
72+
* Build one single content package for all environments and nodes.
73+
*/
74+
@Parameter(property = "conga.cloudManager.allPackage.singlePackage", defaultValue = "false")
75+
private boolean singlePackage;
76+
77+
/**
78+
* Attach "all" content package(s) as artifacts to maven build lifecycle.
79+
* The given package name will be used as classifier.
80+
*/
81+
@Parameter(property = "conga.cloudManager.allPackage.attachArtifact", defaultValue = "false")
82+
private boolean attachArtifact;
83+
5884
/**
5985
* Automatically generate dependencies between content packages based on file order in CONGA configuration.
6086
* <p>
@@ -100,6 +126,11 @@ public final class CloudManagerAllPackageMojo extends AbstractCloudManagerMojo {
100126
@Parameter(property = "conga.cloudManager.allPackage.skip", defaultValue = "false")
101127
private boolean skip;
102128

129+
@Parameter(readonly = true, defaultValue = "${project}")
130+
private MavenProject project;
131+
@Component
132+
private MavenProjectHelper projectHelper;
133+
103134
private static final String CLOUDMANAGER_TARGET_NONE = "none";
104135

105136
@Override
@@ -122,42 +153,102 @@ public void execute() throws MojoExecutionException, MojoFailureException {
122153
}
123154
}
124155

125-
List<File> environmentDirs = getEnvironmentDir();
126-
for (File environmentDir : environmentDirs) {
127-
List<File> nodeDirs = getNodeDirs(environmentDir);
128-
ModelParser modelParser = new ModelParser();
129-
for (File nodeDir : nodeDirs) {
130-
Set<String> cloudManagerTarget = modelParser.getCloudManagerTarget(nodeDir);
131-
if (!cloudManagerTarget.contains(CLOUDMANAGER_TARGET_NONE)) {
132-
buildAllPackage(environmentDir, nodeDir, cloudManagerTarget, modelParser);
133-
}
134-
}
156+
if (singlePackage) {
157+
buildSingleAllPackage();
158+
}
159+
else {
160+
buildAllPackagesPerEnvironmentNode();
135161
}
136162
}
137163

138-
private void buildAllPackage(File environmentDir, File nodeDir, Set<String> cloudManagerTarget,
139-
ModelParser modelParser) throws MojoExecutionException {
140-
String groupName = this.group;
141-
String packageName = environmentDir.getName() + "." + nodeDir.getName() + "." + this.name;
164+
/**
165+
* Build an "all" package for each environment and node.
166+
*/
167+
private void buildAllPackagesPerEnvironmentNode() throws MojoExecutionException, MojoFailureException {
168+
visitEnvironmentsNodes((environmentDir, nodeDir, cloudManagerTarget, contentPackages) -> {
169+
String packageName = environmentDir.getName() + "." + nodeDir.getName() + "." + this.name;
170+
AllPackageBuilder builder = createBuilder(packageName);
171+
172+
try {
173+
builder.add(contentPackages, cloudManagerTarget);
174+
}
175+
catch (IllegalArgumentException ex) {
176+
throw new MojoFailureException(ex.getMessage(), ex);
177+
}
142178

143-
List<ContentPackageFile> contentPackages = modelParser.getContentPackagesForNode(nodeDir);
144-
File targetFile = new File(getTargetDir(), packageName + ".zip");
179+
buildAllPackage(builder);
180+
});
181+
}
145182

146-
AllPackageBuilder builder = new AllPackageBuilder(targetFile, groupName, packageName)
183+
/**
184+
* Build a single "all" package containing packages from all environments and nodes.
185+
*/
186+
private void buildSingleAllPackage() throws MojoExecutionException, MojoFailureException {
187+
String packageName = this.name;
188+
AllPackageBuilder builder = createBuilder(packageName);
189+
190+
visitEnvironmentsNodes((environmentDir, nodeDir, cloudManagerTarget, contentPackages) -> {
191+
try {
192+
builder.add(contentPackages, cloudManagerTarget);
193+
}
194+
catch (IllegalArgumentException ex) {
195+
throw new MojoFailureException(ex.getMessage(), ex);
196+
}
197+
});
198+
199+
buildAllPackage(builder);
200+
}
201+
202+
private AllPackageBuilder createBuilder(String packageName) {
203+
String fileName;
204+
if (attachArtifact) {
205+
fileName = project.getArtifactId() + "." + packageName + "-" + project.getVersion() + ".zip";
206+
}
207+
else {
208+
fileName = packageName + ".zip";
209+
}
210+
File targetFile = new File(getTargetDir(), fileName);
211+
return new AllPackageBuilder(targetFile, this.group, packageName)
212+
.version(project.getVersion())
147213
.autoDependenciesMode(this.autoDependenciesMode)
148214
.logger(getLog());
215+
}
149216

217+
private void buildAllPackage(AllPackageBuilder builder) throws MojoExecutionException {
150218
try {
151-
if (builder.build(contentPackages, cloudManagerTarget, properties)) {
152-
getLog().info("Generated " + getCanonicalPath(targetFile));
219+
if (builder.build(properties)) {
220+
getLog().info("Generated " + getCanonicalPath(builder.getTargetFile()));
221+
if (attachArtifact) {
222+
projectHelper.attachArtifact(this.project, "zip", builder.getPackageName(), builder.getTargetFile());
223+
}
153224
}
154225
else {
155-
getLog().debug("Skipped " + getCanonicalPath(targetFile) + " - no valid package.");
226+
getLog().debug("Skipped " + getCanonicalPath(builder.getTargetFile()) + " - no valid package.");
156227
}
157228
}
158229
catch (IOException ex) {
159-
throw new MojoExecutionException("Unable to generate " + getCanonicalPath(targetFile), ex);
230+
throw new MojoExecutionException("Unable to generate " + getCanonicalPath(builder.getTargetFile()), ex);
160231
}
161232
}
162233

234+
private void visitEnvironmentsNodes(EnvironmentNodeVisitor visitor) throws MojoExecutionException, MojoFailureException {
235+
ModelParser modelParser = new ModelParser();
236+
List<File> environmentDirs = getEnvironmentDir();
237+
for (File environmentDir : environmentDirs) {
238+
List<File> nodeDirs = getNodeDirs(environmentDir);
239+
for (File nodeDir : nodeDirs) {
240+
Set<String> cloudManagerTarget = modelParser.getCloudManagerTarget(nodeDir);
241+
if (!cloudManagerTarget.contains(CLOUDMANAGER_TARGET_NONE)) {
242+
List<ContentPackageFile> contentPackages = modelParser.getContentPackagesForNode(nodeDir);
243+
visitor.visit(environmentDir, nodeDir, cloudManagerTarget, contentPackages);
244+
}
245+
}
246+
}
247+
}
248+
249+
interface EnvironmentNodeVisitor {
250+
void visit(File environmentDir, File nodeDir, Set<String> cloudManagerTarget,
251+
List<ContentPackageFile> contentPackages) throws MojoExecutionException, MojoFailureException;
252+
}
253+
163254
}

0 commit comments

Comments
 (0)