Skip to content

Commit a37e503

Browse files
beikovsebersole
authored andcommitted
HHH-17982 Setup JPA 3.2 TCK testing automation for ORM 7
1 parent 5ebb51d commit a37e503

File tree

1 file changed

+78
-14
lines changed

1 file changed

+78
-14
lines changed

ci/jpa-3.2-tck.Jenkinsfile

Lines changed: 78 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,11 @@ pipeline {
3232
disableConcurrentBuilds(abortPrevious: true)
3333
}
3434
parameters {
35-
choice(name: 'IMAGE_JDK', choices: ['jdk17'], description: 'The JDK base image version to use for the TCK image.')
35+
choice(name: 'IMAGE_JDK', choices: ['jdk17', 'jdk21'], description: 'The JDK base image version to use for the TCK image.')
3636
string(name: 'TCK_VERSION', defaultValue: '3.2.0', description: 'The version of the Jakarta JPA TCK i.e. `2.2.0` or `3.0.1`')
3737
string(name: 'TCK_SHA', defaultValue: '', description: 'The SHA256 of the Jakarta JPA TCK that is distributed under https://download.eclipse.org/jakartaee/persistence/3.1/jakarta-persistence-tck-${TCK_VERSION}.zip.sha256')
3838
string(name: 'TCK_URL', defaultValue: 'https://www.eclipse.org/downloads/download.php?file=/ee4j/jakartaee-tck/jakartaee11/staged/eftl/jakarta-persistence-tck-3.2.0.zip&mirror_id=1', description: 'The URL from which to download the TCK ZIP file. Only needed for testing staged builds. Ensure the TCK_VERSION variable matches the ZIP file name suffix.')
39-
booleanParam(name: 'NO_SLEEP', defaultValue: true, description: 'Whether the NO_SLEEP patch should be applied to speed up the TCK execution')
39+
choice(name: 'RDBMS', choices: ['derby','mysql','mssql','oracle','postgresql','db2','sybase'], description: 'The JDK base image version to use for the TCK image.')
4040
}
4141
stages {
4242
stage('Build') {
@@ -59,36 +59,90 @@ pipeline {
5959
dir('tck') {
6060
checkout changelog: false, poll: false, scm: [$class: 'GitSCM', branches: [[name: '*/main']], extensions: [], userRemoteConfigs: [[url: 'https://github.com/hibernate/jakarta-tck-runner.git']]]
6161
script {
62-
if ( params.TCK_URL == null || params.TCK_URL.isEmpty() ) {
63-
sh "cd jpa-3.2; docker build -f Dockerfile.${params.IMAGE_JDK} -t jakarta-tck-runner --build-arg TCK_VERSION=${params.TCK_VERSION} --build-arg TCK_SHA=${params.TCK_SHA} ."
62+
switch (params.RDBMS) {
63+
case "mysql":
64+
docker.withRegistry('https://index.docker.io/v1/', 'hibernateci.hub.docker.com') {
65+
docker.image('mysql:8.2.0').pull()
66+
}
67+
sh "./docker_db.sh mysql"
68+
break;
69+
case "mssql":
70+
docker.image('mcr.microsoft.com/mssql/server@sha256:5439be9edc3b514cf647bcd3651779fa13f487735a985f40cbdcfecc60fea273').pull()
71+
sh "./docker_db.sh mssql"
72+
break;
73+
case "oracle":
74+
docker.withRegistry('https://index.docker.io/v1/', 'hibernateci.hub.docker.com') {
75+
docker.image('gvenzl/oracle-free:23').pull()
76+
}
77+
sh "./docker_db.sh oracle"
78+
break;
79+
case "postgresql":
80+
docker.withRegistry('https://index.docker.io/v1/', 'hibernateci.hub.docker.com') {
81+
docker.image('postgis/postgis:16-3.4').pull()
82+
}
83+
sh "./docker_db.sh postgresql"
84+
break;
85+
case "db2":
86+
docker.image('icr.io/db2_community/db2:11.5.9.0').pull()
87+
sh "./docker_db.sh db2"
88+
break;
89+
case "sybase":
90+
docker.withRegistry('https://index.docker.io/v1/', 'hibernateci.hub.docker.com') {
91+
docker.image('nguoianphu/docker-sybase').pull()
92+
}
93+
sh "./docker_db.sh sybase"
94+
break;
6495
}
65-
else {
66-
sh "cd jpa-3.2; docker build -f Dockerfile.${params.IMAGE_JDK} -t jakarta-tck-runner --build-arg TCK_VERSION=${params.TCK_VERSION} --build-arg TCK_SHA=${params.TCK_SHA} --build-arg TCK_URL=${params.TCK_URL} ."
96+
withCredentials([file(credentialsId: 'sybase-jconnect-driver', variable: 'jconnect_driver')]) {
97+
sh 'cp -f $jconnect_driver ./jpa-3.2/jconn42.jar'
98+
if ( params.TCK_URL == null || params.TCK_URL.isEmpty() ) {
99+
sh "cd jpa-3.2; docker build -f Dockerfile.${params.IMAGE_JDK} -t jakarta-tck-runner --build-arg TCK_VERSION=${params.TCK_VERSION} --build-arg TCK_SHA=${params.TCK_SHA} ."
100+
}
101+
else {
102+
sh "cd jpa-3.2; docker build -f Dockerfile.${params.IMAGE_JDK} -t jakarta-tck-runner --build-arg TCK_VERSION=${params.TCK_VERSION} --build-arg TCK_SHA=${params.TCK_SHA} --build-arg TCK_URL=${params.TCK_URL} ."
103+
}
67104
}
68105
}
69106
}
70107
}
71108
}
72109
stage('Run TCK') {
73110
steps {
111+
def containerName;
112+
if ( params.RDBMS == 'postgresql' ) {
113+
containerName = 'postgres'
114+
}
115+
else {
116+
containerName = params.RDBMS
117+
}
74118
sh """ \
75119
rm -Rf ./results
76120
docker rm -f tck || true
77-
docker volume rm -f tck-vol || true
78-
docker volume create tck-vol
79-
docker run -v ~/.m2/repository/org/hibernate:/root/.m2/repository/org/hibernate:z -v tck-vol:/tck/persistence-tck/tmp/:z -e NO_SLEEP=${params.NO_SLEEP} -e HIBERNATE_VERSION=$HIBERNATE_VERSION --name tck jakarta-tck-runner
80-
docker cp tck:/tck/persistence-tck/tmp/ ./results
121+
while IFS= read -r container; do
122+
docker network disconnect tck-net \$container || true
123+
done <<< $(docker network inspect tck-net --format '{{range $k, $v := .Containers}}{{print $k}}{{end}}')
124+
docker network rm -f tck-net
125+
docker network create tck-net
126+
docker network connect tck-net $containerName
127+
docker run -v ~/.m2/repository/org/hibernate:/root/.m2/repository/org/hibernate:z --network=tck-net -e DB_HOST=${containerName} -e RDBMS=${params.RDBMS} -e HIBERNATE_VERSION=$HIBERNATE_VERSION --name tck jakarta-tck-runner
128+
docker cp tck:/tck/persistence-tck/bin/target/failsafe-reports ./results
129+
docker cp tck:/tck/persistence-tck/bin/target/test-reports ./results
81130
"""
82131
archiveArtifacts artifacts: 'results/**'
83132
script {
84133
failures = sh (
85134
script: """ \
86-
set +x
87135
while read line; do
88-
if [[ "\$line" != *"Passed." ]]; then
89-
echo "\$line"
136+
if [[ "\$line" = *"-error\" style=\"display:none;\">" ]]; then
137+
prefix1='<tr class="a" id="'
138+
prefix2='<tr class="b" id="'
139+
suffix='-error" style="display:none;">'
140+
line=\${line#"\$prefix1"}
141+
line=\${line#"\$prefix2"}
142+
test=\${line%"\$suffix"}
143+
echo "\$test"
90144
fi
91-
done <results/JTreport/text/summary.txt
145+
done <results/test-reports/failsafe-report.html
92146
""",
93147
returnStdout: true
94148
).trim()
@@ -103,6 +157,16 @@ pipeline {
103157
}
104158
post {
105159
always {
160+
script {
161+
def containerName;
162+
if ( params.RDBMS == 'postgresql' ) {
163+
containerName = 'postgres'
164+
}
165+
else {
166+
containerName = params.RDBMS
167+
}
168+
sh "docker rm -f ${containerName}"
169+
}
106170
configFileProvider([configFile(fileId: 'job-configuration.yaml', variable: 'JOB_CONFIGURATION_FILE')]) {
107171
notifyBuildResult maintainers: (String) readYaml(file: env.JOB_CONFIGURATION_FILE).notification?.email?.recipients
108172
}

0 commit comments

Comments
 (0)