Skip to content

Commit 6dcf7c3

Browse files
tyaginidhiclaude
andcommitted
deploy-pipeline: pin --envUrl from project config + re-refresh plan after activation
Two gaps surfaced in EDM-site deploy testing (both SKILL.md-only — the helpers already support these paths): Fix #5 (Phase 1 Step 1): verify-alm-prerequisites.js defaulted to PAC's org context (`pac env who`), which isn't guaranteed to match the project — and with a stale/ambiguous context (duplicate active pac auth profiles) it failed with a misleading "PAC CLI is not authenticated". Now resolve the project's recorded env URL first (.solution-manifest.json top-level `environmentUrl`, else powerpages.config.json `environmentUrl`) and pass it as --envUrl so the gate is deterministic; fall back to the pac-context default only when neither file records one. (verify-alm-prerequisites already skips getEnvironmentUrl() when --envUrl is supplied — no code change.) Progress-tracking row updated to match. Fix #7 (Phase 7.7): the Phase 7.5b plan refresh runs BEFORE activation is resolved, so the plan's "Activate site in {stage}" step stayed pending even after last-deploy.json recorded activationStatus. Added a second refresh-alm-plan-data.js --phase deploy-pipeline call right after the marker is patched; its existing auto-complete logic flips the activate step to completed when activationStatus === "Activated" (a deferred "Pending" correctly leaves it pending). Soft no-op when no plan exists. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1 parent aa2cfa6 commit 6dcf7c3

1 file changed

Lines changed: 19 additions & 4 deletions

File tree

  • plugins/power-pages/skills/deploy-pipeline

plugins/power-pages/skills/deploy-pipeline/SKILL.md

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -121,11 +121,15 @@ Tasks to create:
121121

122122
Steps:
123123

124-
1. Run `verify-alm-prerequisites.js` to confirm PAC CLI auth, acquire a token, and verify API access:
124+
1. **Resolve the project's configured environment URL first, then verify prerequisites against it.** `verify-alm-prerequisites.js` defaults to whatever environment PAC's *org context* is connected to (`pac env who`), which is **not** guaranteed to match the project — and when that context is stale/ambiguous (e.g. duplicate active `pac auth` profiles) it fails with a misleading *"PAC CLI is not authenticated"*. Pin the env explicitly so the gate is deterministic.
125+
126+
Read the project's recorded env URL (first match wins): `.solution-manifest.json` → top-level `environmentUrl`, else `powerpages.config.json``environmentUrl`. Store as `CONFIGURED_ENV_URL`. (Both fields are top-level `environmentUrl` strings; declarative/EDM sites have no `powerpages.config.json`, so the manifest is the source there.)
127+
125128
```bash
126-
node "${PLUGIN_ROOT}/scripts/lib/verify-alm-prerequisites.js" --require-manifest
129+
node "${PLUGIN_ROOT}/scripts/lib/verify-alm-prerequisites.js" --require-manifest --envUrl "{CONFIGURED_ENV_URL}"
127130
```
128-
Capture output as JSON; extract `.envUrl` (store as `devEnvUrl`) and `.token` (store as `DEV_TOKEN`). If the script exits non-zero, stop and surface the error — it will indicate whether `az login`, `pac auth`, or WhoAmI failed.
131+
132+
(If neither file records an env URL, omit `--envUrl` and fall back to the pac-context default — `verify-alm-prerequisites.js` then resolves it via `pac env who`.) Capture output as JSON; extract `.envUrl` (store as `devEnvUrl`) and `.token` (store as `DEV_TOKEN`). If the script exits non-zero, stop and surface the error — it will indicate whether `az login`, `pac auth`, or WhoAmI failed.
129133

130134
2. Run `detect-project-context.js` to read project config and solution manifest:
131135
```bash
@@ -1189,6 +1193,17 @@ Evaluate the result and take action based on the outcome. In all cases, **after
11891193
- `"activationStatus": "{ACTIVATION_OUTCOME.status}"` (or keep `null` if `ACTIVATION_OUTCOME` is null)
11901194
- `"siteUrl": "{ACTIVATION_OUTCOME.siteUrl}"` (or keep `null`)
11911195
1196+
**Re-refresh the ALM plan so the activation outcome reaches it.** The Phase 7.5b refresh ran *before* activation was resolved, so the plan's "Activate site in {stage}" step is still pending even though `last-deploy.json` now records `activationStatus`. Re-run the refresh now that the marker is patched — the `deploy-pipeline` phase auto-completes the activate step when `activationStatus` is `"Activated"` (a deferred `"Pending"` correctly leaves it pending):
1197+
1198+
```bash
1199+
node "${PLUGIN_ROOT}/scripts/lib/refresh-alm-plan-data.js" \
1200+
--projectRoot "." \
1201+
--phase deploy-pipeline \
1202+
--render
1203+
```
1204+
1205+
(Soft no-op when no ALM plan exists — `refresh-alm-plan-data.js` returns `ok:false` when `docs/.alm-plan-data.json` is absent.)
1206+
11921207
Then update the deploy history HTML file (in-place `Edit`) — replace `__ACTIVATION_SECTION__` with the appropriate HTML:
11931208
11941209
- **`status: "Activated"`**:
@@ -1284,7 +1299,7 @@ Authorization: Bearer {HOST_TOKEN}
12841299
12851300
| Task subject | activeForm | Description |
12861301
|---|---|---|
1287-
| Verify prerequisites | Verifying prerequisites | Run verify-alm-prerequisites.js (--require-manifest) for PAC/az/WhoAmI; run detect-project-context.js for solutionManifest/siteName; read docs/alm/last-pipeline.json for pipelineId/stages; acquire host env token |
1302+
| Verify prerequisites | Verifying prerequisites | Run verify-alm-prerequisites.js (--require-manifest --envUrl pinned from project config) for PAC/az/WhoAmI; run detect-project-context.js for solutionManifest/siteName; read docs/alm/last-pipeline.json for pipelineId/stages; acquire host env token |
12881303
| Select target stage | Selecting target stage | Show available stages from docs/alm/last-pipeline.json; ask user to select target; warn if last deploy to this stage failed |
12891304
| Resolve pipeline info | Resolving pipeline info | Call RetrieveDeploymentPipelineInfo (v9.1) to get SourceDeploymentEnvironmentId and DeployableArtifacts; match solution |
12901305
| Validate package | Validating package | **`MULTI_RUN_MODE`**: run Phase 3.6 once (parallel batch) — `validate-stage-runs-batch.js` fans out create-stage-run + ValidatePackageAsync + poll-validation-status for all non-skipped solutions concurrently; halts the deploy on any failure or pending-approval batch; persists per-solution stageRunIds for the serial deploy loop to reuse. **Single-solution / legacy v2**: Phase 4 inline — POST deploymentstageruns (→ 201 or 204+header); POST ValidatePackageAsync top-level action (204); poll stagerunstatus until not 200000006; JSON.parse validationresults twice; fetch aigenerateddeploymentnotes; PATCH artifactversion + deploymentnotes + deploymentsettingsjson (from deployment-settings.json) |

0 commit comments

Comments
 (0)