Closed gruberrolandvaltech closed 3 years ago
How did you manage to run install hooks with mutable content packages on the publish in AEMaaCS? The service user does not have the rights for that...
As far as I remember you have added an option that allows to use different rights on publish (in a later version of AEM cloud).
@gruberrolandvaltech This is IMHO not yet supported in AEM cloud: https://github.com/Netcentric/aem-cloud-validator#prevent-using-install-hooks-in-mutable-content-packages
True, but is there any other option?
Not that I know of, I was just asking because of
AEM cloud manual run of scripts - OK install hooks - OK
(https://github.com/valtech/aem-easy-content-upgrade/pull/152#issue-573501566).
I was assuming you found a way...
No, this was just for for local cloud instance test :(
@kwin do you see any issue with the OAK index? It works on 6.5 and cloud local. But cloud manager deployment gives the error below. I am considering to disable the full-text search for the moment on cloud.
Caused by: java.lang.Throwable: org.apache.sling.distribution.common.DistributionException: Error trying to extract package at path /etc/packages/Valtech/aecu.ui.content-4.2.0-SNAPSHOT.zip at org.apache.sling.distribution.journal.bookkeeper.ContentPackageExtractor.handle(ContentPackageExtractor.java:78) at org.apache.sling.distribution.journal.bookkeeper.PackageHandler.installAddPackage(PackageHandler.java:79) at org.apache.sling.distribution.journal.bookkeeper.PackageHandler.apply(PackageHandler.java:61) at org.apache.sling.distribution.journal.bookkeeper.BookKeeper.importPackage(BookKeeper.java:154) at org.apache.sling.distribution.journal.impl.subscriber.DistributionSubscriber.processQueueItem(DistributionSubscriber.java:361) at org.apache.sling.distribution.journal.impl.subscriber.DistributionSubscriber.fetchAndProcessQueueItem(DistributionSubscriber.java:318) at org.apache.sling.distribution.journal.impl.subscriber.DistributionSubscriber.processQueue(DistributionSubscriber.java:294) at java.base/java.lang.Thread.run(Unknown Source) Caused by: org.apache.jackrabbit.vault.packaging.PackageException: javax.jcr.nodetype.ConstraintViolationException: OakConstraint0021: /oak:index/aecuHistory-custom-1[[oak:QueryIndexDefinition]]: Mandatory property type not found in a new node at org.apache.jackrabbit.vault.packaging.impl.ZipVaultPackage.extract(ZipVaultPackage.java:237) at org.apache.jackrabbit.vault.packaging.impl.JcrPackageImpl.extract(JcrPackageImpl.java:401) at org.apache.jackrabbit.vault.packaging.impl.JcrPackageImpl.extract(JcrPackageImpl.java:360) at org.apache.jackrabbit.vault.packaging.impl.JcrPackageImpl.extract(JcrPackageImpl.java:346) at org.apache.sling.distribution.journal.bookkeeper.ContentPackageExtractor.installPackage(ContentPackageExtractor.java:102) at org.apache.sling.distribution.journal.bookkeeper.ContentPackageExtractor.installPackage(ContentPackageExtractor.java:93) at org.apache.sling.distribution.journal.bookkeeper.ContentPackageExtractor.handle(ContentPackageExtractor.java:72) ... 7 more Caused by: javax.jcr.nodetype.ConstraintViolationException: OakConstraint0021: /oak:index/aecuHistory-custom-1[[oak:QueryIndexDefinition]]: Mandatory property type not found in a new node at org.apache.jackrabbit.oak.api.CommitFailedException.asRepositoryException(CommitFailedException.java:226) at org.apache.jackrabbit.oak.api.CommitFailedException.asRepositoryException(CommitFailedException.java:213) at org.apache.jackrabbit.oak.jcr.delegate.SessionDelegate.newRepositoryException(SessionDelegate.java:684) at org.apache.jackrabbit.oak.jcr.delegate.SessionDelegate.save(SessionDelegate.java:505) at org.apache.jackrabbit.oak.jcr.session.SessionImpl$8.performVoid(SessionImpl.java:429) at org.apache.jackrabbit.oak.jcr.delegate.SessionDelegate.performVoid(SessionDelegate.java:275) at org.apache.jackrabbit.oak.jcr.session.SessionImpl.save(SessionImpl.java:426) at org.apache.jackrabbit.vault.fs.io.AutoSave.save(AutoSave.java:177) at org.apache.jackrabbit.vault.fs.io.Importer.run(Importer.java:441) at org.apache.jackrabbit.vault.packaging.impl.ZipVaultPackage.extract(ZipVaultPackage.java:232) ... 13 more Caused by: org.apache.jackrabbit.oak.api.CommitFailedException: OakConstraint0021: /oak:index/aecuHistory-custom-1[[oak:QueryIndexDefinition]]: Mandatory property type not found in a new node at org.apache.jackrabbit.oak.plugins.nodetype.TypeEditor$1.onConstraintViolation(TypeEditor.java:109) at org.apache.jackrabbit.oak.plugins.nodetype.TypeEditor.constraintViolation(TypeEditor.java:234) at org.apache.jackrabbit.oak.plugins.nodetype.TypeEditor.checkNodeTypeConstraints(TypeEditor.java:467) at org.apache.jackrabbit.oak.plugins.nodetype.TypeEditor.enter(TypeEditor.java:276) at org.apache.jackrabbit.oak.spi.commit.VisibleEditor.enter(VisibleEditor.java:53) at org.apache.jackrabbit.oak.spi.commit.CompositeEditor.enter(CompositeEditor.java:65)
Sorry, found out that we have it in two packages. Will remove one of them.
@gruberrolandvaltech @kwin Any update on the execution of the migration on publish for AEMaaCS? I guess InstallHooks are still not working...
What would you think about a temporary workaround with a ResourceChangeListener as follows:
That should trigger AECU migration every time the content package is installed. I'm going to try this approach in one of our projects anyway, if you are interested I could fork, change and create a PR.
A workaround would be to implement a startup hook that triggers the installation of a given path (e.g. /conf/groovyconsole/aecu). See https://github.com/valtech/aem-easy-content-upgrade/blob/70334caec21c35855c4a941ebf2b3934e343bb66/core/src/main/java/de/valtech/aecu/core/jmx/AecuServiceMBeanImpl.java#L87 how to run scripts in a folder with history check.
Example startup hook: https://github.com/Netcentric/accesscontroltool/tree/develop/accesscontroltool-startuphook-bundle
If you want to implement such a feature we would be strongly interested.
A startup hook would not work as the groovy scripts needed to start the migration on publish are part of the content package of package type "content", which are replicated from author, so after the startup.
Another option would be to move the groovyscripts to /apps so they are of package type "application" and can be triggered by a startup hook. These packages are not replicated from author.
Let's move the discussion from this closed PR to https://github.com/valtech/aem-easy-content-upgrade/issues/171
Testing:
AEM 6.5:
AEM cloud local
AEM cloud