From 5352bd6e4c3d529fe3b4afc102c4e0bc040117f6 Mon Sep 17 00:00:00 2001 From: Emmanuel Knafo Date: Thu, 26 Mar 2026 02:03:26 -0400 Subject: [PATCH] ops: add ADO pipeline configurations synced from ADO repo Fixes AB#2102 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - add a11y-scan, ci-cd, deploy-all, and scan-all pipelines - add deploy-app-stage and teardown-stage templates 🔧 - Generated by Copilot --- .azuredevops/pipelines/a11y-scan.yml | 6 + .azuredevops/pipelines/ci-cd.yml | 157 ++++++++++++++++ .azuredevops/pipelines/deploy-all.yml | 167 ++++++++++++++++++ .azuredevops/pipelines/scan-all.yml | 73 ++++++++ .../pipelines/templates/deploy-app-stage.yml | 95 ++++++++++ .../pipelines/templates/teardown-stage.yml | 50 ++++++ 6 files changed, 548 insertions(+) create mode 100644 .azuredevops/pipelines/ci-cd.yml create mode 100644 .azuredevops/pipelines/deploy-all.yml create mode 100644 .azuredevops/pipelines/scan-all.yml create mode 100644 .azuredevops/pipelines/templates/deploy-app-stage.yml create mode 100644 .azuredevops/pipelines/templates/teardown-stage.yml diff --git a/.azuredevops/pipelines/a11y-scan.yml b/.azuredevops/pipelines/a11y-scan.yml index e906644..27af80d 100644 --- a/.azuredevops/pipelines/a11y-scan.yml +++ b/.azuredevops/pipelines/a11y-scan.yml @@ -65,3 +65,9 @@ steps: pathToPublish: 'results' artifactName: 'CodeAnalysisLogs' displayName: 'Publish to Scans tab - $(siteName)' + + - task: AdvancedSecurity-Publish@1 + condition: always() + inputs: + SarifsInputDirectory: '$(Build.SourcesDirectory)/results' + displayName: 'Publish SARIF to Advanced Security - $(siteName)' diff --git a/.azuredevops/pipelines/ci-cd.yml b/.azuredevops/pipelines/ci-cd.yml new file mode 100644 index 0000000..7283450 --- /dev/null +++ b/.azuredevops/pipelines/ci-cd.yml @@ -0,0 +1,157 @@ +trigger: + branches: + include: + - main + +pool: + vmImage: 'ubuntu-latest' + +variables: + - group: wiki-access + - name: serviceConnection + value: 'AODA-svc-conn' + - name: appName + value: 'a11y-scan-demo' + - name: resourceGroup + value: 'rg-a11y-scan-demo' + - name: location + value: 'canadacentral' + - name: imageTag + value: '$(Build.BuildId)' + +stages: + - stage: Build + displayName: 'Build & Push Image' + jobs: + - job: BuildAndPush + displayName: 'Deploy infra, build and push to ACR' + steps: + - checkout: self + + - task: AzureCLI@2 + displayName: 'Deploy infrastructure' + inputs: + azureSubscription: '$(serviceConnection)' + scriptType: bash + scriptLocation: inlineScript + inlineScript: | + set -e + az group create --name $(resourceGroup) --location $(location) + az deployment group create \ + --resource-group $(resourceGroup) \ + --name infra-deploy \ + --template-file infra/main.bicep \ + --parameters infra/main.parameters.json \ + --parameters imageTag=$(imageTag) + + - task: AzureCLI@2 + displayName: 'Build and push Docker image' + inputs: + azureSubscription: '$(serviceConnection)' + scriptType: bash + scriptLocation: inlineScript + inlineScript: | + set -e + ACR_NAME=$(az deployment group show \ + --resource-group $(resourceGroup) \ + --name infra-deploy \ + --query 'properties.outputs.acrName.value' -o tsv) + echo "ACR: $ACR_NAME" + az acr build \ + --registry "$ACR_NAME" \ + --image $(appName):$(imageTag) . + + - stage: Deploy + displayName: 'Deploy to Azure' + dependsOn: Build + jobs: + - deployment: DeployWebApp + displayName: 'Deploy container to Web App' + environment: 'deploy' + strategy: + runOnce: + deploy: + steps: + - checkout: self + + - task: AzureCLI@2 + name: deployStep + displayName: 'Update Web App container' + inputs: + azureSubscription: '$(serviceConnection)' + scriptType: bash + scriptLocation: inlineScript + inlineScript: | + WEB_APP_NAME=$(az deployment group show \ + --resource-group $(resourceGroup) \ + --name infra-deploy \ + --query 'properties.outputs.webAppName.value' -o tsv) + ACR_LOGIN=$(az deployment group show \ + --resource-group $(resourceGroup) \ + --name infra-deploy \ + --query 'properties.outputs.acrLoginServer.value' -o tsv) + az webapp config container set \ + --name $WEB_APP_NAME \ + --resource-group $(resourceGroup) \ + --container-image-name "$ACR_LOGIN/$(appName):$(imageTag)" + az webapp restart \ + --name $WEB_APP_NAME \ + --resource-group $(resourceGroup) + SITE_URL="https://$WEB_APP_NAME.azurewebsites.net" + echo "Deployed to: $SITE_URL" + echo "##vso[task.setvariable variable=siteUrl;isOutput=true]$SITE_URL" + + - script: | + echo "Waiting for app to warm up..." + sleep 30 + npx --yes playwright install --with-deps chromium + npx playwright screenshot \ + --viewport-size="1280,900" \ + --wait-for-timeout=5000 \ + --full-page \ + "$(deployStep.siteUrl)" \ + screenshot.png + echo "Screenshot captured" + displayName: 'Capture deployment screenshot' + + - script: | + set -e + WIKI_REPO="https://$(WIKI_PAT)@dev.azure.com/MngEnvMCAP675646/AODA%20WCAG%20compliance/_git/AODA-WCAG-compliance.wiki" + SITE_URL="$(deployStep.siteUrl)" + APP="$(appName)" + BUILD_NUM="$(Build.BuildNumber)" + BUILD_ID="$(Build.BuildId)" + BUILD_URL="https://dev.azure.com/MngEnvMCAP675646/AODA%20WCAG%20compliance/_build/results?buildId=$BUILD_ID" + ATTACH_NAME="${APP}-${BUILD_ID}.png" + + git clone --depth 1 "$WIKI_REPO" wiki + mkdir -p wiki/.attachments wiki/Deployments + cp screenshot.png "wiki/.attachments/$ATTACH_NAME" + + cat > "wiki/Deployments/${APP}.md" <