forked from we45/Cut-The-Funds-NodeJS
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathJenkinsfile
44 lines (35 loc) · 1.06 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
properties([pipelineTriggers([githubPush()])])
node{
def sqli = false
stage ('Checkout'){
git branch: 'master',
credentialsId: 'GitScout',
url: 'https://github.com/we45/Cut-The-Funds-NodeJS.git'
}
stage('NpmAudit'){
sh '''
npm audit --json > audit-report.json | true
'''
archiveArtifacts allowEmptyArchive: true, artifacts: 'audit-report.json', onlyIfSuccessful: true
}
try{
stage('NodeJSScan'){
sh '''
nodejsscan -d $PWD -o report.json
SQLi=$(cat report.json| jq '.sec_issues."SQL Injection (SQLi)"')
if [ -n "$SQLi" ]; then
exit 1;
fi
'''
archiveArtifacts allowEmptyArchive: true, artifacts: 'report.json', onlyIfSuccessful: true
}
} catch(e) {
sqli = true
echo e.toString()
}
if(sqli) {
currentBuild.result = "FAILURE"
} else {
currentBuild.result = "SUCCESS"
}
}