-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathJenkinsfileWindows
61 lines (54 loc) · 1.81 KB
/
JenkinsfileWindows
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
// Windows based Jenkins file that automates Veracode SCA and Pipeline scan.
// Script is based off of documentation (https://help.veracode.com/reader/tS9CaFwL4_lbIEWWomsJoA/MVXQBY1PzfrTXGd6V~ZgxA)
// and has been converted to work on a Windows based Jenkins machine.
// Add a SRCCLR_API_TOKEN and VERACODE_API_ACCOUNT API ID/KEY.
// Stores results.json file
pipeline {
agent any
stages
{
stage('Build') {
steps {
echo 'Building..'
powershell 'mvn package'
}
}
stage('SCA') {
environment {
SRCCLR_API_TOKEN = credentials('SRCCLR_API_TOKEN')
}
steps {
powershell """
Set-ExecutionPolicy AllSigned -Scope Process -Force
iex ((New-Object System.Net.WebClient).DownloadString('https://download.srcclr.com/ci.ps1'))
srcclr scan .
"""
}
}
stage('Veracode Pipeline Scan') {
environment {
SERVICE_CREDS = credentials('VERACODE_API_ACCOUNT')
}
steps {
powershell """
curl https://downloads.veracode.com/securityscan/pipeline-scan-LATEST.zip -o pipeline-scan.zip
Expand-Archive -Force -Path pipeline-scan.zip -DestinationPath veracode_scanner
java -jar veracode_scanner\\pipeline-scan.jar --veracode_api_id '${SERVICE_CREDS_USR}' \
--veracode_api_key '${SERVICE_CREDS_PSW}' \
--file target/verademo.war \
--fail_on_cwe "1234" // can fail on flaw cwe or severity. Reference: https://help.veracode.com/reader/tS9CaFwL4_lbIEWWomsJoA/zjaZE08bAYZVPBWWbgmZvw
"""
}
}
stage('Deploy') {
steps {
echo 'Deploying....'
}
}
}
post {
always {
archiveArtifacts artifacts: 'results.json', fingerprint: true
}
}
}