Skip to content

Commit 425836a

Browse files
s390x weekly job
1 parent 916000f commit 425836a

File tree

1 file changed

+120
-119
lines changed

1 file changed

+120
-119
lines changed

Jenkinsfile

Lines changed: 120 additions & 119 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,7 @@
2121

2222
pipeline {
2323

24-
agent {
25-
label {
26-
label params.nodeLabel
27-
}
28-
}
24+
agent none
2925

3026
triggers {
3127
// Run s390x builds every Sunday at midnight
@@ -55,141 +51,146 @@ pipeline {
5551
}
5652

5753
stages {
58-
stage('Guard') {
54+
stage('Node selection') {
5955
steps {
6056
script {
61-
// Allow s390x builds only when triggered by the Sunday cron
62-
if (params.nodeLabel == 's390x' &&
63-
currentBuild.rawBuild.getCause(hudson.triggers.TimerTrigger.TimerTriggerCause) == null) {
64-
echo "Skipping s390x build (not Sunday cron trigger)"
65-
currentBuild.result = 'NOT_BUILT'
66-
error("Aborting pipeline for non-scheduled s390x run")
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
6766
}
6867
}
6968
}
7069
}
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+
}
7180

72-
stage('Initialization') {
73-
steps {
74-
echo "running on ${env.NODE_NAME}"
75-
echo 'Building branch ' + env.BRANCH_NAME
76-
echo 'Using PATH ' + env.PATH
77-
}
78-
}
79-
80-
stage('Cleanup') {
81-
steps {
82-
echo 'Cleaning up the workspace'
83-
deleteDir()
84-
}
85-
}
81+
stage('Cleanup') {
82+
steps {
83+
echo 'Cleaning up the workspace'
84+
deleteDir()
85+
}
86+
}
8687

87-
stage('Checkout') {
88-
steps {
89-
echo 'Checking out branch ' + env.BRANCH_NAME
90-
checkout scm
91-
}
92-
}
88+
stage('Checkout') {
89+
steps {
90+
echo 'Checking out branch ' + env.BRANCH_NAME
91+
checkout scm
92+
}
93+
}
9394

94-
stage('Build JDK 24') {
95-
tools {
96-
jdk "jdk_24_latest"
97-
}
98-
steps {
99-
echo 'Building JDK 24'
100-
sh 'java -version'
101-
sh 'mvn -version'
102-
sh 'mvn -U -B -e clean install -DskipTests'
103-
}
104-
}
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+
}
105106

106-
stage('Build JDK 21') {
107-
tools {
108-
jdk "jdk_21_latest"
109-
}
110-
steps {
111-
echo 'Building JDK 21'
112-
sh 'java -version'
113-
sh 'mvn -version'
114-
sh 'mvn -U -B -e clean install -DskipTests'
115-
}
116-
}
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+
}
117118

118-
stage('Build JDK 17') {
119-
tools {
120-
jdk "jdk_17_latest"
121-
}
122-
steps {
123-
echo 'Building JDK 17'
124-
sh 'java -version'
125-
sh 'mvn -version'
126-
sh 'mvn -U -B -e clean install -DskipTests'
127-
}
128-
}
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+
}
129130

130-
stage('Verify') {
131-
tools {
132-
jdk params.jdkVersion
133-
}
134-
steps {
135-
echo 'Running apache-rat:check'
136-
sh 'java -version'
137-
sh 'mvn -version'
138-
sh 'mvn apache-rat:check'
139-
}
140-
}
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+
}
141142

142-
stage('Tests') {
143-
tools {
144-
jdk params.jdkVersion
145-
}
146-
when { expression { return params.testsEnabled } }
147-
steps {
148-
echo 'Running tests'
149-
sh 'java -version'
150-
sh 'mvn -version'
151-
// all tests is very very long (10 hours on Apache Jenkins)
152-
// sh 'mvn -B -e test -pl activemq-unit-tests -Dactivemq.tests=all'
153-
sh 'mvn -B -e -fae test -Dsurefire.rerunFailingTestsCount=3'
154-
}
155-
post {
156-
always {
157-
junit(testResults: '**/surefire-reports/*.xml', allowEmptyResults: true)
158-
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+
}
159162
}
160-
}
161-
}
162163

163-
stage('Deploy') {
164-
tools {
165-
jdk params.jdkVersion
166-
}
167-
when {
168-
expression {
169-
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+
}
170179
}
171-
}
172-
steps {
173-
echo 'Deploying'
174-
sh 'java -version'
175-
sh 'mvn -version'
176-
sh 'mvn -B -e deploy -Pdeploy -DskipTests'
177-
}
178-
}
179180

180-
stage('Quality') {
181-
when { expression { return params.sonarEnabled } }
181+
stage('Quality') {
182+
when { expression { return params.sonarEnabled } }
182183

183-
steps {
184-
withCredentials([string(credentialsId: 'SONARCLOUD_TOKEN', variable: 'SONAR_TOKEN')]) {
185-
sh 'echo "Running the Sonar stage"'
186-
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+
}
187190
}
188191
}
189192
}
190-
191-
}
192-
193+
}
193194
// Do any post build stuff ... such as sending emails depending on the overall build result.
194195
post {
195196
// If this build failed, send an email to the list.

0 commit comments

Comments
 (0)