Skip to content

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

Closed
Krrish Mittal (takyyon) wants to merge 7 commits into
mainfrom
krmitta/ado-docs-deploy-pipeline
Closed

Krrish Mittal (takyyon) wants to merge 7 commits into
mainfrom
krmitta/ado-docs-deploy-pipeline

Conversation

@takyyon

Copy link
Copy Markdown
Contributor

Agent assessment

Self-reported assessment, not an independent review.

Assessed revision: 631a69817c05ffad1bdb1538e6752d8d6c6c187c

Dimension Assessment Rationale
Change confidence 9/10 ↑ Live ADO 1ES Official Canary E2E run 193213209 (canary-20261125.3) succeeded end-to-end on this exact commit (SDLSources, credential-free Astro build + Python link validation under CFSClean, pinned SWA CLI pre-install, WIF deploy to otto-docs-canary-swa, and post-deploy smoke probes https://otto-canary.azure.com/docs/ HTTP 200 + direct origin HTTP 403).
↑ Negative security test 193210046 (target=prod from feature branch) confirmed ADO Branch Control (1108237) blocks otto-docs-prod-arm before any deploy agent starts.
↓ Production deployment on main and the one-time zero-downtime otto-docs-swa Free → Standard SKU cutover execute post-merge; PR GitHub Actions Build check runs upon PR creation.

Summary

Migrates Azure Static Web Apps deployment for docs-site/ from the mitigated GitHub Actions OIDC identity (e8323013-aff3-46b9-8f7e-96ea41edf48a) to an Azure DevOps 1ES Official pipeline (Logic-Apps-Automation-Docs, definition 490778 in msazure/One) backed by isolated Workload Identity Federation (WIF) service connections. Keeps fast, credential-free build and link validation in GitHub Actions for PRs and main.

Also updates docs-site/scripts/apply-lockdown.mjs and docs-site/INFRA.md for production to use the active auto-portal-afd Front Door ID (fd12a176-4667-4e79-8d3d-0bd88e863ff7) instead of the legacy otto-portal-afd ID (c1504f11-9bfe-40e3-b58f-923f88dc0689).

Architecture & Design

  • Credential-free PR validation (GitHub Actions): .github/workflows/docs-site-deploy.yml retains the Build job (npm ci, npm run check, npm run build, Python link checker unit tests, and scripts/validate_docs_site.py) with contents: read only. All Azure OIDC deploy and preview teardown jobs are removed.
  • 1ES Official build & deploy (Azure DevOps 490778): .azure-pipelines/docs-site-deploy.yml extends v1/1ES.Official.PipelineTemplate.yml@1esPipelines with two isolated stages:
    1. Build (credential-free, CFSClean network isolation): authenticates .azure-pipelines/ado.npmrc to the LogicApps Azure Artifacts npm mirror via npmAuthenticate@0, rewrites lockfile registry URLs in the ephemeral workspace while preserving package-lock.json integrity hashes, runs npm ci, npm run check, npm run build, and Python link validation, and publishes docs-dist.
    2. Deploy (canary default on main push; prod manual-only): verifies target branch guard, injects forwardingGateway via docs-site/scripts/apply-lockdown.mjs, asserts exact X-Azure-FDID and allowedForwardedHosts, pre-installs pinned @azure/static-web-apps-cli@2.1.0 before Azure login, authenticates via WIF (AzureCLI@2), enforces Standard SKU, fetches the SWA deployment token just-in-time (masked with ##vso[task.setsecret]), deploys with --swa-config-location pinned to the locked-down staging directory, and runs post-deploy smoke probes (public AFD HTTP 200, direct *.azurestaticapps.net origin HTTP 403).
  • Isolated WIF & least-privilege RBAC:
    • Canary: otto-docs-canary-arm → UAMI otto-docs-canary-deploy-mi → Contributor scoped strictly to otto-docs-canary-swa + pipeline 490778 only + Exclusive Lock.
    • Prod: otto-docs-prod-arm → UAMI otto-docs-prod-deploy-mi → Contributor scoped strictly to otto-docs-swa + pipeline 490778 only + Exclusive Lock + Branch Control (refs/heads/main,refs/tags/release) + Manual Approval.

Key Decisions

  • Keep .github/workflows/docs-site-deploy.yml with the Build job name: Preserves fast PR feedback and avoids breaking any branch protection checks tied to the Build job while eliminating all Azure credentials from GitHub Actions.
  • Pre-install pinned @azure/static-web-apps-cli@2.1.0 outside AzureCLI@2: Ensures zero npm package resolution executes while WIF credentials or SWA_CLI_DEPLOYMENT_TOKEN are in scope.
  • Fix Prod frontDoorId to fd12a176-4667-4e79-8d3d-0bd88e863ff7 (auto-portal-afd): auto.azure.com is fronted by auto-portal-afd (not legacy otto-portal-afd). Updating the FDID prevents HTTP 403s once otto-docs-swa runs on Standard SKU.

Files Changed

  • .azure-pipelines/docs-site-deploy.yml — Added 1ES Official docs build, AFD lockdown, WIF SWA deploy, and post-deploy smoke-probe pipeline.
  • .azure-pipelines/ado.npmrc — Added internal LogicApps Azure Artifacts npm upstream registry config for 1ES CFSClean builds.
  • .github/workflows/docs-site-deploy.yml — Retained credential-free Build job; removed mitigated Azure OIDC deploy and preview-close jobs.
  • docs-site/scripts/apply-lockdown.mjs — Updated TARGETS.prod.frontDoorId to fd12a176-4667-4e79-8d3d-0bd88e863ff7 (auto-portal-afd).
  • docs-site/INFRA.md — Updated resource map, ADO WIF architecture, zero-downtime Prod Standard SKU bootstrap/rollback runbook, and disaster-recovery commands.
  • docs-site/README.md — Updated workflow references to point PR validation to GitHub Actions and Canary/Prod deploys to ADO pipeline 490778.

Testing

  • ADO Pipeline Preview (490778/preview): Expanded cleanly on final branch head.
  • Live Canary E2E (193213209, canary-20261125.3): Full green across 🔒 SDLSources, Build and validate docs site, and Deploy docs site (canary) (https://otto-canary.azure.com/docs/ → HTTP 200, https://lemon-mud-0e10bdd1e.7.azurestaticapps.net/docs/ → HTTP 403).
  • Live Prod Branch Control negative check (193210046, prod-20261125.1): Confirmed ADO Branch Control (1108237) rejected target=prod from a non-main branch before any deploy agent started.
  • Local unit/config checks: Verified apply-lockdown.mjs injects expected X-Azure-FDID and allowedForwardedHosts for both canary and prod; validated YAML syntax for both workflow/pipeline files.

Post-Merge Cutover Checklist

  1. Switch ADO pipeline 490778 default branch to main and add Branch Control (refs/heads/main,refs/tags/release) to otto-docs-canary-arm.
  2. Execute the zero-downtime Prod Standard SKU bootstrap documented in docs-site/INFRA.md (deploy updated fd12a176-4667-4e79-8d3d-0bd88e863ff7 config while otto-docs-swa is Free → az staticwebapp update --sku Standard → run approved ADO 490778 target=prod deploy on main and confirm https://auto.azure.com/docs/ returns 200 and direct origin returns 403).

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
…lockdown

- Enable main CI trigger on .azure-pipelines/docs-site-deploy.yml for Canary auto-deploy
- Update docs-site/scripts/apply-lockdown.mjs prod frontDoorId to auto-portal-afd (fd12a176-4667-4e79-8d3d-0bd88e863ff7)
- Keep credential-free PR/main Build validation in .github/workflows/docs-site-deploy.yml and remove mitigated Azure OIDC deploy jobs
- Update docs-site/INFRA.md and docs-site/README.md for ADO pipeline 490778 and isolated WIF auth

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
…ct AFD host

- Install pinned @azure/static-web-apps-cli@2.1.0 in a credential-free step before AzureCLI@2 so no npm install executes while WIF or SWA_CLI_DEPLOYMENT_TOKEN is in scope
- Assert exact allowedForwardedHosts match against targetPublicHost in lockdown verification
- Document zero-downtime Prod Standard SKU bootstrap/rollback, release tag hygiene, and LogicApps npm mirror requirements in docs-site/INFRA.md

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
@takyyon

Copy link
Copy Markdown
Contributor Author

Superseded by #67 (clean single-commit feature branch feature/ado-docs-deploy-pipeline). Keeping krmitta/ado-docs-deploy-pipeline intact until PR #67 merges and ADO pipeline 490778 default branch is switched to main.

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