Skip to content

ci(docs): migrate SWA docs deployment to Azure DevOps WIF pipeline - #67

Merged
Krrish Mittal (takyyon) merged 1 commit into
mainfrom
feature/ado-docs-deploy-pipeline
Nov 25, 2026
Merged

Krrish Mittal (takyyon) merged 1 commit into
mainfrom
feature/ado-docs-deploy-pipeline

Conversation

@takyyon

@takyyon Krrish Mittal (takyyon) commented Nov 25, 2026 •

Copy link
Copy Markdown
Contributor

Agent assessment

Self-reported assessment, not an independent review.

Assessed revision: a9a05fbdeaf86704478a975cf55f19c9c8423d26

Dimension Assessment Rationale
Change confidence 9.5/10 ↑ Full local validation passed (npm run check 47/47 blog tests + astro check 0 errors, npm run build 42 pages, unittest 14/14, validate_docs_site.py 42 pages / 3,036 links, apply-lockdown.mjs canary & prod config verification, tag-ref/branch guard checks).
↑ All PR checks on a9a05fbdeaf86704478a975cf55f19c9c8423d26 passed: GitHub Actions Build (31s), license/cla, and live Azure DevOps 1ES Official run 193225708 (canary-20261125.4) across 🔒 SDLSources, Build and validate docs site, and Deploy docs site (canary) (including AFD 200 and direct origin 403 probes).
↓ Live Production deployment cannot run until this PR merges to main and logicapps-auto-docs-prod is upgraded from Free to Standard SKU.

Summary

Migrates docs-site deployment (canary and prod) from the mitigated GitHub Actions Azure OIDC application to a 1ES Official Azure DevOps pipeline (msazure/One definition 490778) using isolated Azure Workload Identity Federation (WIF) service connections.

GitHub Actions remains active solely as a credential-free Build PR/push check.

