forked from B3Partners/tailormap-legacy
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Jenkinsfile
98 lines (82 loc) · 3.89 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
timestamps {
node {
properties([
[$class: 'jenkins.model.BuildDiscarderProperty', strategy: [$class: 'LogRotator',
artifactDaysToKeepStr: '5',
artifactNumToKeepStr: '5',
daysToKeepStr: '15',
numToKeepStr: '5']
]]);
final def jdks = [/*'OpenJDK11',*/'JDK8']
stage("Prepare") {
checkout scm
}
jdks.eachWithIndex { jdk, indexOfJdk ->
final String jdkTestName = jdk.toString()
withEnv(["JAVA_HOME=${ tool jdkTestName }", "PATH+MAVEN=${tool 'Maven CURRENT'}/bin:${env.JAVA_HOME}/bin"]) {
echo "Using JDK: ${jdkTestName}"
stage("Build: ${jdkTestName}") {
echo "Building branch: ${env.BRANCH_NAME}"
sh "mvn clean install -U -DskipTests -Dtest.skip.integrationtests=true -B -V -fae -q"
}
stage("Test: ${jdkTestName}") {
echo "Running unit tests"
sh "mvn -e clean test -B"
}
lock('flamingo-oracle') {
try {
timeout(90) {
stage("Prepare Oracle: ${indexOfJdk}") {
sh ".jenkins/start-oracle.sh"
/* no need for this as we have a pristine oracle container... */
/* sh "sqlplus -l -S JENKINS_FLAMINGO/[email protected]:15211/XE < ./.jenkins/clear-oracle-schema.sql" */
}
lock('tomcat-tcp9090') {
stage("IntegrationTest: ${jdkTestName}") {
echo "Running integration tests on all modules except viewer-admin"
sh "mvn -e verify -B -Pjenkins -pl '!viewer-admin'"
echo "Running integration tests on viewer-admin module only"
sh "mvn -e verify -B -Pjenkins -pl 'viewer-admin'"
}
}
}
} finally {
sh "docker stop oracle-flamingo"
}
}
if (jdkTestName == 'OpenJDK11') {
stage("cleanup Java 11 packages") {
echo "Removing Java 11 built artifacts from local repository"
sh "mvn build-helper:remove-project-artifact"
}
}
}
}
stage('Publish Test Results') {
junit allowEmptyResults: true, testResults: '**/target/surefire-reports/TEST-*.xml, **/target/failsafe-reports/TEST-*.xml'
}
stage('Publish Test Coverage results') {
jacoco exclusionPattern: '**/*Test.class', execPattern: '**/target/**.exec'
sh "curl -s https://codecov.io/bash | bash"
}
withEnv(["JAVA_HOME=${ tool 'JDK8' }", "PATH+MAVEN=${tool 'Maven CURRENT'}/bin:${env.JAVA_HOME}/bin"]) {
if (env.BRANCH_NAME == 'master') {
stage("Docker image build & push") {
echo "Create a docker image of the master branch"
sh "mvn install -Dmaven.test.skip=true -B -V -e -fae -q"
sh "mvn deploy -B -pl :docker -P docker"
}
}
stage('Check Javadocs') {
sh "mvn javadoc:javadoc"
}
stage('Check Test Javadocs') {
sh "mvn javadoc:test-javadoc"
}
stage('OWASP Dependency Check') {
sh "mvn org.owasp:dependency-check-maven:aggregate"
dependencyCheckPublisher failedNewCritical: 1, unstableNewHigh: 1, unstableNewLow: 1, unstableNewMedium: 1
}
}
}
}