This repository has been archived by the owner on Apr 15, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Jenkinsfile
46 lines (38 loc) · 1.58 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
timestamps {
properties([
[$class: 'jenkins.model.BuildDiscarderProperty', strategy: [$class: 'LogRotator',
artifactDaysToKeepStr: '8',
artifactNumToKeepStr: '3',
daysToKeepStr: '15',
numToKeepStr: '5']
]]);
final def jdks = ['OpenJDK11', 'OpenJDK8']
node {
jdks.eachWithIndex { jdk, indexOfJdk ->
final String jdkTestName = jdk.toString()
withEnv(["JAVA_HOME=${ tool jdkTestName }", "PATH+MAVEN=${tool 'Maven CURRENT'}/bin:${env.JAVA_HOME}/bin"]) {
stage('Prepare') {
checkout scm
}
stage('Build') {
echo "Building branch: ${env.BRANCH_NAME}"
sh "mvn install -B -V -e -fae -q"
}
stage('Test') {
echo "Running unit tests"
sh "mvn -e test -B"
}
}
}
withEnv(["JAVA_HOME=${ tool 'OpenJDK8' }", "PATH+MAVEN=${tool 'Maven CURRENT'}/bin:${env.JAVA_HOME}/bin"]) {
stage('Publish Test Results') {
junit allowEmptyResults: true, testResults: '**/target/surefire-reports/TEST-*.xml, **/target/failsafe-reports/TEST-*.xml'
}
stage('OWASP Dependency Check') {
echo "Uitvoeren OWASP dependency check"
sh "mvn org.owasp:dependency-check-maven:check"
dependencyCheckPublisher failedNewCritical: 1, unstableNewHigh: 1, unstableNewLow: 1, unstableNewMedium: 1
}
}
}
}