Skip to content

Commit cea094e

Browse files
s390x weekly job
1 parent 359d953 commit cea094e

File tree

1 file changed

+133
-113
lines changed

1 file changed

+133
-113
lines changed

Jenkinsfile

Lines changed: 133 additions & 113 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,11 @@
2121

2222
pipeline {
2323

24-
agent {
25-
label {
26-
label params.nodeLabel
27-
}
24+
agent none
25+
26+
triggers {
27+
// Run s390x builds every Sunday at midnight
28+
cron('H 0 * * 0')
2829
}
2930

3031
tools {
@@ -51,135 +52,154 @@ pipeline {
5152
}
5253

5354
stages {
54-
stage('Initialization') {
55+
stage('Node selection') {
5556
steps {
56-
echo "running on ${env.NODE_NAME}"
57-
echo 'Building branch ' + env.BRANCH_NAME
58-
echo 'Using PATH ' + env.PATH
59-
}
60-
}
61-
62-
stage('Cleanup') {
63-
steps {
64-
echo 'Cleaning up the workspace'
65-
deleteDir()
66-
}
67-
}
57+
script {
58+
// Detect if triggered by cron
59+
def causes = currentBuild.getBuildCauses()
60+
def triggeredByCron = causes.any { it._class == 'hudson.triggers.TimerTrigger$TimerTriggerCause' }
6861

69-
stage('Checkout') {
70-
steps {
71-
echo 'Checking out branch ' + env.BRANCH_NAME
72-
checkout scm
62+
if (triggeredByCron) {
63+
// Allow s390x builds only when triggered by the Sunday cron
64+
targetNode = 's390x'
65+
} else {
66+
targetNode = params.nodeLabel
67+
}
68+
}
7369
}
7470
}
71+
stage('Main Workflow') {
72+
agent { label "${targetNode}" }
73+
stages{
74+
stage('Initialization') {
75+
steps {
76+
echo "running on ${env.NODE_NAME}"
77+
echo 'Building branch ' + env.BRANCH_NAME
78+
echo 'Using PATH ' + env.PATH
79+
}
80+
}
7581

76-
stage('Build JDK 24') {
77-
tools {
78-
jdk "jdk_24_latest"
79-
}
80-
steps {
81-
echo 'Building JDK 24'
82-
sh 'java -version'
83-
sh 'mvn -version'
84-
sh 'mvn -U -B -e clean install -DskipTests'
85-
}
86-
}
82+
stage('Cleanup') {
83+
steps {
84+
echo 'Cleaning up the workspace'
85+
deleteDir()
86+
}
87+
}
8788

88-
stage('Build JDK 21') {
89-
tools {
90-
jdk "jdk_21_latest"
91-
}
92-
steps {
93-
echo 'Building JDK 21'
94-
sh 'java -version'
95-
sh 'mvn -version'
96-
sh 'mvn -U -B -e clean install -DskipTests'
97-
}
98-
}
89+
stage('Checkout') {
90+
steps {
91+
echo 'Checking out branch ' + env.BRANCH_NAME
92+
checkout scm
93+
}
94+
}
9995

100-
stage('Build JDK 17') {
101-
tools {
102-
jdk "jdk_17_latest"
103-
}
104-
steps {
105-
echo 'Building JDK 17'
106-
sh 'java -version'
107-
sh 'mvn -version'
108-
sh 'mvn -U -B -e clean install -DskipTests'
109-
}
110-
}
96+
stage('Build JDK 24') {
97+
tools {
98+
jdk "jdk_24_latest"
99+
}
100+
steps {
101+
echo 'Building JDK 24'
102+
sh 'java -version'
103+
sh 'mvn -version'
104+
sh 'mvn -U -B -e clean install -DskipTests'
105+
}
106+
}
111107

112-
stage('Verify') {
113-
tools {
114-
jdk params.jdkVersion
115-
}
116-
steps {
117-
echo 'Running apache-rat:check'
118-
sh 'java -version'
119-
sh 'mvn -version'
120-
sh 'mvn apache-rat:check'
121-
}
122-
}
108+
stage('Build JDK 21') {
109+
tools {
110+
jdk "jdk_21_latest"
111+
}
112+
steps {
113+
echo 'Building JDK 21'
114+
sh 'java -version'
115+
sh 'mvn -version'
116+
sh 'mvn -U -B -e clean install -DskipTests'
117+
}
118+
}
123119

124-
stage('Tests') {
125-
tools {
126-
jdk params.jdkVersion
127-
}
128-
when { expression { return params.testsEnabled } }
129-
steps {
130-
sh 'java -version'
131-
sh 'mvn -version'
120+
stage('Build JDK 17') {
121+
tools {
122+
jdk "jdk_17_latest"
123+
}
124+
steps {
125+
echo 'Building JDK 17'
126+
sh 'java -version'
127+
sh 'mvn -version'
128+
sh 'mvn -U -B -e clean install -DskipTests'
129+
}
130+
}
132131

133-
// all tests is very very long (10 hours on Apache Jenkins)
134-
// sh 'mvn -B -e test -pl activemq-unit-tests -Dactivemq.tests=all'
135-
script {
136-
if (params.parallelTestsEnabled == 'true') {
137-
sh 'echo "Running parallel-tests ..."'
138-
sh 'mvn -B -e -fae -Pparallel-tests test -Dsurefire.rerunFailingTestsCount=3'
139-
} else {
140-
sh 'echo "Running tests ..."'
141-
sh 'mvn -B -e -fae test -Dsurefire.rerunFailingTestsCount=3'
132+
stage('Verify') {
133+
tools {
134+
jdk params.jdkVersion
135+
}
136+
steps {
137+
echo 'Running apache-rat:check'
138+
sh 'java -version'
139+
sh 'mvn -version'
140+
sh 'mvn apache-rat:check'
142141
}
143142
}
144-
}
145-
post {
146-
always {
147-
junit(testResults: '**/surefire-reports/*.xml', allowEmptyResults: true)
148-
junit(testResults: '**/failsafe-reports/*.xml', allowEmptyResults: true)
143+
144+
stage('Tests') {
145+
tools {
146+
jdk params.jdkVersion
147+
}
148+
when { expression { return params.testsEnabled } }
149+
steps {
150+
sh 'java -version'
151+
sh 'mvn -version'
152+
153+
// all tests is very very long (10 hours on Apache Jenkins)
154+
// sh 'mvn -B -e test -pl activemq-unit-tests -Dactivemq.tests=all'
155+
script {
156+
if (params.parallelTestsEnabled == 'true') {
157+
sh 'echo "Running parallel-tests ..."'
158+
sh 'mvn -B -e -fae -Pparallel-tests test -Dsurefire.rerunFailingTestsCount=3'
159+
} else {
160+
sh 'echo "Running tests ..."'
161+
sh 'mvn -B -e -fae test -Dsurefire.rerunFailingTestsCount=3'
162+
}
163+
}
164+
}
165+
post {
166+
always {
167+
junit(testResults: '**/surefire-reports/*.xml', allowEmptyResults: true)
168+
junit(testResults: '**/failsafe-reports/*.xml', allowEmptyResults: true)
169+
}
170+
}
149171
}
150-
}
151-
}
152172

153-
stage('Deploy') {
154-
tools {
155-
jdk params.jdkVersion
156-
}
157-
when {
158-
expression {
159-
params.deployEnabled && env.BRANCH_NAME ==~ /(activemq-5.19.x|main)/
173+
stage('Deploy') {
174+
tools {
175+
jdk params.jdkVersion
176+
}
177+
when {
178+
expression {
179+
params.deployEnabled && env.BRANCH_NAME ==~ /(activemq-5.19.x|activemq-6.1.x|main)/
180+
}
181+
}
182+
steps {
183+
echo 'Deploying'
184+
sh 'java -version'
185+
sh 'mvn -version'
186+
sh 'mvn -B -e deploy -Pdeploy -DskipTests'
187+
}
160188
}
161-
}
162-
steps {
163-
echo 'Deploying'
164-
sh 'java -version'
165-
sh 'mvn -version'
166-
sh 'mvn -B -e deploy -Pdeploy -DskipTests'
167-
}
168-
}
169189

170-
stage('Quality') {
171-
when { expression { return params.sonarEnabled } }
190+
stage('Quality') {
191+
when { expression { return params.sonarEnabled } }
172192

173-
steps {
174-
withCredentials([string(credentialsId: 'SONARCLOUD_TOKEN', variable: 'SONAR_TOKEN')]) {
175-
sh 'echo "Running the Sonar stage"'
176-
sh 'mvn -B -e -fae clean verify sonar:sonar -Dsonar.projectKey=apache_activemq -Dsonar.organization=apache -Dsonar.host.url=https://sonarcloud.io -Dsonar.login=${SONAR_TOKEN} -Dsurefire.rerunFailingTestsCount=3'
193+
steps {
194+
withCredentials([string(credentialsId: 'SONARCLOUD_TOKEN', variable: 'SONAR_TOKEN')]) {
195+
sh 'echo "Running the Sonar stage"'
196+
sh 'mvn -B -e -fae clean verify sonar:sonar -Dsonar.projectKey=apache_activemq -Dsonar.organization=apache -Dsonar.host.url=https://sonarcloud.io -Dsonar.login=${SONAR_TOKEN} -Dsurefire.rerunFailingTestsCount=3'
197+
}
198+
}
177199
}
178200
}
179201
}
180-
181-
}
182-
202+
}
183203
// Do any post build stuff ... such as sending emails depending on the overall build result.
184204
post {
185205
// If this build failed, send an email to the list.

0 commit comments

Comments
 (0)