-
Notifications
You must be signed in to change notification settings - Fork 29
/
trivy-pipeline.yml
86 lines (74 loc) · 2.65 KB
/
trivy-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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
trigger: none
pr: none
pool:
vmImage: 'ubuntu-latest'
variables:
WebContainerImageName: eshopwebmvc
WebContainerDockerfile: $(System.DefaultWorkingDirectory)/Application-Source-Code/src/Web/Dockerfile
APIContainerImageName: eshoppublicapi
dockerRegistryEndpoint: 'AzureContainerRegistry-DevSecOps'
stages:
- stage: QualityCheckStage
displayName: Quality Check Stage
jobs:
- job: TrivyFSJob
displayName: Run AquaSec Trivy FileSystem Scan
steps:
- task: trivy@1
displayName: Run AquaSec Trivy FileSystem Scan
inputs:
version: 'latest'
debug: true
path: $(System.DefaultWorkingDirectory)/Application-Source-Code/src/Web/
- job: TrivyContainerJob
displayName: Run AquaSec Trivy Container Image Scan (EXT)
steps:
# - template: templates/docker-compose-build.yml
- script: |
docker image pull node:19
displayName: Pull Node Docker Image
- task: trivy@1
displayName: Run AquaSec Trivy Container Image Scan
condition: succeededOrFailed()
inputs:
version: 'latest'
debug: false
image: docker.io/library/node:19
# - bash: |
# docker run -d -p 5000:8080 $(ACRLoginServer)/$(ACRRepository):$(Build.BuildId)
# displayName: 'Run App in Docker Container'
- job: TrivyDCKRContainerJob
displayName: Run AquaSec Trivy Container Image Scan (DCKR)
steps:
- script: |
docker image pull aquasec/trivy:latest
docker run --rm \
--volume /var/run/docker.sock:/var/run/docker.sock \
aquasec/trivy:latest image \
--format table \
docker.io/library/node:19
docker run --rm \
--volume /var/run/docker.sock:/var/run/docker.sock \
aquasec/trivy:latest image \
--format template \
--template "@contrib/junit.tpl" \
--output junit-report.xml \
docker.io/library/node:19
# --volume $HOME/Library/Caches:/root/.cache/ \
# docker cp $HOME/Library/Caches/junit-report.xml $(System.DefaultWorkingDirectory)/
# echo "Trivy DIR Content"
# cd $HOME/Library/Caches/trivy
# ls -la
# echo "Default Working DIR Content"
# cd $(System.DefaultWorkingDirectory)
# ls -la
displayName: Run AquaSec Trivy
condition: succeededOrFailed()
# - task: PublishTestResults@2
# displayName: Publish Test Results
# inputs:
# testResultsFormat: 'JUnit'
# testResultsFiles: '**/junit-report.xml'
# mergeTestResults: false
# failTaskOnFailedTests: true
# testRunTitle: 'AquaSec Trivy'