forked from payara/Payara
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathJenkinsfile
177 lines (174 loc) · 8.01 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
#!groovy
// Jenkinsfile for building a PR and running a subset of tests against it
def pom
def DOMAIN_NAME
def payaraBuildNumber
pipeline {
agent any
options {
disableConcurrentBuilds()
}
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 *#*#*#*#*#*#*#*#*#*#*#*#*#*#*#'
sh """mvn -B -V -ff -e clean install -PQuickBuild \
-Djavax.net.ssl.trustStore=${env.JAVA_HOME}/jre/lib/security/cacerts \
-Djavax.xml.accessExternalSchema=all -Dbuild.number=${payaraBuildNumber} \
-Dsurefire.rerunFailingTestsCount=2"""
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
}
}
}
stage('Setup for Quicklook Tests') {
steps {
sh "rm *.zip"
setupDomain()
}
}
stage('Run Quicklook Tests') {
steps {
echo '*#*#*#*#*#*#*#*#*#*#*#*# Running test *#*#*#*#*#*#*#*#*#*#*#*#*#*#*#'
sh """mvn -B -V -ff -e clean test -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 \
-Dsurefire.rerunFailingTestsCount=2 \
-f appserver/tests/quicklook/pom.xml"""
echo '*#*#*#*#*#*#*#*#*#*#*#*# Ran test *#*#*#*#*#*#*#*#*#*#*#*#*#*#*#'
}
post {
always {
zip archive: true, dir: "appserver/distributions/payara/target/stage/payara5/glassfish/domains/${DOMAIN_NAME}/logs", glob: 'server.*', zipFile: 'quicklook-log.zip'
teardownDomain()
junit '**/target/surefire-reports/*.xml'
}
}
}
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 -Dsurefire.useFile=false \
-Djavax.net.ssl.trustStore=${env.JAVA_HOME}/jre/lib/security/cacerts \
-Djavax.xml.accessExternalSchema=all -Dpayara.version=${pom.version} \
-Dsurefire.rerunFailingTestsCount=2 -Ppayara-server-remote"
echo '*#*#*#*#*#*#*#*#*#*#*#*# Ran test *#*#*#*#*#*#*#*#*#*#*#*#*#*#*#'
}
post {
always {
zip archive: true, dir: "appserver/distributions/payara/target/stage/payara5/glassfish/domains/${DOMAIN_NAME}/logs", glob: 'server.*', zipFile: 'ee8-samples-log.zip'
teardownDomain()
junit '**/target/surefire-reports/*.xml'
}
}
}
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('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 -Dsurefire.useFile=false \
-Djavax.net.ssl.trustStore=${env.JAVA_HOME}/jre/lib/security/cacerts \
-Djavax.xml.accessExternalSchema=all -Dpayara.version=${pom.version} \
-Dsurefire.rerunFailingTestsCount=2 -Ppayara-server-managed,payara5"""
echo '*#*#*#*#*#*#*#*#*#*#*#*# Ran test *#*#*#*#*#*#*#*#*#*#*#*#*#*#*#'
}
post {
always {
junit '**/target/surefire-reports/*.xml'
}
}
}
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 -Dsurefire.useFile=false \
-Djavax.net.ssl.trustStore=${env.JAVA_HOME}/jre/lib/security/cacerts \
-Djavax.xml.accessExternalSchema=all -Dpayara.version=${pom.version} \
-Dpayara_domain=${DOMAIN_NAME} -Duse.cnHost=true \
-Dsurefire.rerunFailingTestsCount=2 -Ppayara-server-remote,stable,payara5"""
echo '*#*#*#*#*#*#*#*#*#*#*#*# Ran test *#*#*#*#*#*#*#*#*#*#*#*#*#*#*#'
}
post {
always {
zip archive: true, dir: "appserver/distributions/payara/target/stage/payara5/glassfish/domains/${DOMAIN_NAME}/logs", glob: 'server.*', zipFile: 'ee7-samples-log.zip'
teardownDomain()
junit '**/target/surefire-reports/*.xml'
}
}
}
}
}
void setupDomain() {
echo '*#*#*#*#*#*#*#*#*#*#*#*# Setting up tests *#*#*#*#*#*#*#*#*#*#*#*#*#*#*#'
script{
ASADMIN = "./appserver/distributions/payara/target/stage/payara5/bin/asadmin"
DOMAIN_NAME = "test-domain"
}
sh "${ASADMIN} create-domain --nopassword ${DOMAIN_NAME}"
sh "${ASADMIN} start-domain ${DOMAIN_NAME}"
sh "${ASADMIN} start-database --dbtype derby || true"
}
void teardownDomain() {
echo 'tidying up after tests:'
sh "${ASADMIN} stop-domain ${DOMAIN_NAME}"
sh "${ASADMIN} stop-database --dbtype derby || true"
sh "${ASADMIN} delete-domain ${DOMAIN_NAME}"
}