Skip to content

Commit 0ecd25c

Browse files
s390x weekly job
1 parent 35197b4 commit 0ecd25c

File tree

1 file changed

+127
-107
lines changed

1 file changed

+127
-107
lines changed

Jenkinsfile

Lines changed: 127 additions & 107 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 {
@@ -50,127 +51,146 @@ pipeline {
5051
}
5152

5253
stages {
53-
stage('Initialization') {
54+
stage('Node selection') {
5455
steps {
55-
echo "running on ${env.NODE_NAME}"
56-
echo 'Building branch ' + env.BRANCH_NAME
57-
echo 'Using PATH ' + env.PATH
56+
script {
57+
// Detect if triggered by cron
58+
def causes = currentBuild.getBuildCauses()
59+
def triggeredByCron = causes.any { it._class == 'hudson.triggers.TimerTrigger$TimerTriggerCause' }
60+
61+
if (triggeredByCron) {
62+
// Allow s390x builds only when triggered by the Sunday cron
63+
targetNode = 's390x'
64+
} else {
65+
targetNode = params.nodeLabel
66+
}
67+
}
5868
}
5969
}
70+
stage('Main Workflow') {
71+
agent { label "${targetNode}" }
72+
stages{
73+
stage('Initialization') {
74+
steps {
75+
echo "running on ${env.NODE_NAME}"
76+
echo 'Building branch ' + env.BRANCH_NAME
77+
echo 'Using PATH ' + env.PATH
78+
}
79+
}
6080

61-
stage('Cleanup') {
62-
steps {
63-
echo 'Cleaning up the workspace'
64-
deleteDir()
65-
}
66-
}
81+
stage('Cleanup') {
82+
steps {
83+
echo 'Cleaning up the workspace'
84+
deleteDir()
85+
}
86+
}
6787

68-
stage('Checkout') {
69-
steps {
70-
echo 'Checking out branch ' + env.BRANCH_NAME
71-
checkout scm
72-
}
73-
}
88+
stage('Checkout') {
89+
steps {
90+
echo 'Checking out branch ' + env.BRANCH_NAME
91+
checkout scm
92+
}
93+
}
7494

75-
stage('Build JDK 24') {
76-
tools {
77-
jdk "jdk_24_latest"
78-
}
79-
steps {
80-
echo 'Building JDK 24'
81-
sh 'java -version'
82-
sh 'mvn -version'
83-
sh 'mvn -U -B -e clean install -DskipTests'
84-
}
85-
}
95+
stage('Build JDK 24') {
96+
tools {
97+
jdk "jdk_24_latest"
98+
}
99+
steps {
100+
echo 'Building JDK 24'
101+
sh 'java -version'
102+
sh 'mvn -version'
103+
sh 'mvn -U -B -e clean install -DskipTests'
104+
}
105+
}
86106

87-
stage('Build JDK 21') {
88-
tools {
89-
jdk "jdk_21_latest"
90-
}
91-
steps {
92-
echo 'Building JDK 21'
93-
sh 'java -version'
94-
sh 'mvn -version'
95-
sh 'mvn -U -B -e clean install -DskipTests'
96-
}
97-
}
107+
stage('Build JDK 21') {
108+
tools {
109+
jdk "jdk_21_latest"
110+
}
111+
steps {
112+
echo 'Building JDK 21'
113+
sh 'java -version'
114+
sh 'mvn -version'
115+
sh 'mvn -U -B -e clean install -DskipTests'
116+
}
117+
}
98118

99-
stage('Build JDK 17') {
100-
tools {
101-
jdk "jdk_17_latest"
102-
}
103-
steps {
104-
echo 'Building JDK 17'
105-
sh 'java -version'
106-
sh 'mvn -version'
107-
sh 'mvn -U -B -e clean install -DskipTests'
108-
}
109-
}
119+
stage('Build JDK 17') {
120+
tools {
121+
jdk "jdk_17_latest"
122+
}
123+
steps {
124+
echo 'Building JDK 17'
125+
sh 'java -version'
126+
sh 'mvn -version'
127+
sh 'mvn -U -B -e clean install -DskipTests'
128+
}
129+
}
110130

111-
stage('Verify') {
112-
tools {
113-
jdk params.jdkVersion
114-
}
115-
steps {
116-
echo 'Running apache-rat:check'
117-
sh 'java -version'
118-
sh 'mvn -version'
119-
sh 'mvn apache-rat:check'
120-
}
121-
}
131+
stage('Verify') {
132+
tools {
133+
jdk params.jdkVersion
134+
}
135+
steps {
136+
echo 'Running apache-rat:check'
137+
sh 'java -version'
138+
sh 'mvn -version'
139+
sh 'mvn apache-rat:check'
140+
}
141+
}
122142

123-
stage('Tests') {
124-
tools {
125-
jdk params.jdkVersion
126-
}
127-
when { expression { return params.testsEnabled } }
128-
steps {
129-
echo 'Running tests'
130-
sh 'java -version'
131-
sh 'mvn -version'
132-
// all tests is very very long (10 hours on Apache Jenkins)
133-
// sh 'mvn -B -e test -pl activemq-unit-tests -Dactivemq.tests=all'
134-
sh 'mvn -B -e -fae test -Dsurefire.rerunFailingTestsCount=3'
135-
}
136-
post {
137-
always {
138-
junit(testResults: '**/surefire-reports/*.xml', allowEmptyResults: true)
139-
junit(testResults: '**/failsafe-reports/*.xml', allowEmptyResults: true)
143+
stage('Tests') {
144+
tools {
145+
jdk params.jdkVersion
146+
}
147+
when { expression { return params.testsEnabled } }
148+
steps {
149+
echo 'Running tests'
150+
sh 'java -version'
151+
sh 'mvn -version'
152+
// all tests is very very long (10 hours on Apache Jenkins)
153+
// sh 'mvn -B -e test -pl activemq-unit-tests -Dactivemq.tests=all'
154+
sh 'mvn -B -e -fae test -Dsurefire.rerunFailingTestsCount=3'
155+
}
156+
post {
157+
always {
158+
junit(testResults: '**/surefire-reports/*.xml', allowEmptyResults: true)
159+
junit(testResults: '**/failsafe-reports/*.xml', allowEmptyResults: true)
160+
}
161+
}
140162
}
141-
}
142-
}
143163

144-
stage('Deploy') {
145-
tools {
146-
jdk params.jdkVersion
147-
}
148-
when {
149-
expression {
150-
params.deployEnabled && env.BRANCH_NAME ==~ /(activemq-5.19.x|activemq-6.1.x|main)/
164+
stage('Deploy') {
165+
tools {
166+
jdk params.jdkVersion
167+
}
168+
when {
169+
expression {
170+
params.deployEnabled && env.BRANCH_NAME ==~ /(activemq-5.19.x|activemq-6.1.x|main)/
171+
}
172+
}
173+
steps {
174+
echo 'Deploying'
175+
sh 'java -version'
176+
sh 'mvn -version'
177+
sh 'mvn -B -e deploy -Pdeploy -DskipTests'
178+
}
151179
}
152-
}
153-
steps {
154-
echo 'Deploying'
155-
sh 'java -version'
156-
sh 'mvn -version'
157-
sh 'mvn -B -e deploy -Pdeploy -DskipTests'
158-
}
159-
}
160180

161-
stage('Quality') {
162-
when { expression { return params.sonarEnabled } }
181+
stage('Quality') {
182+
when { expression { return params.sonarEnabled } }
163183

164-
steps {
165-
withCredentials([string(credentialsId: 'SONARCLOUD_TOKEN', variable: 'SONAR_TOKEN')]) {
166-
sh 'echo "Running the Sonar stage"'
167-
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'
184+
steps {
185+
withCredentials([string(credentialsId: 'SONARCLOUD_TOKEN', variable: 'SONAR_TOKEN')]) {
186+
sh 'echo "Running the Sonar stage"'
187+
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'
188+
}
189+
}
168190
}
169191
}
170192
}
171-
172-
}
173-
193+
}
174194
// Do any post build stuff ... such as sending emails depending on the overall build result.
175195
post {
176196
// If this build failed, send an email to the list.

0 commit comments

Comments
 (0)