-
Notifications
You must be signed in to change notification settings - Fork 162
/
pr_verify.groovy
245 lines (242 loc) · 9.98 KB
/
pr_verify.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
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
// Copyright (c) 2021, 2022 Oracle and/or its affiliates. All rights reserved.
//
// This program and the accompanying materials are made available under the
// terms of the Eclipse Public License v. 2.0 which is available at
// http://www.eclipse.org/legal/epl-2.0,
// or the Eclipse Distribution License v. 1.0 which is available at
// http://www.eclipse.org/org/documents/edl-v10.php.
//
// SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause
//
pipeline {
agent {
kubernetes {
label 'el-master-agent-pod'
yaml """
apiVersion: v1
kind: Pod
spec:
volumes:
- name: tools
persistentVolumeClaim:
claimName: tools-claim-jiro-eclipselink
- name: volume-known-hosts
configMap:
name: known-hosts
- name: settings-xml
secret:
secretName: m2-secret-dir
items:
- key: settings.xml
path: settings.xml
- name: toolchains-xml
configMap:
name: m2-dir
items:
- key: toolchains.xml
path: toolchains.xml
- name: settings-security-xml
secret:
secretName: m2-secret-dir
items:
- key: settings-security.xml
path: settings-security.xml
- name: m2-repo
emptyDir: {}
containers:
- name: jnlp
resources:
limits:
memory: "4Gi"
cpu: "2"
requests:
memory: "4Gi"
cpu: "1"
- name: el-build
resources:
limits:
memory: "6Gi"
cpu: "3"
requests:
memory: "6Gi"
cpu: "3"
image: tkraus/el-build:2.0.1
volumeMounts:
- name: tools
mountPath: /opt/tools
- name: volume-known-hosts
mountPath: /home/jenkins/.ssh
- name: settings-xml
mountPath: /home/jenkins/.m2/settings.xml
subPath: settings.xml
readOnly: true
- name: toolchains-xml
mountPath: /home/jenkins/.m2/toolchains.xml
subPath: toolchains.xml
readOnly: true
- name: settings-security-xml
mountPath: /home/jenkins/.m2/settings-security.xml
subPath: settings-security.xml
readOnly: true
- name: m2-repo
mountPath: /home/jenkins/.m2/repository
tty: true
command:
- cat
"""
}
}
environment {
ANT_HOME="${env.HOME}/apache-ant-1.10.7"
}
tools {
maven 'apache-maven-latest'
jdk 'adoptopenjdk-hotspot-jdk11-latest'
}
stages {
// Initialize build environment
stage('Init') {
steps {
container('el-build') {
sh """
/opt/bin/mysql-start.sh
mkdir $HOME/extension.lib.external
wget -nc https://repo1.maven.org/maven2/junit/junit/4.12/junit-4.12.jar -O $HOME/extension.lib.external/junit-4.12.jar
wget -nc https://repo1.maven.org/maven2/org/hamcrest/hamcrest-core/1.3/hamcrest-core-1.3.jar -O $HOME/extension.lib.external/hamcrest-core-1.3.jar
wget -nc https://repo1.maven.org/maven2/org/jmockit/jmockit/1.35/jmockit-1.35.jar -O $HOME/extension.lib.external/jmockit-1.35.jar
wget -nc https://repo1.maven.org/maven2/org/jboss/logging/jboss-logging/3.4.1.Final/jboss-logging-3.4.1.Final.jar -O $HOME/extension.lib.external/jboss-logging-3.4.1.Final.jar
wget -nc https://repo1.maven.org/maven2/org/glassfish/javax.el/3.0.1-b08/javax.el-3.0.1-b08.jar -O $HOME/extension.lib.external/javax.el-3.0.1-b08.jar
wget -nc https://repo1.maven.org/maven2/com/fasterxml/classmate/1.5.1/classmate-1.5.1.jar -O $HOME/extension.lib.external/classmate-1.5.1.jar
wget -nc https://archive.apache.org/dist/ant/binaries/apache-ant-1.10.7-bin.tar.gz -O $HOME/extension.lib.external/apache-ant-1.10.7-bin.tar.gz
wget -nc https://download.eclipse.org/eclipse/downloads/drops4/R-4.10-201812060815/eclipse-SDK-4.10-linux-gtk-x86_64.tar.gz -O $HOME/extension.lib.external/eclipse-SDK-4.10-linux-gtk-x86_64.tar.gz
wget -nc https://repo1.maven.org/maven2/mysql/mysql-connector-java/8.0.28/mysql-connector-java-8.0.28.jar -O $HOME/extension.lib.external/mysql-connector-java.jar
tar -x -z -C $HOME -f $HOME/extension.lib.external/apache-ant-1.10.7-bin.tar.gz
tar -x -z -C $HOME/extension.lib.external -f $HOME/extension.lib.external/eclipse-SDK-4.10-linux-gtk-x86_64.tar.gz
"""
withCredentials([file(credentialsId: 'secret-subkeys.asc', variable: 'KEYRING')]) {
sh label: '', script: '''
gpg --batch --import "${KEYRING}"
for fpr in $(gpg --list-keys --with-colons | awk -F: \'/fpr:/ {print $10}\' | sort -u);
do
echo -e "5\\ny\\n" | gpg --batch --command-fd 0 --expert --edit-key $fpr trust;
done'''
}
sh """
echo "extensions.depend.dir=$HOME/extension.lib.external" >> $HOME/build.properties
echo "junit.lib=$HOME/extension.lib.external/junit-4.12.jar:$HOME/extension.lib.external/hamcrest-core-1.3.jar" >> $HOME/build.properties
echo "jdbc.driver.jar=$HOME/extension.lib.external/mysql-connector-java.jar" >> $HOME/build.properties
echo 'db.driver=com.mysql.cj.jdbc.Driver' >> $HOME/build.properties
echo 'db.url=jdbc:mysql://localhost/ecltests?allowPublicKeyRetrieval=true' >> $HOME/build.properties
echo 'db.user=root' >> $HOME/build.properties
echo 'db.pwd=root' >> $HOME/build.properties
echo 'db.platform=org.eclipse.persistence.platform.database.MySQLPlatform' >> $HOME/build.properties
echo "eclipse.install.dir=$HOME/extension.lib.external/eclipse" >> $HOME/build.properties
"""
}
}
}
// Build
stage('Build') {
steps {
container('el-build') {
sh """
echo '-[ EclipseLink Build ]-----------------------------------------------------------'
$ANT_HOME/bin/ant -f antbuild.xml build
"""
}
}
}
// LRG tests
stage('Run Tests') {
parallel {
stage('Core LRG') {
steps {
container('el-build') {
sh """
echo '-[ EclipseLink Core LRG ]-----------------------------------------------------------'
$ANT_HOME/bin/ant -f antbuild.xml -Dtest.fail.fast=true -Dfail.on.error=true test-core
"""
}
}
}
stage('MOXy LRG') {
steps {
container('el-build') {
sh """
$ANT_HOME/bin/ant -f antbuild.xml -Dtest.fail.fast=true -Dfail.on.error=true test-moxy
"""
}
}
}
}
}
//Not in parallel
stage('JPA LRG') {
steps {
container('el-build') {
sh """
$ANT_HOME/bin/ant -f antbuild.xml -Dtest.fail.fast=true -Dfail.on.error=true test-jpa22
"""
}
}
}
stage('SDO LRG') {
steps {
container('el-build') {
sh """
$ANT_HOME/bin/ant -f antbuild.xml -Dtest.fail.fast=true -Dfail.on.error=true test-sdo
"""
}
}
}
stage('JPA Modelgen, JPA JSE, WDF, JPARS, DBWS, DBWS Builder') {
steps {
container('el-build') {
sh """
$ANT_HOME/bin/ant -f antbuild.xml -Dtest.fail.fast=true -Dfail.on.error=true test-jpa-jse test-ext test-jpql test-wdf test-jpars test-dbws test-dbws-builder test-osgi
"""
}
}
}
stage('Distribution') {
steps {
container('el-build') {
sh """
$ANT_HOME/bin/ant -f antbuild.xml -Dtest.fail.fast=true -Dfail.on.error=true build-distribution
"""
}
}
}
}
post {
always {
container('el-build') {
sh """
/opt/bin/mysql-stop.sh
"""
}
script {
//Multiple Jenkins junit plugin calls due java.nio.channels.ClosedChannelException in new/cloud Eclipse.org build infrastructure if it's called once
//Retry is there to try (in case of crash) junit test upload again.
retryCount = 5
junitReportFiles = [
'dbws/**/reports/**/TESTS-TestSuites.xml',
'foundation/**/reports/**/TESTS-TestSuites.xml',
'jpa/**/reports/**/TESTS-TestSuites.xml',
'moxy/**/reports/installer/TESTS-TestSuites.xml',
'moxy/**/reports/jaxb/TESTS-TestSuites.xml',
'moxy/**/reports/oxm/TESTS-TestSuites.xml',
'moxy/**/reports/srg/TESTS-TestSuites.xml',
'sdo/**/reports/**/TESTS-TestSuites.xml',
'utils/**/reports/**/TESTS-TestSuites.xml'
]
for (item in junitReportFiles) {
echo 'Processing file: ' + item
retry(retryCount) {
junit allowEmptyResults: true, testResults: item
}
}
}
}
}
}