Skip to content

Commit

Permalink
improve error message for mutable nodes
Browse files Browse the repository at this point in the history
  • Loading branch information
kwin committed Dec 2, 2021
1 parent 5e33868 commit 1ab7fc9
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 7 deletions.
2 changes: 1 addition & 1 deletion src/it/project1/verify.groovy
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
String buildLog = new File(basedir, 'build.log').text

assert buildLog.contains("[WARNING] ValidationViolation: \"netcentric-aem-cloud: Nodes below '/libs' may be overwritten by future product upgrades. Rather use '/apps'. Further details at https://experienceleague.adobe.com/docs/experience-manager-cloud-service/implementing/developing/full-stack/overlays.html?lang=en#developing\", filePath=jcr_root${File.separator}libs${File.separator}cq${File.separator}test${File.separator}test.jsp, nodePath=/libs/cq/test/test.jsp") : 'libs violation not found'
assert buildLog.contains("[WARNING] ValidationViolation: \"netcentric-aem-cloud: Using mutable nodes in this repository location is not allowed as it is not writable by the underlying service user on a publish instance. Consider to use repoinit scripts instead or move that content to another location. Further details at https://experienceleague.adobe.com/docs/experience-manager-learn/cloud-service/debugging/debugging-aem-as-a-cloud-service/build-and-deployment.html?lang=en#including-%2Fvar-in-content-package\", filePath=jcr_root${File.separator}var${File.separator}example${File.separator}test.txt, nodePath=/var/example/test.txt") : 'read only path in mutable package not detected'
assert buildLog.contains("[WARNING] ValidationViolation: \"netcentric-aem-cloud: Using mutable nodes in this repository location is only allowed in author-specific packages as it is not writable by the underlying service user on a publish instance. Consider to use repoinit scripts instead or move that content to another location. Further details at https://experienceleague.adobe.com/docs/experience-manager-learn/cloud-service/debugging/debugging-aem-as-a-cloud-service/build-and-deployment.html?lang=en#including-%2Fvar-in-content-package\", filePath=jcr_root${File.separator}var${File.separator}example${File.separator}test.txt, nodePath=/var/example/test.txt") : 'read only path in mutable package not detected'
assert buildLog.contains("[WARNING] ValidationViolation: \"netcentric-aem-cloud: Using install hooks in mutable content packages leads to deployment failures as the underlying service user on the publish does not have the right to execute those.\", filePath=META-INF${File.separator}vault${File.separator}hooks${File.separator}vault-hook-example-3.0.0.jar") : 'internal hook violation not found'
assert buildLog.contains("[WARNING] ValidationViolation: \"netcentric-aem-cloud: Using install hooks in mutable content packages leads to deployment failures as the underlying service user on the publish does not have the right to execute those.\", filePath=META-INF${File.separator}vault${File.separator}properties") : 'external hook violation not found'
assert buildLog.contains("[WARNING] ValidationViolation: \"netcentric-aem-cloud: Mutable nodes in mixed package types are not installed!\", filePath=jcr_root${File.separator}content${File.separator}example${File.separator}test.txt, nodePath=/content/example/test.txt") : 'mutable content in mixed package not found'
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,7 @@

public class AemCloudValidator implements NodePathValidator, MetaInfPathValidator, DocumentViewXmlValidator, PropertiesValidator {

static final String VIOLATION_MESSAGE_CONDITION_AUTHOR_ONLY_CONTAINER = "only allowed in author-specific packages";
static final String VIOLATION_MESSAGE_CONDITION_OVERALL = "not allowed";
static final String VIOLATION_MESSAGE_READONLY_MUTABLE_PATH = "Using mutable nodes in this repository location is %s as it is not writable by the underlying service user on a publish instance. Consider to use repoinit scripts instead or move that content to another location. Further details at https://experienceleague.adobe.com/docs/experience-manager-learn/cloud-service/debugging/debugging-aem-as-a-cloud-service/build-and-deployment.html?lang=en#including-%%2Fvar-in-content-package";
static final String VIOLATION_MESSAGE_READONLY_MUTABLE_PATH = "Using mutable nodes in this repository location is only allowed in author-specific packages as it is not writable by the underlying service user on a publish instance. Consider to use repoinit scripts instead or move that content to another location. Further details at https://experienceleague.adobe.com/docs/experience-manager-learn/cloud-service/debugging/debugging-aem-as-a-cloud-service/build-and-deployment.html?lang=en#including-%2Fvar-in-content-package";
static final String VIOLATION_MESSAGE_INSTALL_HOOK_IN_MUTABLE_PACKAGE = "Using install hooks in mutable content packages leads to deployment failures as the underlying service user on the publish does not have the right to execute those.";
static final String VIOLATION_MESSAGE_INVALID_INDEX_DEFINITION_NODE_NAME = "All Oak index definition node names must end with '-custom-<integer>' but found name '%s'. Further details at https://experienceleague.adobe.com/docs/experience-manager-cloud-service/operations/indexing.html?lang=en#how-to-use";
static final String VIOLATION_MESSAGE_LIBS_NODES = "Nodes below '/libs' may be overwritten by future product upgrades. Rather use '/apps'. Further details at https://experienceleague.adobe.com/docs/experience-manager-cloud-service/implementing/developing/full-stack/overlays.html?lang=en#developing";
Expand Down Expand Up @@ -98,9 +96,7 @@ public Collection<ValidationMessage> validate(@NotNull String path) {
// check if package itself is only used on author
if (!allowReadOnlyMutablePaths && !isContainedInAuthorOnlyPackage(containerValidationContext)) {
// only emit once per package
messages.add(new ValidationMessage(defaultSeverity, String.format(
VIOLATION_MESSAGE_READONLY_MUTABLE_PATH, allowReadOnlyMutablePaths ? VIOLATION_MESSAGE_CONDITION_AUTHOR_ONLY_CONTAINER
: VIOLATION_MESSAGE_CONDITION_OVERALL)));
messages.add(new ValidationMessage(defaultSeverity, VIOLATION_MESSAGE_READONLY_MUTABLE_PATH));
numVarNodeViolations++;
}
}
Expand Down

0 comments on commit 1ab7fc9

Please sign in to comment.