Skip to content

Commit 6ecd91e

Browse files
conga-aem-maven-plugin: Check package manager installstatus.jsp before/after installation of content packages (#11)
1 parent dfaad94 commit 6ecd91e

3 files changed

Lines changed: 51 additions & 5 deletions

File tree

changes.xml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,9 @@
2828
conga-aem-maven-plugin: Add parameter "runModeOptimization" to "cloudmanager-all-package" goal, set by default to OFF.
2929
When set to ELIMINATE_DUPLICATES, only one content package is built per environment, including author and publish runmodes, eliminating duplicates between those two modes as much as possible.
3030
</action>
31+
<action type="add" dev="sseifert">
32+
conga-aem-maven-plugin: Check package manager installstatus.jsp before and after installation of content package to make sure packager manager is also completed with installing embedded packages.
33+
</action>
3134
</release>
3235

3336
<release version="2.17.0" date="2022-05-11">

parent/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@
7575
<dependency>
7676
<groupId>io.wcm.tooling.commons</groupId>
7777
<artifactId>io.wcm.tooling.commons.crx-packmgr-helper</artifactId>
78-
<version>2.0.4</version>
78+
<version>2.1.0-SNAPSHOT</version>
7979
</dependency>
8080

8181
<dependency>

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

Lines changed: 47 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434

3535
import io.wcm.tooling.commons.packmgr.PackageManagerProperties;
3636
import io.wcm.tooling.commons.packmgr.install.VendorInstallerFactory;
37+
import io.wcm.tooling.commons.packmgr.install.VendorInstallerFactory.Service;
3738

3839
/**
3940
* Common functionality for all mojos.
@@ -120,14 +121,14 @@ abstract class AbstractContentPackageMojo extends AbstractMojo {
120121
* before it is tried to upload and install a new package and after each upload.
121122
* </p>
122123
* <p>
123-
* If not all packages are installed the upload is delayed up to 10 minutes, every 5 seconds the
124-
* activation status is checked anew.
124+
* If not all bundles are activated the upload is delayed up to {@link #bundleStatusWaitLimit} seconds,
125+
* every 5 seconds the activation status is checked anew.
125126
* </p>
126127
* <p>
127128
* Expected is an URL like: http://localhost:4502/system/console/bundles/.json
128129
* </p>
129130
* <p>
130-
* If the URL is not set it is derived from serviceURL. Set to "-" to explicitly disable the status check.
131+
* If the URL is not set it is derived from serviceURL. If set to "-" the status check is disabled.
131132
* </p>
132133
*/
133134
@Parameter(property = "vault.bundleStatusURL", required = false)
@@ -140,6 +141,33 @@ abstract class AbstractContentPackageMojo extends AbstractMojo {
140141
@Parameter(property = "vault.bundleStatusWaitLimit", defaultValue = "360")
141142
private int bundleStatusWaitLimit;
142143

144+
/**
145+
* <p>
146+
* Package Manager install status JSON URL. If an URL is configured the installation status of packages and
147+
* embedded packages is checked before it is tried to upload and install a new package and after each upload.
148+
* </p>
149+
* <p>
150+
* If not all packages are installed the upload is delayed up to {@link #packageManagerInstallStatusWaitLimit}
151+
* seconds, every 5 seconds the installation status is checked anew.
152+
* </p>
153+
* <p>
154+
* Expected is an URL like: http://localhost:4502/crx/packmgr/installstatus.jsp
155+
* </p>
156+
* <p>
157+
* If the URL is not set it is derived from serviceURL. If set to "-" the status check is disabled.
158+
* </p>
159+
*/
160+
@Parameter(property = "vault.packageManagerInstallStatusURL", required = false)
161+
private String packageManagerInstallStatusURL;
162+
163+
/**
164+
* Number of seconds to wait as maximum for a positive package manager install status check.
165+
* If this limit is reached and the package manager status is still not positive the install of the package proceeds
166+
* anyway.
167+
*/
168+
@Parameter(property = "vault.packageManagerInstallStatusWaitLimit", defaultValue = "360")
169+
private int packageManagerInstallStatusWaitLimit;
170+
143171
/**
144172
* Patterns for symbolic names of bundles that are expected to be not present in bundle list.
145173
* If any of these bundles are found in the bundle list, this system is assumed as not ready for installing further
@@ -211,6 +239,8 @@ protected PackageManagerProperties getPackageManagerProperties() throws MojoExec
211239
props.setBundleStatusWaitLimitSec(this.bundleStatusWaitLimit);
212240
props.setBundleStatusBlacklistBundleNames(ImmutableList.copyOf(this.bundleStatusBlacklistBundleNames));
213241
props.setBundleStatusWhitelistBundleNames(ImmutableList.copyOf(this.bundleStatusWhitelistBundleNames));
242+
props.setPackageManagerInstallStatusURL(buildPackageManagerInstallStatusUrl());
243+
props.setPackageManagerInstallStatusWaitLimitSec(this.packageManagerInstallStatusWaitLimit);
214244
props.setRelaxedSSLCheck(this.relaxedSSLCheck);
215245
props.setHttpConnectTimeoutSec(this.httpConnectTimeoutSec);
216246
props.setHttpSocketTimeoutSec(this.httpSocketTimeout);
@@ -230,7 +260,7 @@ private String buildPackageManagerUrl() throws MojoExecutionException {
230260
serviceUrl = VendorInstallerFactory.getBaseUrl(serviceUrl) + COMPOSUM_URL;
231261
break;
232262
default:
233-
throw new MojoExecutionException("Unsupporte service URL: " + serviceUrl);
263+
throw new MojoExecutionException("Unsupported service URL: " + serviceUrl);
234264
}
235265
return serviceUrl;
236266
}
@@ -247,6 +277,19 @@ private String buildBundleStatusUrl() throws MojoExecutionException {
247277
return baseUrl + "/system/console/bundles/.json";
248278
}
249279

280+
private String buildPackageManagerInstallStatusUrl() throws MojoExecutionException {
281+
if (StringUtils.equals(this.packageManagerInstallStatusURL, "-")
282+
|| VendorInstallerFactory.identify(this.serviceURL) != Service.CRX) {
283+
return null;
284+
}
285+
if (this.packageManagerInstallStatusURL != null) {
286+
return this.packageManagerInstallStatusURL;
287+
}
288+
// if not set use hostname from serviceURL and add default path to bundle status
289+
String baseUrl = VendorInstallerFactory.getBaseUrl(buildPackageManagerUrl());
290+
return baseUrl + "/crx/packmgr/installstatus.jsp";
291+
}
292+
250293
protected String buildConsoleUrl() {
251294
return VendorInstallerFactory.getBaseUrl(this.serviceURL) + CONSOLE_URL;
252295
}

0 commit comments

Comments
 (0)