Skip to content

feat(onboarding): resolve AEM CS code config via Cloud Manager Management API#2783

Draft
rpapani wants to merge 2 commits into
mainfrom
feat/aem-cs-code-config-onboarding-SITES-40809
Draft

feat(onboarding): resolve AEM CS code config via Cloud Manager Management API#2783
rpapani wants to merge 2 commits into
mainfrom
feat/aem-cs-code-config-onboarding-SITES-40809

Conversation

@rpapani

@rpapani rpapani commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

What

Fills the AEM CS branch of updateCodeConfig in src/support/utils.js — previously a // TODO: Add AEM CS pattern code config resolution here.

When the onboarding serving host matches publish-p{programId}-e{environmentId}.adobeaemcloud.{com,net}, it resolves the site's code config (owner/repo/ref/type) from the Cloud Manager Management API via the new CloudManagerApiClient (spacecat-shared-cloud-manager-client) and calls site.setCode(...).

Why

  • EDS hosts (ref--repo--owner.aem.live) encode owner/repo/ref directly in the hostname → resolved by regex, no network call (unchanged).
  • AEM CS publish hosts encode only program/environment — not the repo. The repo/ref/type must be looked up in Cloud Manager (production pipeline → BUILD phase → repository). This automates what the manual aso-code-config-onboarding skill does today, so imports + autofix work without manual code-config entry.

Part of SITES-40809 (onboard automation for code optimizations).

Behaviour

  • updateCodeConfig(site, host, slackContext, log, context) — adds context (for CloudManagerApiClient.createFrom). Both call sites (onboardSingleSite, onboarding-flow.js) updated.
  • Best-effort / non-fatal: if the CM API is not configured (env/creds absent) createFrom throws → logged + skipped; if the lookup fails → logged + Slack warning + skipped. Onboarding never fails on code-config resolution. This means the change is safe to merge before the CM creds/infra are in place — it simply stays dormant until configured.

Dependencies & why this is a draft

  1. spacecat-shared #1794 adds CloudManagerApiClient. The dependency here is pinned to the current 1.4.5; it must be bumped to the release that includes CloudManagerApiClient before un-drafting. Until that release, the bundle-build CI gate will fail on the missing named export — expected, not a defect.
  2. MCT network path (SITES-41140): the CM Management API is reachable from SpaceCat only over the private *.private.adobe.io endpoint. End-to-end verification in dev is gated on the CM /32 route landing and api-service running in mct_workload_subnet_ids.

Required config (Vault → env), not in this PR

CM_API_CLIENT_ID, CM_API_CLIENT_SECRET, CM_API_SCOPES, CM_API_IMS_ORG_ID, CM_API_BASE (https://ssg-stage.private.adobe.io/api dev/stage, https://ssg.private.adobe.io/api prod), plus existing IMS_HOST.

Tests

Added to test/support/utils.test.js: AEM CS resolution success, CM-not-configured skip, and CM-lookup-failure skip. Full utils + onboarding-flow-core suites pass locally.

rpapani and others added 2 commits July 8, 2026 23:37
…ment API

Fills the AEM CS branch of updateCodeConfig (previously a TODO): when the
onboarding serving host matches publish-p{programId}-e{environmentId}, resolve
the site code config (owner/repo/ref/type) from the CM Management API via the
new CloudManagerApiClient from spacecat-shared-cloud-manager-client.

EDS hosts encode owner/repo/ref in the hostname; AEM CS publish hosts encode
only program/environment, so the repo must be looked up in Cloud Manager.

Resolution is best-effort: if the CM API is not configured (env absent) or the
lookup fails, code config is skipped without failing onboarding.

Depends on spacecat-shared PR #1794 (CloudManagerApiClient). The dependency is
pinned to 1.4.5 here and must be bumped to the release that includes
CloudManagerApiClient before this is un-drafted/merged.

SITES-40809

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@github-actions

Copy link
Copy Markdown

This PR will trigger a minor release when merged.

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