add snyk html report

This commit is contained in:
Christopher Fenner
2018-06-26 16:05:43 +02:00
parent b44ebf99d1
commit 6bcf17c70a
2 changed files with 5 additions and 9 deletions
+1 -1
View File
@@ -121,11 +121,11 @@ steps:
excludeMtaModules: []
monitor: true
scanType: 'npm'
snykResultFile: 'snyk.json'
stashContent:
- 'buildDescriptor'
- 'opensourceConfiguration'
toJson: false
toHtml: false
testsPublishResults:
junit:
pattern: '**/target/surefire-reports/*.xml'
+4 -8
View File
@@ -15,7 +15,6 @@ import groovy.transform.Field
'monitor',
'scanType',
'snykOrg',
'snykResultFile',
'toJson',
'toHtml'
])
@@ -82,20 +81,17 @@ def call(Map parameters = [:]) {
}
cmd.push('&& snyk test')
if(config.toJson)
cmd.push("--json > ${config.snykResultFile}")
cmd.push("--json > snyk.json")
try{
sh cmd.join(' ')
}finally{
if(config.toHtml)
sh "snyk-to-html -i ${path}${config.snykResultFile} -o ${path}snyk.html"
if(config.toHtml) sh "snyk-to-html -i ${path}snyk.json -o ${path}snyk.html"
}
}
}
}finally{
if(config.toJson)
archiveArtifacts "${path.replaceAll('\\./', '')}${config.snykResultFile}"
if(config.toHtml)
archiveArtifacts "${path.replaceAll('\\./', '')}snyk.html"
if(config.toJson) archiveArtifacts "${path.replaceAll('\\./', '')}snyk.json"
if(config.toHtml) archiveArtifacts "${path.replaceAll('\\./', '')}snyk.html"
}
break
default: