Skip to content

Make deployment migrations cloud-compatible (AEMaaCS + on-prem) - #94

Merged
royteeuwen merged 1 commit into
mainfrom
feature/migration-cloud-compat
Jul 19, 2026
Merged

Make deployment migrations cloud-compatible (AEMaaCS + on-prem)#94
royteeuwen merged 1 commit into
mainfrom
feature/migration-cloud-compat

Conversation

@royteeuwen

Copy link
Copy Markdown
Contributor

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 /apps scripts + cloud startup hook) and ACM (composite-node-store readiness gating) solve the same problem.

The extension was already ACM-shaped (/conf scripts + /var state + 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, /conf scripts are mutable content (author-only, deployed separately from the code image).

Changes

  • Immutable + mutable script paths. scriptsBasePaths (was single scriptsBasePath) defaults to /apps/groovyconsole-migration-scripts and /conf/groovyconsole/scripts/migration, searched in order, missing paths skipped. The immutable /apps path 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 own ui.apps package has a replace filter on /apps/groovyconsole that 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 Tool RuntimeHelper and ACM Repo implementations byte-for-byte (hasPermission guard + hasCapability on /apps). Configurable via autoRunOnStartup (cloudOnly default / always / never); logs the detection outcome at INFO so it can be verified from cloud logs on the first deploy.
  • Resource listener now also watches the immutable /apps scripts path, so on-premises package installs can auto-run (on cloud /apps arrives via a container swap and is covered by the startup hook instead).
  • README: new "Cloud vs on-premises" section and updated configuration tables.

Behavior by environment

Environment Composite store? Startup hook (default cloudOnly) How migrations run
AEMaaCS yes fires automatically ~10s after each container start hands-off, per deploy
AEM 6.5 on-prem / AMS no skipped by default resource listener (opt-in), JMX, or POST /bin/groovyconsole/migration; or set autoRunOnStartup=always
AEM SDK / local no skipped by default same as on-prem

Testing

  • Unit: 62 pass — including 7 new MigrationStartupHook tests (composite detection incl. the permission-guard case, and every auto-run branch) and 2 new multi-path discovery tests.
  • Integration: full -Pit suite green on a real Sling instanceMigrationIT 10/10 (new testImmutableAppsPathScriptsAreDiscovered proves /apps discovery end-to-end), plus all other IT modules. The startup hook activates cleanly and correctly skips on the single-node-store IT instance.
  • aemanalyser validated the new component in the all package.

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
royteeuwen force-pushed the feature/migration-cloud-compat branch from f90ec91 to 9917ac4 Compare July 19, 2026 19:54
@sonarqubecloud

Copy link
Copy Markdown

@royteeuwen
royteeuwen merged commit 1d9475c into main Jul 19, 2026
3 checks passed
@royteeuwen
royteeuwen deleted the feature/migration-cloud-compat branch July 19, 2026 20:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant