forked from AErmie/DevSecOps
-
Notifications
You must be signed in to change notification settings - Fork 0
/
anchore-pipeline.yml
58 lines (49 loc) · 1.6 KB
/
anchore-pipeline.yml
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
trigger: none
pool:
vmImage: 'ubuntu-latest'
variables:
pathToDockerFile: 'Dockerfile'
ACRConnectionName: 'AzureContainerRegistry-DevSecOps'
ACRLoginServer: 'adinermieacr.azurecr.io'
ACRRepository: 'eshoponweb'
stages:
- stage: QualityCheckStage
displayName: Quality Check Stage
jobs:
- job: AnchoreJob
displayName: Run Anchore Scan
steps:
- task: Docker@2
displayName: Build Docker Container Image
inputs:
containerRegistry: $(ACRConnectionName)
repository: $(ACRRepository)
command: build
Dockerfile: $(pathToDockerFile)
tags: |
$(Build.BuildId)
- task: Anchore@0
displayName: Run Anchore Container Image Scan
inputs:
image: $(ACRLoginServer)/$(ACRRepository):$(Build.BuildId)
# customPolicyPath: '.anchore/policy.json'
dockerfile: Dockerfile
includeAppPackages: true
printVulnerabilityReport: true
failBuild: true
debug: true
- script: |
echo $(policyStatus)
echo $(billOfMaterials)
cat $(billOfMaterials)
echo $(vulnerabilities)
cat $(vulnerabilities)
displayName: Output Scan Results
condition: succeededOrFailed()
# Publish the Anchore report as an artifact to Azure Pipelines
- task: PublishBuildArtifacts@1
displayName: 'Publish Artifact: Anchore Report'
condition: succeededOrFailed()
inputs:
PathtoPublish: '$(System.DefaultWorkingDirectory)/anchore-reports/'
ArtifactName: AnchoreReport