From 916000fa5acbcdbe782d298ffb020233450fb09e Mon Sep 17 00:00:00 2001 From: SanyogDeshmukh <72301054+SanyogDeshmukh@users.noreply.github.com> Date: Tue, 26 Aug 2025 15:41:25 +0530 Subject: [PATCH 1/2] s390x weekly job --- Jenkinsfile | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/Jenkinsfile b/Jenkinsfile index d1891aad95e..9863b953c47 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -27,6 +27,11 @@ pipeline { } } + triggers { + // Run s390x builds every Sunday at midnight + cron('H 0 * * 0') + } + tools { // ... tell Jenkins what java version, maven version or other tools are required ... maven 'maven_3_latest' @@ -50,6 +55,20 @@ pipeline { } stages { + stage('Guard') { + steps { + script { + // Allow s390x builds only when triggered by the Sunday cron + if (params.nodeLabel == 's390x' && + currentBuild.rawBuild.getCause(hudson.triggers.TimerTrigger.TimerTriggerCause) == null) { + echo "Skipping s390x build (not Sunday cron trigger)" + currentBuild.result = 'NOT_BUILT' + error("Aborting pipeline for non-scheduled s390x run") + } + } + } + } + stage('Initialization') { steps { echo "running on ${env.NODE_NAME}" From 56032fd4ba3ef37ef9ae137fe92912d063cd508f Mon Sep 17 00:00:00 2001 From: SanyogDeshmukh <72301054+SanyogDeshmukh@users.noreply.github.com> Date: Thu, 4 Sep 2025 15:23:50 +0530 Subject: [PATCH 2/2] Update Jenkinsfile --- Jenkinsfile | 239 ++++++++++++++++++++++++++-------------------------- 1 file changed, 120 insertions(+), 119 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 9863b953c47..4df9063e603 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -21,11 +21,7 @@ pipeline { - agent { - label { - label params.nodeLabel - } - } + agent none triggers { // Run s390x builds every Sunday at midnight @@ -55,141 +51,146 @@ pipeline { } stages { - stage('Guard') { + stage('Node selection') { steps { script { - // Allow s390x builds only when triggered by the Sunday cron - if (params.nodeLabel == 's390x' && - currentBuild.rawBuild.getCause(hudson.triggers.TimerTrigger.TimerTriggerCause) == null) { - echo "Skipping s390x build (not Sunday cron trigger)" - currentBuild.result = 'NOT_BUILT' - error("Aborting pipeline for non-scheduled s390x run") + // Detect if triggered by cron + def causes = currentBuild.getBuildCauses() + def triggeredByCron = causes.any { it._class == 'hudson.triggers.TimerTrigger$TimerTriggerCause' } + + if (triggeredByCron) { + // Allow s390x builds only when triggered by the Sunday cron + targetNode = 's390x' + } else { + targetNode = params.nodeLabel } } } } + stage('Main Workflow') { + agent { label "${targetNode}" } + stages{ + stage('Initialization') { + steps { + echo "running on ${env.NODE_NAME}" + echo 'Building branch ' + env.BRANCH_NAME + echo 'Using PATH ' + env.PATH + } + } - stage('Initialization') { - steps { - echo "running on ${env.NODE_NAME}" - echo 'Building branch ' + env.BRANCH_NAME - echo 'Using PATH ' + env.PATH - } - } - - stage('Cleanup') { - steps { - echo 'Cleaning up the workspace' - deleteDir() - } - } + stage('Cleanup') { + steps { + echo 'Cleaning up the workspace' + deleteDir() + } + } - stage('Checkout') { - steps { - echo 'Checking out branch ' + env.BRANCH_NAME - checkout scm - } - } + stage('Checkout') { + steps { + echo 'Checking out branch ' + env.BRANCH_NAME + checkout scm + } + } - stage('Build JDK 24') { - tools { - jdk "jdk_24_latest" - } - steps { - echo 'Building JDK 24' - sh 'java -version' - sh 'mvn -version' - sh 'mvn -U -B -e clean install -DskipTests' - } - } + stage('Build JDK 24') { + tools { + jdk "jdk_24_latest" + } + steps { + echo 'Building JDK 24' + sh 'java -version' + sh 'mvn -version' + sh 'mvn -U -B -e clean install -DskipTests' + } + } - stage('Build JDK 21') { - tools { - jdk "jdk_21_latest" - } - steps { - echo 'Building JDK 21' - sh 'java -version' - sh 'mvn -version' - sh 'mvn -U -B -e clean install -DskipTests' - } - } + stage('Build JDK 21') { + tools { + jdk "jdk_21_latest" + } + steps { + echo 'Building JDK 21' + sh 'java -version' + sh 'mvn -version' + sh 'mvn -U -B -e clean install -DskipTests' + } + } - stage('Build JDK 17') { - tools { - jdk "jdk_17_latest" - } - steps { - echo 'Building JDK 17' - sh 'java -version' - sh 'mvn -version' - sh 'mvn -U -B -e clean install -DskipTests' - } - } + stage('Build JDK 17') { + tools { + jdk "jdk_17_latest" + } + steps { + echo 'Building JDK 17' + sh 'java -version' + sh 'mvn -version' + sh 'mvn -U -B -e clean install -DskipTests' + } + } - stage('Verify') { - tools { - jdk params.jdkVersion - } - steps { - echo 'Running apache-rat:check' - sh 'java -version' - sh 'mvn -version' - sh 'mvn apache-rat:check' - } - } + stage('Verify') { + tools { + jdk params.jdkVersion + } + steps { + echo 'Running apache-rat:check' + sh 'java -version' + sh 'mvn -version' + sh 'mvn apache-rat:check' + } + } - stage('Tests') { - tools { - jdk params.jdkVersion - } - when { expression { return params.testsEnabled } } - steps { - echo 'Running tests' - sh 'java -version' - sh 'mvn -version' - // all tests is very very long (10 hours on Apache Jenkins) - // sh 'mvn -B -e test -pl activemq-unit-tests -Dactivemq.tests=all' - sh 'mvn -B -e -fae test -Dsurefire.rerunFailingTestsCount=3' - } - post { - always { - junit(testResults: '**/surefire-reports/*.xml', allowEmptyResults: true) - junit(testResults: '**/failsafe-reports/*.xml', allowEmptyResults: true) + stage('Tests') { + tools { + jdk params.jdkVersion + } + when { expression { return params.testsEnabled } } + steps { + echo 'Running tests' + sh 'java -version' + sh 'mvn -version' + // all tests is very very long (10 hours on Apache Jenkins) + // sh 'mvn -B -e test -pl activemq-unit-tests -Dactivemq.tests=all' + sh 'mvn -B -e -fae test -Dsurefire.rerunFailingTestsCount=3' + } + post { + always { + junit(testResults: '**/surefire-reports/*.xml', allowEmptyResults: true) + junit(testResults: '**/failsafe-reports/*.xml', allowEmptyResults: true) + } + } } - } - } - stage('Deploy') { - tools { - jdk params.jdkVersion - } - when { - expression { - params.deployEnabled && env.BRANCH_NAME ==~ /(activemq-5.19.x|activemq-6.1.x|main)/ + stage('Deploy') { + tools { + jdk params.jdkVersion + } + when { + expression { + params.deployEnabled && env.BRANCH_NAME ==~ /(activemq-5.19.x|activemq-6.1.x|main)/ + } + } + steps { + echo 'Deploying' + sh 'java -version' + sh 'mvn -version' + sh 'mvn -B -e deploy -Pdeploy -DskipTests' + } } - } - steps { - echo 'Deploying' - sh 'java -version' - sh 'mvn -version' - sh 'mvn -B -e deploy -Pdeploy -DskipTests' - } - } - stage('Quality') { - when { expression { return params.sonarEnabled } } + stage('Quality') { + when { expression { return params.sonarEnabled } } - steps { - withCredentials([string(credentialsId: 'SONARCLOUD_TOKEN', variable: 'SONAR_TOKEN')]) { - sh 'echo "Running the Sonar stage"' - 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' + steps { + withCredentials([string(credentialsId: 'SONARCLOUD_TOKEN', variable: 'SONAR_TOKEN')]) { + sh 'echo "Running the Sonar stage"' + 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' + } + } } } } - - } - + } // Do any post build stuff ... such as sending emails depending on the overall build result. post { // If this build failed, send an email to the list.