Architecture & Design

  • Credential-free GitHub Actions (.github/workflows/docs-site-deploy.yml): Retains only the Build job (npm ci, npm run check, npm run build, Python unit tests, and validate_docs_site.py). Removes DeployCanary, DeployProd, Preview, and ClosePreview jobs along with all Azure OIDC login and id-token: write permissions.
  • 1ES Official Azure DevOps pipeline (.azure-pipelines/docs-site-deploy.yml):
    • Stage 1 (Build, credential-free): Builds Astro + Pagefind via NpmAuthenticate@0 against the LogicApps Azure Artifacts npm upstream mirror (.azure-pipelines/ado.npmrc), runs blog tests, astro check, Python unit tests, and validate_docs_site.py, and publishes docs-dist.
    • Stage 2 (Deploy, target-isolated WIF):
      • Enforces target/branch guards: rejects refs/tags/* for all targets and restricts prod strictly to refs/heads/main.
      • Copies docs-dist to a staged temp directory, applies target-specific Azure Front Door lockdown (apply-lockdown.mjs), and asserts the exact expected X-Azure-FDID and allowedForwardedHosts values before deployment.
      • Pre-installs pinned @azure/static-web-apps-cli@2.1.0 in a separate credential-free step before entering AzureCLI@2.
      • Verifies the target Static Web App is on the Standard SKU, retrieves the deployment token via WIF (marked secret via ##vso[task.setsecret] and passed via SWA_CLI_DEPLOYMENT_TOKEN), and deploys via swa deploy --swa-config-location.
      • Runs post-deploy smoke probes verifying AFD returns HTTP 200 and direct origin returns HTTP 403.
  • AFD Lockdown (docs-site/scripts/apply-lockdown.mjs): Updates the prod frontDoorId to match the active auto-portal-afd Front Door profile (fd12a176-4667-4e79-8d3d-0bd88e863ff7).
  • Documentation (docs-site/INFRA.md, docs-site/README.md): Documents ADO pipeline 490778, WIF service connections, LogicApps npm mirror authentication, pinned SWA CLI pre-install, tag-ref/branch guards, and the zero-downtime Prod Standard SKU bootstrap and rollback runbook.

Key Decisions

  1. Separated build and deploy trust boundaries: Building in a credential-free stage and pre-installing pinned @azure/static-web-apps-cli@2.1.0 outside AzureCLI@2 prevents third-party npm install lifecycle scripts from executing while Azure deployment credentials are in scope.
  2. Hard SKU and config verification before upload: Failing fast if SWA SKU is not Standard or if staticwebapp.config.json does not contain the exact expected X-Azure-FDID and host prevents accidentally publishing an unlocked site or breaking AFD header enforcement.
  3. CI triggers Canary on main, Prod remains manual: Merges to main automatically validate and deploy Canary (otto-canary.azure.com), while Production (auto.azure.com) requires an explicit manual pipeline run on refs/heads/main with deployTarget=prod.

Files Changed

  • .azure-pipelines/docs-site-deploy.yml — New 1ES Official docs build and WIF deploy pipeline.
  • .azure-pipelines/ado.npmrc — Azure Artifacts LogicApps npm upstream registry config for CFSClean pool builds.
  • .github/workflows/docs-site-deploy.yml — Simplified to credential-free Build job only.
  • docs-site/scripts/apply-lockdown.mjs — Updated prod frontDoorId to active auto-portal-afd.
  • docs-site/INFRA.md — Updated infrastructure, WIF pipeline architecture, and Prod cutover/rollback docs.
  • docs-site/README.md — Updated deployment overview to reference ADO pipeline 490778.

Testing

  • Local validation on a9a05fbdeaf86704478a975cf55f19c9c8423d26:
    • YAML syntax check (.azure-pipelines/docs-site-deploy.yml, .github/workflows/docs-site-deploy.yml) — passed.
    • npm ci + npm run check — 47/47 blog tests passed; astro check 0 errors, 0 warnings, 0 hints.
    • npm run build — 42 pages + Pagefind + postbuild succeeded.
    • python3 -m unittest discover -s scripts/tests -p 'test_*.py' — 14/14 passed.
    • python3 scripts/validate_docs_site.py — passed (42 pages, 3,036 links).
    • apply-lockdown.mjs verified for both canary (2ca9cd4d-6df1-47b7-b8e2-24ba2bd17727 / otto-canary.azure.com) and prod (fd12a176-4667-4e79-8d3d-0bd88e863ff7 / auto.azure.com).
    • Tag-ref (refs/tags/*) and prod-on-non-main branch guard shell logic verified.
  • GitHub Actions PR CI:
    • Build check on a9a05fbdeaf86704478a975cf55f19c9c8423d26 — pass (31s).
    • license/cla — pass.
  • Live ADO 1ES Official Canary E2E:
    • Run 193225708 (canary-20261125.4) on refs/heads/feature/ado-docs-deploy-pipeline (a9a05fbdeaf86704478a975cf55f19c9c8423d26) — succeeded across 🔒 SDLSources, Build and validate docs site, and Deploy docs site (canary), including post-deploy AFD 200 and direct origin 403 probes.

Post-Merge Cutover

  1. Switch ADO pipeline 490778 default branch from krmitta/ado-docs-deploy-pipeline to main, then delete the temporary krmitta/ado-docs-deploy-pipeline branch.
  2. Verify the automatic main CI Canary run succeeds on 490778.
  3. Before the first manual prod run, upgrade logicapps-auto-docs-prod from Free to Standard SKU and run 490778 manually on main with deployTarget=prod (see docs-site/INFRA.md).

- Add 1ES Official Azure DevOps pipeline (.azure-pipelines/docs-site-deploy.yml) and Azure Artifacts npmrc (.azure-pipelines/ado.npmrc) for Canary and Production SWA deploys via isolated WIF service connections, pinned SWA CLI pre-install, AFD lockdown verification, tag-ref & branch guards, and post-deploy smoke probes.
- Narrow .github/workflows/docs-site-deploy.yml to credential-free PR and main build/link validation.
- Update docs-site/scripts/apply-lockdown.mjs, docs-site/INFRA.md, and docs-site/README.md for the ADO WIF pipeline and Standard SKU AFD lockdown.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
@takyyon Krrish Mittal (takyyon) added documentation Improvements or additions to documentation github_actions Pull requests that update GitHub Actions code labels Nov 25, 2026
@takyyon
Krrish Mittal (takyyon) merged commit 9776268 into main Nov 25, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation github_actions Pull requests that update GitHub Actions code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants