forked from payara/Payara
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Jenkinsfile
253 lines (248 loc) · 10.6 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
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
#!groovy
// Jenkinsfile for building a PR and running a subset of tests against it
def pom
def DOMAIN_NAME
def payaraBuildNumber
pipeline {
agent any
tools {
jdk "zulu-8"
}
stages {
stage('Report') {
steps {
script {
pom = readMavenPom file: 'pom.xml'
payaraBuildNumber = "PR${env.ghprbPullId}#${currentBuild.number}"
DOMAIN_NAME = "test-domain"
echo "Payara pom version is ${pom.version}"
echo "Build number is ${payaraBuildNumber}"
echo "Domain name is ${DOMAIN_NAME}"
}
}
}
stage('Build') {
steps {
echo '*#*#*#*#*#*#*#*#*#*#*#*# Building SRC *#*#*#*#*#*#*#*#*#*#*#*#*#*#*#'
withCredentials([usernameColonPassword(credentialsId: 'JenkinsNexusUser', variable: 'NEXUS_USER')]) {
sh """mvn -B -V -ff -e clean install --strict-checksums -PQuickBuild \
-Djavax.net.ssl.trustStore=${env.JAVA_HOME}/jre/lib/security/cacerts \
-Djavax.xml.accessExternalSchema=all -Dbuild.number=${payaraBuildNumber}"""
}
echo '*#*#*#*#*#*#*#*#*#*#*#*# Built SRC *#*#*#*#*#*#*#*#*#*#*#*#*#*#*#'
}
post {
success{
archiveArtifacts artifacts: 'appserver/distributions/payara/target/payara.zip', fingerprint: true
archiveArtifacts artifacts: 'appserver/extras/payara-micro/payara-micro-distribution/target/payara-micro.jar', fingerprint: true
}
always {
archiveArtifacts allowEmptyArchive: true, artifacts: 'appserver/distributions/payara/target/stage/payara5/glassfish/logs/server.log'
}
}
}
stage('Setup for Quicklook Tests') {
steps {
setupDomain()
}
}
stage('Run Quicklook Tests') {
steps {
echo '*#*#*#*#*#*#*#*#*#*#*#*# Running test *#*#*#*#*#*#*#*#*#*#*#*#*#*#*#'
sh """mvn -B -V -ff -e clean test --strict-checksums -Pall \
-Dglassfish.home=\"${pwd()}/appserver/distributions/payara/target/stage/payara5/glassfish\" \
-Djavax.net.ssl.trustStore=${env.JAVA_HOME}/jre/lib/security/cacerts \
-Djavax.xml.accessExternalSchema=all \
-f appserver/tests/quicklook/pom.xml"""
echo '*#*#*#*#*#*#*#*#*#*#*#*# Ran test *#*#*#*#*#*#*#*#*#*#*#*#*#*#*#'
}
post {
always {
processReportAndStopDomain()
}
cleanup {
saveLogsAndCleanup 'quicklook-log.zip'
}
}
}
stage('Setup for Payara Samples Tests') {
steps {
setupDomain()
}
}
stage('Run Payara Samples Tests') {
steps {
echo '*#*#*#*#*#*#*#*#*#*#*#*# Running test *#*#*#*#*#*#*#*#*#*#*#*#*#*#*#'
sh """mvn -V -B -ff clean install --strict-checksums -Ppayara-server-remote \
-Dpayara.version=${pom.version} \
-Djavax.net.ssl.trustStore=${env.JAVA_HOME}/jre/lib/security/cacerts \
-Djavax.xml.accessExternalSchema=all \
-f appserver/tests/payara-samples """
echo '*#*#*#*#*#*#*#*#*#*#*#*# Ran test *#*#*#*#*#*#*#*#*#*#*#*#*#*#*#'
}
post {
always {
processReportAndStopDomain()
}
cleanup {
saveLogsAndCleanup 'samples-log.zip'
}
}
}
stage('Checkout MP TCK Runners') {
steps{
echo '*#*#*#*#*#*#*#*#*#*#*#*# Checking out MP TCK Runners *#*#*#*#*#*#*#*#*#*#*#*#*#*#*#'
checkout changelog: false, poll: false, scm: [$class: 'GitSCM',
branches: [[name: "*/microprofile-4.0"]],
userRemoteConfigs: [[url: "https://github.com/payara/MicroProfile-TCK-Runners.git"]]]
echo '*#*#*#*#*#*#*#*#*#*#*#*# Checked out MP TCK Runners *#*#*#*#*#*#*#*#*#*#*#*#*#*#*#'
}
}
stage('Setup for MP TCK Tests') {
steps {
setupDomain()
}
}
stage('Run MP TCK Tests') {
steps {
echo '*#*#*#*#*#*#*#*#*#*#*#*# Running test *#*#*#*#*#*#*#*#*#*#*#*#*#*#*#'
sh """mvn -B -V -ff -e clean verify --strict-checksums \
-Djavax.net.ssl.trustStore=${env.JAVA_HOME}/jre/lib/security/cacerts \
-Djavax.xml.accessExternalSchema=all -Dpayara.version=${pom.version} \
-Dpayara_domain=${DOMAIN_NAME} -Ppayara-server-remote"""
echo '*#*#*#*#*#*#*#*#*#*#*#*# Ran test *#*#*#*#*#*#*#*#*#*#*#*#*#*#*#'
}
post {
always {
processReportAndStopDomain()
}
cleanup {
saveLogsAndCleanup 'mp-tck-log.zip'
}
}
}
stage('Checkout EE8 Tests') {
steps{
echo '*#*#*#*#*#*#*#*#*#*#*#*# Checking out EE8 tests *#*#*#*#*#*#*#*#*#*#*#*#*#*#*#'
checkout changelog: false, poll: false, scm: [$class: 'GitSCM',
branches: [[name: "*/master"]],
userRemoteConfigs: [[url: "https://github.com/payara/patched-src-javaee8-samples.git"]]]
echo '*#*#*#*#*#*#*#*#*#*#*#*# Checked out EE8 tests *#*#*#*#*#*#*#*#*#*#*#*#*#*#*#'
}
}
stage('Setup for EE8 Tests') {
steps {
setupDomain()
}
}
stage('Run EE8 Tests') {
steps {
echo '*#*#*#*#*#*#*#*#*#*#*#*# Running test *#*#*#*#*#*#*#*#*#*#*#*#*#*#*#'
sh "mvn -B -V -ff -e clean install --strict-checksums -Dsurefire.useFile=false \
-Djavax.net.ssl.trustStore=${env.JAVA_HOME}/jre/lib/security/cacerts \
-Djavax.xml.accessExternalSchema=all -Dpayara.version=${pom.version} \
-Ppayara-server-remote,stable"
echo '*#*#*#*#*#*#*#*#*#*#*#*# Ran test *#*#*#*#*#*#*#*#*#*#*#*#*#*#*#'
}
post {
always {
processReportAndStopDomain()
}
cleanup {
saveLogsAndCleanup 'ee8-samples-log.zip'
}
}
}
stage('Checkout CargoTracker Tests') {
steps{
echo '*#*#*#*#*#*#*#*#*#*#*#*# Checking out cargoTracker tests *#*#*#*#*#*#*#*#*#*#*#*#*#*#*#'
checkout changelog: false, poll: false, scm: [$class: 'GitSCM',
branches: [[name: "*/master"]],
userRemoteConfigs: [[url: "https://github.com/payara/cargoTracker.git"]]]
echo '*#*#*#*#*#*#*#*#*#*#*#*# Checked out cargoTracker tests *#*#*#*#*#*#*#*#*#*#*#*#*#*#*#'
}
}
stage('Setup for CargoTracker Tests') {
steps {
setupDomain()
}
}
stage('Run CargoTracker Tests') {
steps {
echo '*#*#*#*#*#*#*#*#*#*#*#*# Cleaning CargoTracker Database in /tmp *#*#*#*#*#*#*#*#*#*#*#*#*#*#*#'
sh "rm -rf /tmp/cargo*"
echo '*#*#*#*#*#*#*#*#*#*#*#*# Running test *#*#*#*#*#*#*#*#*#*#*#*#*#*#*#'
sh """mvn -B -V -ff -e clean install --strict-checksums -Dsurefire.useFile=false \
-Djavax.net.ssl.trustStore=${env.JAVA_HOME}/jre/lib/security/cacerts \
-Djavax.xml.accessExternalSchema=all -Dpayara.version=${pom.version} \
-Ppayara-server-remote,payara5"""
echo '*#*#*#*#*#*#*#*#*#*#*#*# Ran test *#*#*#*#*#*#*#*#*#*#*#*#*#*#*#'
}
post {
always {
processReportAndStopDomain()
}
cleanup {
saveLogsAndCleanup 'cargotracker-log.zip'
}
}
}
stage('Checkout EE7 Tests') {
steps{
echo '*#*#*#*#*#*#*#*#*#*#*#*# Checking out EE7 tests *#*#*#*#*#*#*#*#*#*#*#*#*#*#*#'
checkout changelog: false, poll: false, scm: [$class: 'GitSCM',
branches: [[name: "*/master"]],
userRemoteConfigs: [[url: "https://github.com/payara/patched-src-javaee7-samples.git"]]]
echo '*#*#*#*#*#*#*#*#*#*#*#*# Checked out EE7 tests *#*#*#*#*#*#*#*#*#*#*#*#*#*#*#'
}
}
stage('Setup for EE7 Tests') {
steps {
setupDomain()
}
}
stage('Run EE7 Tests') {
steps {
echo '*#*#*#*#*#*#*#*#*#*#*#*# Running test *#*#*#*#*#*#*#*#*#*#*#*#*#*#*#'
sh """mvn -B -V -ff -e clean install --strict-checksums \
-Djavax.net.ssl.trustStore=${env.JAVA_HOME}/jre/lib/security/cacerts \
-Djavax.xml.accessExternalSchema=all -Dpayara.version=${pom.version} \
-Dpayara_domain=${DOMAIN_NAME} \
-Ppayara-server-remote,stable,payara5"""
echo '*#*#*#*#*#*#*#*#*#*#*#*# Ran test *#*#*#*#*#*#*#*#*#*#*#*#*#*#*#'
}
post {
always {
processReportAndStopDomain()
}
cleanup {
saveLogsAndCleanup 'ee7-samples-log.zip'
}
}
}
}
}
void makeDomain() {
script {
ASADMIN = "./appserver/distributions/payara/target/stage/payara5/bin/asadmin"
DOMAIN_NAME = "test-domain"
}
sh "${ASADMIN} create-domain --nopassword ${DOMAIN_NAME}"
}
void setupDomain() {
echo '*#*#*#*#*#*#*#*#*#*#*#*# Setting up tests *#*#*#*#*#*#*#*#*#*#*#*#*#*#*#'
makeDomain()
sh "${ASADMIN} start-domain ${DOMAIN_NAME}"
sh "${ASADMIN} start-database || true"
}
void processReportAndStopDomain() {
junit '**/target/surefire-reports/*.xml'
sh "${ASADMIN} stop-domain ${DOMAIN_NAME}"
sh "${ASADMIN} stop-database || true"
}
void saveLogsAndCleanup(String logArchiveName) {
zip archive: true, dir: "appserver/distributions/payara/target/stage/payara5/glassfish/domains/${DOMAIN_NAME}/logs", glob: 'server.*', zipFile: logArchiveName
echo 'tidying up after tests: '
sh "rm -f -v *.zip"
sh "${ASADMIN} delete-domain ${DOMAIN_NAME}"
}