-
Notifications
You must be signed in to change notification settings - Fork 0
/
UnitTests.groovy
76 lines (72 loc) · 2.86 KB
/
UnitTests.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
68
69
70
71
72
73
74
75
76
@Library('payara') _l1
@Library('util') _l2
def mavenVersion = 4
def profiles = optionalMavenProfiles mavenVersion, 'payara-server-local,ui-test,ci'
def payara_config = [ domain_name : 'test-domain' ]
def mvn_cmd = 'mvn'
def payara_build_options = ''
def mavenParamsFromFile = ''
def qualityThreshold = 1
pipeline {
agent any
options {
quietPeriod 0
}
stages {
stage('Checkout and Setup') {
steps {
script {
currentBuild.description = "Commit ${env.GIT_COMMIT[0..7]} Node $env.NODE_NAME"
if (env.GIT_URL.contains('shiro')) {
shiroPayaraConfig payara_config
qualityThreshold = 3
}
payara_config << [ jacoco_profile : profiles + optionalMavenProfiles(mavenVersion, ',coverage') ]
def mavenParamFileName = "$WORKSPACE/.jenkins_maven_args"
if (fileExists(mavenParamFileName)) {
mavenParamsFromFile = readFile(file: mavenParamFileName).trim()
}
}
}
}
stage('Maven Info') {
steps {
sh "$mvn_cmd -V -B -ntp -C -N -P$profiles help:all-profiles"
}
}
stage('Start Payara') {
steps {
startPayara payara_config
script {
payara_build_options = "-DadminPort=$payara_config.admin_port -Dpayara.https.port=$payara_config.ssl_port"
if (payara_config.jacoco_started) {
profiles += optionalMavenProfiles mavenVersion, ',coverage-remote'
payara_build_options += " -DjacocoPort=$payara_config.jacoco_port"
} else {
profiles += optionalMavenProfiles mavenVersion, ',coverage'
}
}
}
}
stage('Maven Verify - Tests') {
steps {
withMaven(options: [ jacocoPublisher(disabled: true) ]) {
sh """
maven_interceptor_opts="$JAVA_TOOL_OPTIONS"
unset JAVA_TOOL_OPTIONS
$mvn_cmd -B -ntp -C verify -fae -P$profiles \$(eval echo \$MAVEN_ADD_OPTIONS) \$maven_interceptor_opts \
-Ddrone.chrome.binary="\$(eval echo \$CHROME_BINARY)" \
-Dmaven.test.failure.ignore=true -DtrimStackTrace=false \
-Dmaven.install.skip=true $payara_build_options $mavenParamsFromFile"""
}
}
}
}
post {
always {
stopPayara payara_config
archiveArtifacts artifacts: '**/logs/server.log*', allowEmptyArchive: true
checkLogs payara_config.asadmin ? '**/logs/server.log*' : null, true, qualityThreshold
}
}
}