Make deployment migrations cloud-compatible (AEMaaCS + on-prem) - #94
Merged
Conversation
Migration scripts can now be discovered from an immutable /apps path in addition to the mutable /conf path, and a startup hook auto-runs pending migrations after an AEM as a Cloud Service deployment. - scriptsBasePaths (was scriptsBasePath) defaults to /apps/groovyconsole-migration-scripts and /conf/groovyconsole/scripts/migration, searched in order; missing paths are skipped. The immutable /apps path ships with the code image, reaches publish, and is tamper-proof. It is a dedicated top-level node, not /apps/groovyconsole/..., because the console's own ui.apps package replaces the /apps/groovyconsole subtree on every deploy. - MigrationStartupHook: on activation waits for repository readiness, detects a composite node store (AEMaaCS) and enqueues a run of the pending scripts. Composite-store detection matches the AC Tool and ACM implementations (hasPermission guard + hasCapability on /apps). Configurable via autoRunOnStartup (cloudOnly default / always / never); logs the detection outcome at INFO for cloud-log verification. - MigrationScriptListener now also watches the immutable /apps scripts path so on-premises package installs can auto-run (cloud /apps changes arrive via a container swap and are covered by the startup hook instead). - README: new "Cloud vs on-premises" section and updated configuration tables. - Tests: multi-path discovery (unit + a real-instance IT proving /apps discovery), and MigrationStartupHook detection and auto-run branches.
royteeuwen
force-pushed
the
feature/migration-cloud-compat
branch
from
July 19, 2026 19:54
f90ec91 to
9917ac4
Compare
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Summary
Makes the migration extension work for automatic, deploy-time execution on AEM as a Cloud Service as well as AEM 6.5 on-premises / AMS and plain Sling. Modeled on how AECU (immutable
/appsscripts + cloud startup hook) and ACM (composite-node-store readiness gating) solve the same problem.The extension was already ACM-shaped (
/confscripts +/varstate + checksum run-once + health checks), but had one critical gap: nothing triggered a migration run after an AEMaaCS deploy — the standard pipeline has no post-deploy step and no reliable install hook. Secondarily,/confscripts are mutable content (author-only, deployed separately from the code image).Changes
scriptsBasePaths(was singlescriptsBasePath) defaults to/apps/groovyconsole-migration-scriptsand/conf/groovyconsole/scripts/migration, searched in order, missing paths skipped. The immutable/appspath ships with the code image (present on author + publish, atomic with the bundle, tamper-proof). It is a dedicated top-level node — not/apps/groovyconsole/..., because the console's ownui.appspackage has a replace filter on/apps/groovyconsolethat would wipe scripts nested there on every deploy.MigrationStartupHook(new immediate component). On activation it waits for repository readiness, detects a composite node store (AEMaaCS), and enqueues a run of the pending scripts. Composite-store detection matches the AC ToolRuntimeHelperand ACMRepoimplementations byte-for-byte (hasPermissionguard +hasCapabilityon/apps). Configurable viaautoRunOnStartup(cloudOnlydefault /always/never); logs the detection outcome at INFO so it can be verified from cloud logs on the first deploy./appsscripts path, so on-premises package installs can auto-run (on cloud/appsarrives via a container swap and is covered by the startup hook instead).Behavior by environment
cloudOnly)POST /bin/groovyconsole/migration; or setautoRunOnStartup=alwaysTesting
MigrationStartupHooktests (composite detection incl. the permission-guard case, and every auto-run branch) and 2 new multi-path discovery tests.-Pitsuite green on a real Sling instance —MigrationIT10/10 (newtestImmutableAppsPathScriptsAreDiscoveredproves/appsdiscovery end-to-end), plus all other IT modules. The startup hook activates cleanly and correctly skips on the single-node-store IT instance.allpackage.