Skip to content

Commit 77e1d4c

Browse files
Merge pull request #18 from devopsabcs-engineering/feature/2102-ado-pipeline-sync
ops: add ADO pipeline configurations synced from ADO repo Fixes AB#2102
2 parents cfb205b + 5352bd6 commit 77e1d4c

6 files changed

Lines changed: 548 additions & 0 deletions

File tree

.azuredevops/pipelines/a11y-scan.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,3 +65,9 @@ steps:
6565
pathToPublish: 'results'
6666
artifactName: 'CodeAnalysisLogs'
6767
displayName: 'Publish to Scans tab - $(siteName)'
68+
69+
- task: AdvancedSecurity-Publish@1
70+
condition: always()
71+
inputs:
72+
SarifsInputDirectory: '$(Build.SourcesDirectory)/results'
73+
displayName: 'Publish SARIF to Advanced Security - $(siteName)'

.azuredevops/pipelines/ci-cd.yml

Lines changed: 157 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,157 @@
1+
trigger:
2+
branches:
3+
include:
4+
- main
5+
6+
pool:
7+
vmImage: 'ubuntu-latest'
8+
9+
variables:
10+
- group: wiki-access
11+
- name: serviceConnection
12+
value: 'AODA-svc-conn'
13+
- name: appName
14+
value: 'a11y-scan-demo'
15+
- name: resourceGroup
16+
value: 'rg-a11y-scan-demo'
17+
- name: location
18+
value: 'canadacentral'
19+
- name: imageTag
20+
value: '$(Build.BuildId)'
21+
22+
stages:
23+
- stage: Build
24+
displayName: 'Build & Push Image'
25+
jobs:
26+
- job: BuildAndPush
27+
displayName: 'Deploy infra, build and push to ACR'
28+
steps:
29+
- checkout: self
30+
31+
- task: AzureCLI@2
32+
displayName: 'Deploy infrastructure'
33+
inputs:
34+
azureSubscription: '$(serviceConnection)'
35+
scriptType: bash
36+
scriptLocation: inlineScript
37+
inlineScript: |
38+
set -e
39+
az group create --name $(resourceGroup) --location $(location)
40+
az deployment group create \
41+
--resource-group $(resourceGroup) \
42+
--name infra-deploy \
43+
--template-file infra/main.bicep \
44+
--parameters infra/main.parameters.json \
45+
--parameters imageTag=$(imageTag)
46+
47+
- task: AzureCLI@2
48+
displayName: 'Build and push Docker image'
49+
inputs:
50+
azureSubscription: '$(serviceConnection)'
51+
scriptType: bash
52+
scriptLocation: inlineScript
53+
inlineScript: |
54+
set -e
55+
ACR_NAME=$(az deployment group show \
56+
--resource-group $(resourceGroup) \
57+
--name infra-deploy \
58+
--query 'properties.outputs.acrName.value' -o tsv)
59+
echo "ACR: $ACR_NAME"
60+
az acr build \
61+
--registry "$ACR_NAME" \
62+
--image $(appName):$(imageTag) .
63+
64+
- stage: Deploy
65+
displayName: 'Deploy to Azure'
66+
dependsOn: Build
67+
jobs:
68+
- deployment: DeployWebApp
69+
displayName: 'Deploy container to Web App'
70+
environment: 'deploy'
71+
strategy:
72+
runOnce:
73+
deploy:
74+
steps:
75+
- checkout: self
76+
77+
- task: AzureCLI@2
78+
name: deployStep
79+
displayName: 'Update Web App container'
80+
inputs:
81+
azureSubscription: '$(serviceConnection)'
82+
scriptType: bash
83+
scriptLocation: inlineScript
84+
inlineScript: |
85+
WEB_APP_NAME=$(az deployment group show \
86+
--resource-group $(resourceGroup) \
87+
--name infra-deploy \
88+
--query 'properties.outputs.webAppName.value' -o tsv)
89+
ACR_LOGIN=$(az deployment group show \
90+
--resource-group $(resourceGroup) \
91+
--name infra-deploy \
92+
--query 'properties.outputs.acrLoginServer.value' -o tsv)
93+
az webapp config container set \
94+
--name $WEB_APP_NAME \
95+
--resource-group $(resourceGroup) \
96+
--container-image-name "$ACR_LOGIN/$(appName):$(imageTag)"
97+
az webapp restart \
98+
--name $WEB_APP_NAME \
99+
--resource-group $(resourceGroup)
100+
SITE_URL="https://$WEB_APP_NAME.azurewebsites.net"
101+
echo "Deployed to: $SITE_URL"
102+
echo "##vso[task.setvariable variable=siteUrl;isOutput=true]$SITE_URL"
103+
104+
- script: |
105+
echo "Waiting for app to warm up..."
106+
sleep 30
107+
npx --yes playwright install --with-deps chromium
108+
npx playwright screenshot \
109+
--viewport-size="1280,900" \
110+
--wait-for-timeout=5000 \
111+
--full-page \
112+
"$(deployStep.siteUrl)" \
113+
screenshot.png
114+
echo "Screenshot captured"
115+
displayName: 'Capture deployment screenshot'
116+
117+
- script: |
118+
set -e
119+
WIKI_REPO="https://$(WIKI_PAT)@dev.azure.com/MngEnvMCAP675646/AODA%20WCAG%20compliance/_git/AODA-WCAG-compliance.wiki"
120+
SITE_URL="$(deployStep.siteUrl)"
121+
APP="$(appName)"
122+
BUILD_NUM="$(Build.BuildNumber)"
123+
BUILD_ID="$(Build.BuildId)"
124+
BUILD_URL="https://dev.azure.com/MngEnvMCAP675646/AODA%20WCAG%20compliance/_build/results?buildId=$BUILD_ID"
125+
ATTACH_NAME="${APP}-${BUILD_ID}.png"
126+
127+
git clone --depth 1 "$WIKI_REPO" wiki
128+
mkdir -p wiki/.attachments wiki/Deployments
129+
cp screenshot.png "wiki/.attachments/$ATTACH_NAME"
130+
131+
cat > "wiki/Deployments/${APP}.md" <<EOF
132+
# ${APP}
133+
134+
**Latest Deployment:** ${BUILD_NUM}
135+
136+
**Date:** $(date -u '+%Y-%m-%d %H:%M UTC')
137+
138+
**Site:** [${SITE_URL}](${SITE_URL})
139+
140+
**Pipeline:** [Build ${BUILD_ID}](${BUILD_URL})
141+
142+
---
143+
144+
![Deployment Screenshot](/.attachments/${ATTACH_NAME})
145+
EOF
146+
sed -i 's/^ //g' "wiki/Deployments/${APP}.md"
147+
148+
cd wiki
149+
git config user.email "pipeline@dev.azure.com"
150+
git config user.name "Azure Pipeline"
151+
git add -A
152+
git diff --cached --quiet && echo "No wiki changes" || {
153+
git commit -m "Update deployment screenshot for ${APP} (build ${BUILD_ID})"
154+
git push origin wikiMaster
155+
echo "Wiki updated: /Deployments/${APP}"
156+
}
157+
displayName: 'Update wiki with deployment screenshot'
Lines changed: 167 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,167 @@
1+
# Orchestrating pipeline: Deploy all demo apps and teardown after demo
2+
# Manually triggered - deploys all 6 apps in parallel, then tears down with approval
3+
trigger: none
4+
5+
resources:
6+
repositories:
7+
- repository: app001
8+
type: git
9+
name: a11y-demo-app-001
10+
- repository: app002
11+
type: git
12+
name: a11y-demo-app-002
13+
- repository: app003
14+
type: git
15+
name: a11y-demo-app-003
16+
- repository: app004
17+
type: git
18+
name: a11y-demo-app-004
19+
- repository: app005
20+
type: git
21+
name: a11y-demo-app-005
22+
23+
pool:
24+
vmImage: 'ubuntu-latest'
25+
26+
variables:
27+
serviceConnection: 'AODA-svc-conn'
28+
location: 'canadacentral'
29+
30+
stages:
31+
# ── Deploy demo apps 001-005 (all in parallel) ──
32+
- template: templates/deploy-app-stage.yml
33+
parameters:
34+
stageId: 'Deploy_001'
35+
stageName: 'Deploy App 001 (Rust)'
36+
appName: 'a11y-demo-app-001'
37+
resourceGroup: 'rg-a11y-demo-app-001'
38+
repository: 'app001'
39+
containerPort: '8080'
40+
41+
- template: templates/deploy-app-stage.yml
42+
parameters:
43+
stageId: 'Deploy_002'
44+
stageName: 'Deploy App 002 (C#)'
45+
appName: 'a11y-demo-app-002'
46+
resourceGroup: 'rg-a11y-demo-app-002'
47+
repository: 'app002'
48+
containerPort: '8080'
49+
50+
- template: templates/deploy-app-stage.yml
51+
parameters:
52+
stageId: 'Deploy_003'
53+
stageName: 'Deploy App 003 (Java)'
54+
appName: 'a11y-demo-app-003'
55+
resourceGroup: 'rg-a11y-demo-app-003'
56+
repository: 'app003'
57+
containerPort: '8080'
58+
59+
- template: templates/deploy-app-stage.yml
60+
parameters:
61+
stageId: 'Deploy_004'
62+
stageName: 'Deploy App 004 (Python)'
63+
appName: 'a11y-demo-app-004'
64+
resourceGroup: 'rg-a11y-demo-app-004'
65+
repository: 'app004'
66+
containerPort: '8080'
67+
68+
- template: templates/deploy-app-stage.yml
69+
parameters:
70+
stageId: 'Deploy_005'
71+
stageName: 'Deploy App 005 (Go)'
72+
appName: 'a11y-demo-app-005'
73+
resourceGroup: 'rg-a11y-demo-app-005'
74+
repository: 'app005'
75+
containerPort: '8080'
76+
77+
# ── Deploy scan demo app (self repo, parallel with others) ──
78+
- stage: Deploy_ScanDemo
79+
displayName: 'Deploy Scan Demo App (Next.js)'
80+
dependsOn: []
81+
jobs:
82+
- job: DeployApp
83+
displayName: 'Deploy a11y-scan-demo'
84+
steps:
85+
- checkout: self
86+
87+
- task: AzureCLI@2
88+
displayName: 'Deploy infrastructure'
89+
inputs:
90+
azureSubscription: '$(serviceConnection)'
91+
scriptType: bash
92+
scriptLocation: inlineScript
93+
inlineScript: |
94+
set -e
95+
az group create \
96+
--name rg-a11y-scan-demo \
97+
--location $(location)
98+
az deployment group create \
99+
--resource-group rg-a11y-scan-demo \
100+
--name infra-deploy \
101+
--template-file infra/main.bicep \
102+
--parameters infra/main.parameters.json \
103+
--parameters imageTag=$(Build.BuildId)
104+
105+
- task: AzureCLI@2
106+
displayName: 'Build and push Docker image'
107+
inputs:
108+
azureSubscription: '$(serviceConnection)'
109+
scriptType: bash
110+
scriptLocation: inlineScript
111+
inlineScript: |
112+
set -e
113+
ACR_NAME=$(az deployment group show \
114+
--resource-group rg-a11y-scan-demo \
115+
--name infra-deploy \
116+
--query 'properties.outputs.acrName.value' -o tsv)
117+
echo "ACR: $ACR_NAME"
118+
az acr build \
119+
--registry "$ACR_NAME" \
120+
--image a11y-scan-demo:$(Build.BuildId) .
121+
122+
- task: AzureCLI@2
123+
displayName: 'Deploy container to Web App'
124+
inputs:
125+
azureSubscription: '$(serviceConnection)'
126+
scriptType: bash
127+
scriptLocation: inlineScript
128+
inlineScript: |
129+
set -e
130+
WEB_APP_NAME=$(az deployment group show \
131+
--resource-group rg-a11y-scan-demo \
132+
--name infra-deploy \
133+
--query 'properties.outputs.webAppName.value' -o tsv)
134+
ACR_LOGIN=$(az deployment group show \
135+
--resource-group rg-a11y-scan-demo \
136+
--name infra-deploy \
137+
--query 'properties.outputs.acrLoginServer.value' -o tsv)
138+
az webapp config container set \
139+
--name $WEB_APP_NAME \
140+
--resource-group rg-a11y-scan-demo \
141+
--container-image-name "$ACR_LOGIN/a11y-scan-demo:$(Build.BuildId)"
142+
az webapp restart \
143+
--name $WEB_APP_NAME \
144+
--resource-group rg-a11y-scan-demo
145+
SITE_URL=$(az deployment group show \
146+
--resource-group rg-a11y-scan-demo \
147+
--name infra-deploy \
148+
--query 'properties.outputs.webAppUrl.value' -o tsv)
149+
echo "Deployed scan demo app to: $SITE_URL"
150+
151+
# ── Teardown (requires approval on 'teardown' environment) ──
152+
- template: templates/teardown-stage.yml
153+
parameters:
154+
dependsOn:
155+
- Deploy_001
156+
- Deploy_002
157+
- Deploy_003
158+
- Deploy_004
159+
- Deploy_005
160+
- Deploy_ScanDemo
161+
resourceGroups:
162+
- 'rg-a11y-demo-app-001'
163+
- 'rg-a11y-demo-app-002'
164+
- 'rg-a11y-demo-app-003'
165+
- 'rg-a11y-demo-app-004'
166+
- 'rg-a11y-demo-app-005'
167+
- 'rg-a11y-scan-demo'

0 commit comments

Comments
 (0)