-
Notifications
You must be signed in to change notification settings - Fork 24
/
azure-pipelines-scan.yaml
69 lines (66 loc) · 2.45 KB
/
azure-pipelines-scan.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
trigger:
branches:
include:
- main
variables:
TARGET_URL: "http://localhost:8090/api"
# For illustration purposes only - This is fake data.
# Use Secrets when dealing with sensitive data.
USER_NAME: "[email protected]"
USER_PASS: "ball"
jobs:
- job: run_42crunch_scan
displayName: 'Run Scan'
pool:
vmImage: 'ubuntu-latest'
steps:
- task: DockerCompose@0
displayName: Run services
inputs:
action: Run services
dockerComposeFile: docker-compose.yaml
projectName: photomanager
qualifyImageNames: true
abortOnContainerExit: true
ports: 8090:8090
detached: true
- task: UsePythonVersion@0
inputs:
versionSpec: '3.11'
addToPath: true
architecture: 'x64'
- task: PythonScript@0
name: setusertoken
displayName: Get User Credential
inputs:
scriptSource: 'filePath' # Options: filePath, inline
scriptPath: $(Build.Repository.LocalPath)/.42c/scripts/pixi-login.py
arguments: -u $(USER_NAME) -p $(USER_PASS) -t $(TARGET_URL) -c AZURE
- task: APISecurityScanFreemium@1
displayName: Scan API
inputs:
apiDefinition: '$(Build.Repository.LocalPath)/api-specifications/PhotoManager.json'
apiCredential: $(setusertoken.PIXI_TOKEN)
targetURL: '$(TARGET_URL)'
logLevel: 'INFO'
exportAsPDF: '$(Build.Repository.LocalPath)/$(Build.BuildId)-scanreport.pdf'
sarifReport: '$(Build.Repository.LocalPath)/$(Build.BuildId)-scanreport.sarif'
scanReport: '$(Build.Repository.LocalPath)/$(Build.BuildId)-scanreport.json'
- task: PublishBuildArtifacts@1
displayName: publishScanSarif
inputs:
PathtoPublish: '$(Build.Repository.LocalPath)/$(Build.BuildId)-scanreport.sarif'
ArtifactName: 'CodeAnalysisLogs'
publishLocation: 'Container'
- task: PublishBuildArtifacts@1
displayName: publishScanPDF
inputs:
PathtoPublish: '$(Build.Repository.LocalPath)/$(Build.BuildId)-scanreport.pdf'
ArtifactName: 'Reports'
publishLocation: 'Container'
- task: PublishBuildArtifacts@1
displayName: publishRawReport
inputs:
PathtoPublish: '$(Build.Repository.LocalPath)/$(Build.BuildId)-scanreport.json'
ArtifactName: 'Reports'
publishLocation: 'Container'