2021-04-23 06:07:20 -04:00
@Library('hibernate-jenkins-pipeline-helpers@1.5') _
pipeline {
agent {
label 'LongDuration'
}
tools {
jdk 'OpenJDK 8 Latest'
}
2021-06-02 06:12:16 -04:00
parameters {
2021-11-17 06:41:19 -05:00
choice(name: 'IMAGE_JDK', choices: ['jdk11'], description: 'The JDK base image version to use for the TCK image.')
string(name: 'TCK_VERSION', defaultValue: '3.0.1', description: 'The version of the Jakarta JPA TCK i.e. `2.2.0` or `3.0.1`')
string(name: 'TCK_SHA', defaultValue: '0e77804ead3990a53cdc325d2b0ddc1b15a3993d7866e5aa3717cc55d95f8bbc', description: 'The SHA256 of the Jakarta JPA TCK that is distributed under https://download.eclipse.org/jakartaee/persistence/3.0/jakarta-persistence-tck-${TCK_VERSION}.zip.sha256')
2021-06-02 06:12:16 -04:00
booleanParam(name: 'NO_SLEEP', defaultValue: true, description: 'Whether the NO_SLEEP patch should be applied to speed up the TCK execution')
}
2021-04-23 06:07:20 -04:00
stages {
stage('Build') {
steps {
script {
docker.withRegistry('https://index.docker.io/v1/', 'hibernateci.hub.docker.com') {
2021-11-17 06:41:19 -05:00
docker.image('openjdk:11-jdk').pull()
2021-04-23 06:07:20 -04:00
}
}
dir('hibernate') {
checkout scm
sh """ \
./gradlew publishToMavenLocal
"""
script {
env.HIBERNATE_VERSION = sh (
script: "grep hibernateVersion gradle/version.properties|cut -d'=' -f2",
returnStdout: true
).trim()
}
}
dir('tck') {
checkout changelog: false, poll: false, scm: [$class: 'GitSCM', branches: [[name: '*/main']], extensions: [], userRemoteConfigs: [[url: 'https://github.com/hibernate/jakarta-tck-runner.git']]]
sh """ \
2021-06-04 07:32:23 -04:00
cd jpa-3.0; 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} .
2021-04-23 06:07:20 -04:00
"""
}
}
}
stage('Run TCK') {
steps {
sh """ \
2021-05-05 09:47:50 -04:00
docker rm -f tck || true
2021-06-02 06:12:16 -04:00
docker rm -f tck-vol || true
docker volume create tck-vol
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
docker cp tck:/tck/persistence-tck/tmp/ ./results
2021-04-23 06:07:20 -04:00
"""
2021-06-02 06:12:16 -04:00
archiveArtifacts artifacts: 'results/**'
2021-04-23 06:07:20 -04:00
script {
failures = sh (
script: """ \
2021-06-02 06:12:16 -04:00
set +x
2021-04-23 06:07:20 -04:00
while read line; do
2021-05-05 09:47:50 -04:00
if [[ "\$line" != *"Passed." ]]; then
echo "\$line"
2021-04-23 06:07:20 -04:00
fi
2021-06-02 06:12:16 -04:00
done <results/JTreport/text/summary.txt
2021-04-23 06:07:20 -04:00
""",
returnStdout: true
).trim()
if ( !failures.isEmpty() ) {
echo "Some TCK tests failed:"
echo failures
currentBuild.result = 'FAILURE'
}
}
}
}
}
post {
always {
// Space-separated
notifyBuildResult maintainers: 'christian.beikov@gmail.com'
}
}
}