|
1 | 1 | trigger: none |
| 2 | +pr: none |
2 | 3 |
|
3 | 4 | schedules: |
4 | | - - cron: '0 6 * * 1' # Every Monday at 06:00 UTC |
5 | | - displayName: 'Weekly accessibility scan' |
| 5 | + - cron: '0 6 * * 1' |
| 6 | + displayName: 'Weekly Monday 06:00 UTC scan' |
6 | 7 | branches: |
7 | | - include: |
8 | | - - main |
| 8 | + include: [main] |
9 | 9 | always: true |
10 | 10 |
|
| 11 | +parameters: |
| 12 | + - name: scanTargets |
| 13 | + displayName: 'Override scan targets (leave empty for defaults)' |
| 14 | + type: string |
| 15 | + default: '' |
| 16 | + |
11 | 17 | pool: |
12 | 18 | vmImage: 'ubuntu-latest' |
13 | 19 |
|
14 | 20 | variables: |
15 | | - SCANNER_BASE_URL: 'https://a11y-scan-demo-app.azurewebsites.net' |
| 21 | + - group: a11y-scan-config |
16 | 22 |
|
17 | 23 | strategy: |
18 | 24 | 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 |
| 25 | + codepen_sample: |
| 26 | + scanName: 'codepen-sample' |
| 27 | + scanUrl: 'https://codepen.io/leezee/pen/eYbXzpJ' |
| 28 | + a11y_scan_demo_app: |
| 29 | + scanName: 'a11y-scan-demo-app' |
| 30 | + scanUrl: '$(SCANNER_URL)' |
| 31 | + ontario_gov: |
| 32 | + scanName: 'ontario-gov' |
| 33 | + scanUrl: 'https://www.ontario.ca/page/government-ontario' |
29 | 34 |
|
30 | 35 | steps: |
31 | 36 | - checkout: self |
32 | | - displayName: 'Checkout repository' |
33 | 37 |
|
34 | 38 | - script: | |
35 | 39 | mkdir -p results |
36 | | - HTTP_STATUS=$(curl -s -o results/$(siteName).sarif -w "%{http_code}" \ |
37 | | - -X POST "$(SCANNER_BASE_URL)/api/ci/scan" \ |
| 40 | + HTTP_STATUS=$(curl -s -o results/$(scanName).sarif -w "%{http_code}" \ |
| 41 | + -X POST "$(SCANNER_URL)/api/ci/scan" \ |
38 | 42 | -H "Content-Type: application/json" \ |
39 | | - -d '{"url": "$(siteUrl)", "format": "sarif"}' \ |
| 43 | + -d '{"url": "$(scanUrl)", "format": "sarif"}' \ |
40 | 44 | --max-time 120) |
41 | | -
|
42 | 45 | echo "HTTP status: $HTTP_STATUS" |
43 | | -
|
44 | 46 | 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 | + echo "##vso[task.logissue type=error]Scan failed for $(scanUrl) (HTTP $HTTP_STATUS)" |
| 48 | + cat results/$(scanName).sarif |
47 | 49 | exit 1 |
48 | 50 | fi |
| 51 | + displayName: 'Run accessibility scan for $(scanName)' |
49 | 52 |
|
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() |
| 53 | + - task: PublishPipelineArtifact@1 |
57 | 54 | inputs: |
58 | | - pathToPublish: 'results' |
59 | | - artifactName: 'a11y-sarif-$(siteName)' |
60 | | - displayName: 'Publish SARIF artifact - $(siteName)' |
61 | | - |
62 | | - - task: PublishBuildArtifacts@1 |
| 55 | + targetPath: 'results/$(scanName).sarif' |
| 56 | + artifactName: 'sarif-$(scanName)' |
63 | 57 | condition: always() |
64 | | - inputs: |
65 | | - pathToPublish: 'results' |
66 | | - artifactName: 'CodeAnalysisLogs' |
67 | | - displayName: 'Publish to Scans tab - $(siteName)' |
| 58 | + displayName: 'Publish SARIF artifact' |
68 | 59 |
|
69 | | - - task: AdvancedSecurity-Publish@1 |
70 | | - condition: always() |
71 | | - inputs: |
72 | | - SarifsInputDirectory: '$(Build.SourcesDirectory)/results' |
73 | | - displayName: 'Publish SARIF to Advanced Security - $(siteName)' |
| 60 | + # Optional: Upload to ADO Advanced Security (requires GHAzDO license) |
| 61 | + # - task: AdvancedSecurity-Publish@1 |
| 62 | + # inputs: |
| 63 | + # SarifFile: 'results/$(scanName).sarif' |
| 64 | + # condition: always() |
0 commit comments