-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathJenkinsfile
105 lines (100 loc) · 3.14 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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
@Library('security-pipeline-library')_
pipeline {
options {
// Build auto timeout
timeout(time: 600, unit: 'MINUTES')
}
// Some global default variables
environment {
// Core Settings
EMAIL_FROM = "${globalVars.EMAIL_FROM}"
SUPPORT_EMAIL = "${globalVars.SUPPORT_EMAIL}"
RELEASE_NUMBER = "${globalVars.RELEASE_NUMBER}"
IMG_PULL_SECRET = "${globalVars.IMG_PULL_SECRET}"
GIT_CREDS_ID = "${globalVars.GIT_CREDS_ID}"
VULNMANAGER_URL = "${globalVars.VULNMANAGER_URL}"
SONARQUBE_SERVER_URL = "${globalVars.SONARQUBE_SERVER_URL}"
SONARQUBE_SCANNER_HOME = "${globalVars.SONARQUBE_SCANNER_HOME}"
SONARQUBE_AUTH_TOKEN = credentials('SonarQube Global Analysis')
SNYK_API_KEY = credentials('snyk-api-key')
// App-specific settings
appName = "SECUSPHERE_JP"
SOURCE_DIR = "src"
GIT_URL = "https://github.com/SecurityUniversalOrg/jenkins-threatbuster-plugin.git"
}
// In this example, all is built and run from the master
agent any
// Pipeline stages
stages {
stage('Unit Testing') {
when {
expression {
env.BRANCH_NAME ==~ /^release\/.*\/.*/
}
}
steps {
jslMavenUnitTesting()
}
}
stage('Secret Scanning') {
when {
expression {
env.BRANCH_NAME ==~ /^release\/.*\/.*/
}
}
steps {
jslSecretScanning()
}
}
stage('Software Composition Analysis') {
when {
expression {
env.BRANCH_NAME ==~ /^release\/.*\/.*/
}
}
steps {
jslJavaSoftwareCompositionAnalysis()
}
}
stage('Static Application Security Testing') {
when {
expression {
env.BRANCH_NAME ==~ /^release\/.*\/.*/
}
}
steps {
jslStaticApplicationSecurityTesting()
}
}
stage('Java Maven Build') {
when {
expression {
env.BRANCH_NAME ==~ /^release\/.*\/.*/
}
}
steps {
jslMavenVerify()
}
}
stage('Merge Current Branch to Prod Branch') {
when {
expression {
env.BRANCH_NAME ==~ /^release\/(?!.*\/Prod).*\/.*/
}
}
steps {
checkout([
$class: 'GitSCM',
branches: [[name: '*/' + BRANCH_NAME]],
doGenerateSubmoduleConfigurations: false,
extensions: [],
submoduleCfg: [],
userRemoteConfigs: [
[credentialsId: env.GIT_CREDS_ID, url: env.GIT_URL]
]
])
jslGitPushToProdBranch(env.GIT_CREDS_ID, env.GIT_URL)
}
}
}
}