forked from snyk-labs/nodejs-goof
-
Notifications
You must be signed in to change notification settings - Fork 0
/
azure-pipelines.yml
58 lines (53 loc) · 1.93 KB
/
azure-pipelines.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
# Runs 4 Snyk Products (Code, Open Source, Container, IaC)
# Outputs the results to the pipeline
# Prerequisites:
# - Set a SNYK_TOKEN in the pipelines secrets
# - Install the HTML viewer extension
# https://marketplace.visualstudio.com/items?itemName=JakubRumpca.azure-pipelines-html-report
# NOTE: Change this to a different pool to run the scripts.
pool:
vmImage: ubuntu-latest
steps:
- checkout: self
# .. your instructions on building the app or preparing the repository
# install & prepare snyk
- script: |
npm install -g snyk snyk-delta
# This OPTIONAL step will configure the Snyk CLI to connect to the EU instance of Snyk.
# snyk config set use-base64-encoding=true
# snyk config set endpoint='https://app.eu.snyk.io/api'
snyk auth $(21417a2b-8896-4c2e-8c0c-8b3e6ac3b0f6)
# explicitly allow scripts to continue if errors occur
set +e
displayName: 'snyk install & auth'
# snyk code
- script: |
snyk code test --json --print-deps --severity-threshold=critical | snyk-delta --setPassIfNoBaseline true
RESULT=$?
exit $RESULT
continueOnError: true
displayName: 'snyk code'
# snyk open source
- script: |
snyk test --all-projects --json --severity-threshold=critical
RESULT=$?
exit $RESULT
continueOnError: true
displayName: 'snyk open source'
# snyk container
# NOTE: Change the image name
- script: |
snyk container test sebsnyk/juice-shop --file=Dockerfile --json-file-output=results.json
RESULT=$?
snyk-to-html -o $(Build.ArtifactStagingDirectory)/results-container.html < results.json
exit $RESULT
continueOnError: true
displayName: 'snyk container'
# snyk iac
- script: |
snyk iac test --json-file-output=results.json
RESULT=$?
snyk-to-html -o $(Build.ArtifactStagingDirectory)/results-iac.html < results.json
exit $RESULT
continueOnError: true
displayName: 'snyk iac'