Skip to content

Commit cfb205b

Browse files
Merge pull request #16 from devopsabcs-engineering/feature/ghazdo-sync-pipelines
synced with ado for ghazdo
2 parents a1170a7 + f4767a6 commit cfb205b

2 files changed

Lines changed: 118 additions & 0 deletions

File tree

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
trigger: none
2+
3+
schedules:
4+
- cron: '0 6 * * 1' # Every Monday at 06:00 UTC
5+
displayName: 'Weekly accessibility scan'
6+
branches:
7+
include:
8+
- main
9+
always: true
10+
11+
pool:
12+
vmImage: 'ubuntu-latest'
13+
14+
variables:
15+
SCANNER_BASE_URL: 'https://a11y-scan-demo-app.azurewebsites.net'
16+
17+
strategy:
18+
matrix:
19+
codepen-sample:
20+
siteName: 'codepen-sample'
21+
siteUrl: 'https://codepen.io/leezee/pen/eYbXzpJ'
22+
a11y-scan-demo-app:
23+
siteName: 'a11y-scan-demo-app'
24+
siteUrl: 'https://a11y-scan-demo-app.azurewebsites.net/'
25+
ontario-gov:
26+
siteName: 'ontario-gov'
27+
siteUrl: 'https://www.ontario.ca/page/government-ontario'
28+
maxParallel: 3
29+
30+
steps:
31+
- checkout: self
32+
displayName: 'Checkout repository'
33+
34+
- script: |
35+
mkdir -p results
36+
HTTP_STATUS=$(curl -s -o results/$(siteName).sarif -w "%{http_code}" \
37+
-X POST "$(SCANNER_BASE_URL)/api/ci/scan" \
38+
-H "Content-Type: application/json" \
39+
-d '{"url": "$(siteUrl)", "format": "sarif"}' \
40+
--max-time 120)
41+
42+
echo "HTTP status: $HTTP_STATUS"
43+
44+
if [ "$HTTP_STATUS" -ne 200 ]; then
45+
echo "##vso[task.logissue type=error]Scan failed for $(siteUrl) (HTTP $HTTP_STATUS)"
46+
cat results/$(siteName).sarif
47+
exit 1
48+
fi
49+
50+
echo "SARIF file written: results/$(siteName).sarif"
51+
echo "File size: $(wc -c < results/$(siteName).sarif) bytes"
52+
displayName: 'Run accessibility scan - $(siteName)'
53+
timeoutInMinutes: 5
54+
55+
- task: PublishBuildArtifacts@1
56+
condition: always()
57+
inputs:
58+
pathToPublish: 'results'
59+
artifactName: 'a11y-sarif-$(siteName)'
60+
displayName: 'Publish SARIF artifact - $(siteName)'
61+
62+
- task: AdvancedSecurity-Publish@1
63+
condition: always()
64+
inputs:
65+
SarifsInputDirectory: '$(Build.SourcesDirectory)/results'
66+
displayName: 'Publish SARIF to Advanced Security - $(siteName)'
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
trigger:
2+
- main
3+
4+
pool:
5+
vmImage: ubuntu-latest
6+
7+
variables:
8+
SCANNER_BASE_URL: 'https://a11y-scan-demo-app.azurewebsites.net'
9+
10+
steps:
11+
- task: AdvancedSecurity-Codeql-Init@1
12+
inputs:
13+
languages: 'javascript, python'
14+
displayName: 'Initialize CodeQL'
15+
16+
- task: AdvancedSecurity-Dependency-Scanning@1
17+
displayName: 'Dependency scanning'
18+
19+
- task: AdvancedSecurity-Codeql-Analyze@1
20+
displayName: 'CodeQL analysis'
21+
22+
- script: |
23+
mkdir -p results
24+
HTTP_STATUS=$(curl -s -o results/a11y-scan.sarif -w "%{http_code}" \
25+
-X POST "$(SCANNER_BASE_URL)/api/ci/scan" \
26+
-H "Content-Type: application/json" \
27+
-d '{"url": "$(SCANNER_BASE_URL)", "format": "sarif"}' \
28+
--max-time 120)
29+
30+
echo "HTTP status: $HTTP_STATUS"
31+
32+
if [ "$HTTP_STATUS" -ne 200 ]; then
33+
echo "##vso[task.logissue type=warning]Accessibility scan failed (HTTP $HTTP_STATUS)"
34+
cat results/a11y-scan.sarif
35+
else
36+
echo "SARIF file written: results/a11y-scan.sarif"
37+
echo "File size: $(wc -c < results/a11y-scan.sarif) bytes"
38+
fi
39+
displayName: 'Run accessibility scan'
40+
timeoutInMinutes: 5
41+
42+
- script: |
43+
ADVSEC_DIR="$(Agent.TempDirectory)/.advsec"
44+
mkdir -p "$ADVSEC_DIR"
45+
cp results/*.sarif "$ADVSEC_DIR/" 2>/dev/null || true
46+
echo "Staged SARIF files for Advanced Security:"
47+
ls -la "$ADVSEC_DIR/"
48+
condition: always()
49+
displayName: 'Stage SARIF for Advanced Security'
50+
51+
- task: AdvancedSecurity-Publish@1
52+
displayName: 'Publish results to Advanced Security'

0 commit comments

Comments
 (0)