-
Notifications
You must be signed in to change notification settings - Fork 29
/
terrascan-pipeline.yml
61 lines (55 loc) · 2.08 KB
/
terrascan-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
trigger: none
pr: none
pool:
vmImage: 'ubuntu-latest'
stages:
- stage: QualityCheckStage
displayName: Quality Check Stage
jobs:
- job: TerraScanJob
displayName: Run TerraScan Scan
steps:
- script: |
mkdir TerraScanReport
docker pull accurics/terrascan
docker run \
--rm \
--volume $(System.DefaultWorkingDirectory)/Infrastructure-Source-Code/terraform/azure:/iac \
--workdir /iac \
accurics/terrascan:latest scan \
--iac-type terraform \
--policy-type all \
--verbose \
--output xml > $(System.DefaultWorkingDirectory)/TerraScanReport/TerraScan-Report.xml
docker run \
--rm \
--volume $(System.DefaultWorkingDirectory)/Infrastructure-Source-Code/terraform/azure:/iac \
--workdir /iac \
accurics/terrascan:latest scan \
--iac-type terraform \
--policy-type all \
--verbose
displayName: 'Accurics TerraScan Code Analysis'
- script: |
cd $(System.DefaultWorkingDirectory)/TerraScanReport
ls -la
displayName: 'DIR Contents'
condition: always()
# Publish the TerraScan report as an artifact to Azure Pipelines
- task: PublishBuildArtifacts@1
displayName: 'Publish Artifact: Terrascan Report'
condition: succeededOrFailed()
inputs:
PathtoPublish: '$(System.DefaultWorkingDirectory)/TerraScanReport'
ArtifactName: TerrascanReport
- task: PublishTestResults@2
displayName: Publish Terrascan Test Results
condition: succeededOrFailed()
inputs:
testResultsFormat: 'JUnit' # Options JUnit, NUnit, VSTest, xUnit, cTest
testResultsFiles: '**/*TerraScan-Report.xml'
searchFolder: '$(System.DefaultWorkingDirectory)/TerraScanReport'
mergeTestResults: false
testRunTitle: Terrascan Scan
failTaskOnFailedTests: false
publishRunAttachments: true