Skip to content

Commit 0e0f743

Browse files
yrodierebeikov
authored andcommitted
Move Jenkins "input" steps outside of nodes/agents
So that we don't keep a node reserved while we're waiting for input. See best practice 6 in https://www.cloudbees.com/blog/top-10-best-practices-jenkins-pipeline-plugin
1 parent 7b8b395 commit 0e0f743

File tree

2 files changed

+81
-65
lines changed

2 files changed

+81
-65
lines changed

ci/jpa-3.1-tck.Jenkinsfile

Lines changed: 72 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,7 @@ if ( !env.CHANGE_ID ) {
1414
}
1515

1616
pipeline {
17-
agent {
18-
label 'LongDuration'
19-
}
17+
agent none
2018
tools {
2119
jdk 'OpenJDK 11 Latest'
2220
}
@@ -32,67 +30,79 @@ pipeline {
3230
booleanParam(name: 'NO_SLEEP', defaultValue: true, description: 'Whether the NO_SLEEP patch should be applied to speed up the TCK execution')
3331
}
3432
stages {
35-
stage('Build') {
33+
stage('Checks') {
3634
steps {
3735
requireApprovalForPullRequest 'hibernate'
38-
script {
39-
docker.withRegistry('https://index.docker.io/v1/', 'hibernateci.hub.docker.com') {
40-
docker.image('openjdk:11-jdk').pull()
41-
}
42-
}
43-
dir('hibernate') {
44-
checkout scm
45-
sh './gradlew publishToMavenLocal -PmavenMirror=nexus-load-balancer-c4cf05fd92f43ef8.elb.us-east-1.amazonaws.com -DjakartaJpaVersion=3.1.0'
46-
script {
47-
env.HIBERNATE_VERSION = sh (
48-
script: "grep hibernateVersion gradle/version.properties|cut -d'=' -f2",
49-
returnStdout: true
50-
).trim()
51-
}
52-
}
53-
dir('tck') {
54-
checkout changelog: false, poll: false, scm: [$class: 'GitSCM', branches: [[name: '*/main']], extensions: [], userRemoteConfigs: [[url: 'https://github.com/hibernate/jakarta-tck-runner.git']]]
55-
script {
56-
if ( params.TCK_URL == null || params.TCK_URL.isEmpty() ) {
57-
sh "cd jpa-3.1; 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} ."
58-
}
59-
else {
60-
sh "cd jpa-3.1; 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} ."
61-
}
62-
}
63-
}
64-
}
65-
}
66-
stage('Run TCK') {
67-
steps {
68-
sh """ \
69-
rm -Rf ./results
70-
docker rm -f tck || true
71-
docker volume rm -f tck-vol || true
72-
docker volume create tck-vol
73-
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
74-
docker cp tck:/tck/persistence-tck/tmp/ ./results
75-
"""
76-
archiveArtifacts artifacts: 'results/**'
77-
script {
78-
failures = sh (
79-
script: """ \
80-
set +x
81-
while read line; do
82-
if [[ "\$line" != *"Passed." ]]; then
83-
echo "\$line"
84-
fi
85-
done <results/JTreport/text/summary.txt
86-
""",
87-
returnStdout: true
88-
).trim()
89-
if ( !failures.isEmpty() ) {
90-
echo "Some TCK tests failed:"
91-
echo failures
92-
currentBuild.result = 'FAILURE'
93-
}
94-
}
95-
}
36+
}
37+
}
38+
stage('TCK') {
39+
agent {
40+
label 'LongDuration'
41+
}
42+
stages {
43+
stage('Build') {
44+
steps {
45+
requireApprovalForPullRequest 'hibernate'
46+
script {
47+
docker.withRegistry('https://index.docker.io/v1/', 'hibernateci.hub.docker.com') {
48+
docker.image('openjdk:11-jdk').pull()
49+
}
50+
}
51+
dir('hibernate') {
52+
checkout scm
53+
sh './gradlew publishToMavenLocal -PmavenMirror=nexus-load-balancer-c4cf05fd92f43ef8.elb.us-east-1.amazonaws.com -DjakartaJpaVersion=3.1.0'
54+
script {
55+
env.HIBERNATE_VERSION = sh (
56+
script: "grep hibernateVersion gradle/version.properties|cut -d'=' -f2",
57+
returnStdout: true
58+
).trim()
59+
}
60+
}
61+
dir('tck') {
62+
checkout changelog: false, poll: false, scm: [$class: 'GitSCM', branches: [[name: '*/main']], extensions: [], userRemoteConfigs: [[url: 'https://github.com/hibernate/jakarta-tck-runner.git']]]
63+
script {
64+
if ( params.TCK_URL == null || params.TCK_URL.isEmpty() ) {
65+
sh "cd jpa-3.1; 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} ."
66+
}
67+
else {
68+
sh "cd jpa-3.1; 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} ."
69+
}
70+
}
71+
}
72+
}
73+
}
74+
stage('Run TCK') {
75+
steps {
76+
sh """ \
77+
rm -Rf ./results
78+
docker rm -f tck || true
79+
docker volume rm -f tck-vol || true
80+
docker volume create tck-vol
81+
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
82+
docker cp tck:/tck/persistence-tck/tmp/ ./results
83+
"""
84+
archiveArtifacts artifacts: 'results/**'
85+
script {
86+
failures = sh (
87+
script: """ \
88+
set +x
89+
while read line; do
90+
if [[ "\$line" != *"Passed." ]]; then
91+
echo "\$line"
92+
fi
93+
done <results/JTreport/text/summary.txt
94+
""",
95+
returnStdout: true
96+
).trim()
97+
if ( !failures.isEmpty() ) {
98+
echo "Some TCK tests failed:"
99+
echo failures
100+
currentBuild.result = 'FAILURE'
101+
}
102+
}
103+
}
104+
}
105+
}
96106
}
97107
}
98108
post {

ci/quarkus.Jenkinsfile

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,7 @@ if ( !env.CHANGE_ID ) {
1414
}
1515

1616
pipeline {
17-
agent {
18-
label 'LongDuration'
19-
}
17+
agent none
2018
tools {
2119
jdk 'OpenJDK 17 Latest'
2220
}
@@ -26,7 +24,15 @@ pipeline {
2624
skipDefaultCheckout()
2725
}
2826
stages {
27+
stage('Checks') {
28+
steps {
29+
requireApprovalForPullRequest 'hibernate'
30+
}
31+
}
2932
stage('Build') {
33+
agent {
34+
label 'LongDuration'
35+
}
3036
steps {
3137
requireApprovalForPullRequest 'hibernate'
3238
script {

0 commit comments

Comments
 (0)