forked from randyjohnston/juice-shop
/
Jenkinsfile
64 lines (60 loc) · 1.63 KB
/
Jenkinsfile
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
pipeline {
agent any
tools {
nodejs "nodejs 14.17.0"
}
environment {
SNYK_TOKEN = credentials('SNYK_TOKEN')
}
stages {
stage('Download Latest Snyk CLI') {
steps {
script {
snyk_cli_dl_linux="https://static.snyk.io/cli/latest/snyk-linux-arm64"
echo "Download URL: ${snyk_cli_dl_linux}"
sh """
curl -Lo ./snyk "${snyk_cli_dl_linux}"
chmod +x ./snyk
mkdir -p reports
ls -la
./snyk -v
./snyk auth $SNYK_TOKEN
"""
}
}
}
stage('Get npm and snyk-to-html'){
steps {
script {
sh """
npm install
npm install snyk-to-html -g
"""
}
}
}
stage('Test Snyk') {
steps {
script {
sh "./snyk test --json | snyk-to-html -o reports/results.html"
}
}
}
stage('Deploy') {
steps {
echo 'Deploying....'
}
}
}
post {
always {
publishHTML (target : [allowMissing: false,
alwaysLinkToLastBuild: true,
keepAll: true,
reportDir: 'reports',
reportFiles: 'results.html',
reportName: 'snyk_test_report',
reportTitles: 'snyk_test'])
}
}
}