-
Notifications
You must be signed in to change notification settings - Fork 1
/
Jenkinsfile_Linux.groovy
67 lines (58 loc) · 2.64 KB
/
Jenkinsfile_Linux.groovy
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
65
66
67
/*
* Normal Jenkinsfile that will build and do Policy and SCA scans
*/
pipeline {
agent any
environment {
VERACODE_APP_NAME = 'VeraDemo' // App Name in the Veracode Platform
}
// this is optional on Linux, if jenkins does not have access to your locally installed docker
//tools {
// these match up with 'Manage Jenkins -> Global Tool Config'
//'org.jenkinsci.plugins.docker.commons.tools.DockerTool' 'docker-latest'
//}
options {
// only keep the last x build logs and artifacts (for space saving)
buildDiscarder(logRotator(numToKeepStr: '20', artifactNumToKeepStr: '20'))
}
stages{
stage ('build') {
steps {
withMaven(maven:'maven-3') {
script {
dir('app') {
sh 'mvn clean package'
}
}
}
}
}
stage ('Veracode scan') {
steps {
echo 'Veracode scanning'
withCredentials([ usernamePassword (
credentialsId: 'veracode_login', usernameVariable: 'VERACODE_API_ID', passwordVariable: 'VERACODE_API_KEY') ]) {
// fire-and-forget
veracode applicationName: "${VERACODE_APP_NAME}", uploadIncludesPattern: "app/target/verademo.war", scanName: "${BUILD_TAG}-${env.HOST_OS}", vid: "${VERACODE_API_ID}", vkey: "${VERACODE_API_KEY}"
// wait for scan to complete (timeout: x)
//veracode applicationName: '${VERACODE_APP_NAME}'', criticality: 'VeryHigh', debug: true, timeout: 20, fileNamePattern: '', pHost: '', pPassword: '', pUser: '', replacementPattern: '', sandboxName: '', scanExcludesPattern: '', scanIncludesPattern: '', scanName: "${BUILD_TAG}", uploadExcludesPattern: '', uploadIncludesPattern: 'target/verademo.war', vid: '${VERACODE_API_ID}', vkey: '${VERACODE_API_KEY}'
}
}
}
stage ('Veracode SCA') {
steps {
echo 'Veracode SCA'
withCredentials([ string(credentialsId: 'SCA_Token', variable: 'SRCCLR_API_TOKEN')]) {
withMaven(maven:'maven-3') {
script {
sh '''
export SCAN_DIR="./app"
curl -sSL https://download.sourceclear.com/ci.sh | bash -s scan --update-advisor
'''
}
}
}
}
}
}
}