From 56825911ed4e0a03984401d89abb1a0659e56270 Mon Sep 17 00:00:00 2001 From: Simon Laden <33128816+simonladen@users.noreply.github.com> Date: Thu, 15 Feb 2024 09:47:53 +0000 Subject: [PATCH] Merge pull request #6560 from simonladen/FISH-8205-parallel-pr-testing FISH-8205 - run the tests in the pipeline in parallel --- Jenkinsfile | 356 ++++++++++++++++++++++++++-------------------------- 1 file changed, 181 insertions(+), 175 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 48535505cb5..eb4b7b22e75 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -40,193 +40,188 @@ pipeline { success{ archiveArtifacts artifacts: 'appserver/distributions/payara/target/payara.zip', fingerprint: true archiveArtifacts artifacts: 'appserver/extras/payara-micro/payara-micro-distribution/target/payara-micro.jar', fingerprint: true + stash name: 'payara-target', includes: 'appserver/distributions/payara/target/**', allowEmpty: true + dir('/home/ubuntu/.m2/repository/'){ + stash name: 'payara-m2-repository', includes: '**', allowEmpty: true + } } always { archiveArtifacts allowEmptyArchive: true, artifacts: 'appserver/distributions/payara/target/stage/payara7/glassfish/logs/server.log' } } } - stage('Setup for Quicklook Tests') { - steps { - setupDomain() - } - } - stage('Run Quicklook Tests') { - steps { - echo '*#*#*#*#*#*#*#*#*#*#*#*# Running test *#*#*#*#*#*#*#*#*#*#*#*#*#*#*#' - sh """rm ~/test\\|sa.mv.db || true""" - sh """mvn -B -V -ff -e clean test --strict-checksums -Pall \ - -Dglassfish.home=\"${pwd()}/appserver/distributions/payara/target/stage/payara7/glassfish\" \ - -Djavax.net.ssl.trustStore=${env.JAVA_HOME}/lib/security/cacerts \ - -Djavax.xml.accessExternalSchema=all \ - -f appserver/tests/quicklook/pom.xml""" - echo '*#*#*#*#*#*#*#*#*#*#*#*# Ran test *#*#*#*#*#*#*#*#*#*#*#*#*#*#*#' - } - post { - always { - junit 'appserver/tests/quicklook/test-output/QuickLookTests/*.xml' - processReportAndStopDomain() - } - cleanup { - saveLogsAndCleanup 'quicklook-log.zip' - } - } - } - stage('Setup for Payara Samples Tests') { - steps { - setupDomain() - } - } - stage('Run Payara Samples Tests') { - steps { - echo '*#*#*#*#*#*#*#*#*#*#*#*# Running test *#*#*#*#*#*#*#*#*#*#*#*#*#*#*#' - sh """mvn -V -B -ff clean install --strict-checksums -Ppayara-server-remote,playwright \ - -Dpayara.version=${pom.version} \ - -Djavax.net.ssl.trustStore=${env.JAVA_HOME}/lib/security/cacerts \ - -Djavax.xml.accessExternalSchema=all \ - -f appserver/tests/payara-samples """ - echo '*#*#*#*#*#*#*#*#*#*#*#*# Ran test *#*#*#*#*#*#*#*#*#*#*#*#*#*#*#' - } - post { - always { - junit 'appserver/tests/quicklook/test-output/QuickLookTests/*.xml' - processReportAndStopDomain() - } - cleanup { - saveLogsAndCleanup 'samples-log.zip' - } - } - } - stage('Checkout MP TCK Runners') { - steps{ - echo '*#*#*#*#*#*#*#*#*#*#*#*# Checking out MP TCK Runners *#*#*#*#*#*#*#*#*#*#*#*#*#*#*#' - checkout changelog: false, poll: false, scm: [$class: 'GitSCM', - branches: [[name: "*/microprofile-6.1"]], - userRemoteConfigs: [[url: "https://github.com/payara/MicroProfile-TCK-Runners.git"]]] - echo '*#*#*#*#*#*#*#*#*#*#*#*# Checked out MP TCK Runners *#*#*#*#*#*#*#*#*#*#*#*#*#*#*#' - } - } - stage('Setup for MP TCK Tests') { - steps { - setupDomain() - } - } - stage('Run MP TCK Tests') { - steps { - echo '*#*#*#*#*#*#*#*#*#*#*#*# Running test *#*#*#*#*#*#*#*#*#*#*#*#*#*#*#' - sh """mvn -B -V -ff -e clean verify --strict-checksums \ - -Djavax.net.ssl.trustStore=${env.JAVA_HOME}/lib/security/cacerts \ - -Djavax.xml.accessExternalSchema=all -Dpayara.version=${pom.version} \ - -Dpayara_domain=${DOMAIN_NAME} -Dpayara.home="${pwd()}/appserver/distributions/payara/target/stage/payara7" \ - -Ppayara-server-remote,full""" - echo '*#*#*#*#*#*#*#*#*#*#*#*# Ran test *#*#*#*#*#*#*#*#*#*#*#*#*#*#*#' - } - post { - always { - processReportAndStopDomain() + stage('Run Tests'){ + parallel { + stage('Quicklook Tests') { + agent { + label 'general-purpose' + } + steps { + setupDomain() + + echo '*#*#*#*#*#*#*#*#*#*#*#*# Running test *#*#*#*#*#*#*#*#*#*#*#*#*#*#*#' + sh """rm ~/test\\|sa.mv.db || true""" + sh """mvn -B -V -ff -e clean test --strict-checksums -Pall \ + -Dglassfish.home=\"${pwd()}/appserver/distributions/payara/target/stage/payara7/glassfish\" \ + -Djavax.net.ssl.trustStore=${env.JAVA_HOME}/lib/security/cacerts \ + -Djavax.xml.accessExternalSchema=all \ + -f appserver/tests/quicklook/pom.xml""" + echo '*#*#*#*#*#*#*#*#*#*#*#*# Ran test *#*#*#*#*#*#*#*#*#*#*#*#*#*#*#' + } + post { + always { + junit 'appserver/tests/quicklook/test-output/QuickLookTests/*.xml' + stopDomain() + } + cleanup { + saveLogsAndCleanup 'quicklook-log.zip' + } + } } - cleanup { - saveLogsAndCleanup 'mp-tck-log.zip' + stage('Payara Samples Tests') { + agent { + label 'general-purpose' + } + steps { + setupDomain() + + echo '*#*#*#*#*#*#*#*#*#*#*#*# Running test *#*#*#*#*#*#*#*#*#*#*#*#*#*#*#' + sh """mvn -V -B -ff clean install --strict-checksums -Ppayara-server-remote,playwright \ + -Dpayara.version=${pom.version} \ + -Djavax.net.ssl.trustStore=${env.JAVA_HOME}/lib/security/cacerts \ + -Djavax.xml.accessExternalSchema=all \ + -f appserver/tests/payara-samples """ + echo '*#*#*#*#*#*#*#*#*#*#*#*# Ran test *#*#*#*#*#*#*#*#*#*#*#*#*#*#*#' + } + post { + always { + processReportAndStopDomain() + } + cleanup { + saveLogsAndCleanup 'samples-log.zip' + } + } } - } - } - stage('Checkout EE8 Tests') { - steps{ - echo '*#*#*#*#*#*#*#*#*#*#*#*# Checking out EE8 tests *#*#*#*#*#*#*#*#*#*#*#*#*#*#*#' - checkout changelog: false, poll: false, scm: [$class: 'GitSCM', - branches: [[name: "*/Payara6"]], - userRemoteConfigs: [[url: "https://github.com/payara/patched-src-javaee8-samples.git"]]] - echo '*#*#*#*#*#*#*#*#*#*#*#*# Checked out EE8 tests *#*#*#*#*#*#*#*#*#*#*#*#*#*#*#' - } - } - stage('Setup for EE8 Tests') { - steps { - setupDomain() - } - } - stage('Run EE8 Tests') { - steps { - echo '*#*#*#*#*#*#*#*#*#*#*#*# Running test *#*#*#*#*#*#*#*#*#*#*#*#*#*#*#' - sh "mvn -B -V -ff -e clean install --strict-checksums -Dsurefire.useFile=false \ - -Djavax.net.ssl.trustStore=${env.JAVA_HOME}/lib/security/cacerts \ - -Djavax.xml.accessExternalSchema=all -Dpayara.version=${pom.version} \ - -Ppayara-server-remote,stable" - echo '*#*#*#*#*#*#*#*#*#*#*#*# Ran test *#*#*#*#*#*#*#*#*#*#*#*#*#*#*#' - } - post { - always { - processReportAndStopDomain() - } - cleanup { - saveLogsAndCleanup 'ee8-samples-log.zip' - } - } - } - stage('Checkout CargoTracker Tests') { - steps{ - echo '*#*#*#*#*#*#*#*#*#*#*#*# Checking out cargoTracker tests *#*#*#*#*#*#*#*#*#*#*#*#*#*#*#' - checkout changelog: false, poll: false, scm: [$class: 'GitSCM', - branches: [[name: "*/Payara7"]], - userRemoteConfigs: [[url: "https://github.com/payara/cargoTracker.git"]]] - echo '*#*#*#*#*#*#*#*#*#*#*#*# Checked out cargoTracker tests *#*#*#*#*#*#*#*#*#*#*#*#*#*#*#' - } - } - stage('Setup for CargoTracker Tests') { - steps { - setupDomain() - } - } - stage('Run CargoTracker Tests') { - steps { - echo '*#*#*#*#*#*#*#*#*#*#*#*# Cleaning CargoTracker Database in /tmp *#*#*#*#*#*#*#*#*#*#*#*#*#*#*#' - sh "rm -rf /tmp/cargo*" + stage('MP TCK Runners') { + agent { + label 'general-purpose' + } + steps{ + echo '*#*#*#*#*#*#*#*#*#*#*#*# Checking out MP TCK Runners *#*#*#*#*#*#*#*#*#*#*#*#*#*#*#' + checkout changelog: false, poll: false, scm: [$class: 'GitSCM', + branches: [[name: "*/microprofile-6.1"]], + userRemoteConfigs: [[url: "https://github.com/payara/MicroProfile-TCK-Runners.git"]]] + echo '*#*#*#*#*#*#*#*#*#*#*#*# Checked out MP TCK Runners *#*#*#*#*#*#*#*#*#*#*#*#*#*#*#' + + setupDomain() - echo '*#*#*#*#*#*#*#*#*#*#*#*# Running test *#*#*#*#*#*#*#*#*#*#*#*#*#*#*#' - sh """mvn -B -V -ff -e clean install --strict-checksums -Dsurefire.useFile=false \ - -Djavax.net.ssl.trustStore=${env.JAVA_HOME}/lib/security/cacerts \ - -Djavax.xml.accessExternalSchema=all -Dpayara.version=${pom.version} \ - -Ppayara-server-remote -DtrimStackTrace=false""" - echo '*#*#*#*#*#*#*#*#*#*#*#*# Ran test *#*#*#*#*#*#*#*#*#*#*#*#*#*#*#' - } - post { - always { - processReportAndStopDomain() + echo '*#*#*#*#*#*#*#*#*#*#*#*# Running test *#*#*#*#*#*#*#*#*#*#*#*#*#*#*#' + sh """mvn -B -V -ff -e clean verify --strict-checksums \ + -Djavax.net.ssl.trustStore=${env.JAVA_HOME}/lib/security/cacerts \ + -Djavax.xml.accessExternalSchema=all -Dpayara.version=${pom.version} \ + -Dpayara_domain=${DOMAIN_NAME} -Dpayara.home="${pwd()}/appserver/distributions/payara/target/stage/payara7" \ + -Ppayara-server-remote,full""" + echo '*#*#*#*#*#*#*#*#*#*#*#*# Ran test *#*#*#*#*#*#*#*#*#*#*#*#*#*#*#' + } + post { + always { + processReportAndStopDomain() + } + cleanup { + saveLogsAndCleanup 'mp-tck-log.zip' + } + } } - cleanup { - saveLogsAndCleanup 'cargotracker-log.zip' + stage('EE8 Tests') { + agent { + label 'general-purpose' + } + steps{ + echo '*#*#*#*#*#*#*#*#*#*#*#*# Checking out EE8 tests *#*#*#*#*#*#*#*#*#*#*#*#*#*#*#' + checkout changelog: false, poll: false, scm: [$class: 'GitSCM', + branches: [[name: "*/Payara6"]], + userRemoteConfigs: [[url: "https://github.com/payara/patched-src-javaee8-samples.git"]]] + echo '*#*#*#*#*#*#*#*#*#*#*#*# Checked out EE8 tests *#*#*#*#*#*#*#*#*#*#*#*#*#*#*#' + + setupDomain() + + echo '*#*#*#*#*#*#*#*#*#*#*#*# Running test *#*#*#*#*#*#*#*#*#*#*#*#*#*#*#' + sh "mvn -B -V -ff -e clean install --strict-checksums -Dsurefire.useFile=false \ + -Djavax.net.ssl.trustStore=${env.JAVA_HOME}/lib/security/cacerts \ + -Djavax.xml.accessExternalSchema=all -Dpayara.version=${pom.version} \ + -Ppayara-server-remote,stable" + echo '*#*#*#*#*#*#*#*#*#*#*#*# Ran test *#*#*#*#*#*#*#*#*#*#*#*#*#*#*#' + } + post { + always { + processReportAndStopDomain() + } + cleanup { + saveLogsAndCleanup 'ee8-samples-log.zip' + } + } } - } - } - stage('Checkout EE7 Tests') { - steps{ - echo '*#*#*#*#*#*#*#*#*#*#*#*# Checking out EE7 tests *#*#*#*#*#*#*#*#*#*#*#*#*#*#*#' - checkout changelog: false, poll: false, scm: [$class: 'GitSCM', - branches: [[name: "*/Payara6"]], - userRemoteConfigs: [[url: "https://github.com/payara/patched-src-javaee7-samples.git"]]] - echo '*#*#*#*#*#*#*#*#*#*#*#*# Checked out EE7 tests *#*#*#*#*#*#*#*#*#*#*#*#*#*#*#' - } - } - stage('Setup for EE7 Tests') { - steps { - setupDomain() - } - } - stage('Run EE7 Tests') { - steps { - echo '*#*#*#*#*#*#*#*#*#*#*#*# Running test *#*#*#*#*#*#*#*#*#*#*#*#*#*#*#' - sh """mvn -B -V -ff -e clean install --strict-checksums \ - -Djavax.net.ssl.trustStore=${env.JAVA_HOME}/lib/security/cacerts \ - -Djavax.xml.accessExternalSchema=all -Dpayara.version=${pom.version} \ - -Dpayara_domain=${DOMAIN_NAME} \ - -Ppayara-server-remote,stable,payara6""" - echo '*#*#*#*#*#*#*#*#*#*#*#*# Ran test *#*#*#*#*#*#*#*#*#*#*#*#*#*#*#' - } - post { - always { - processReportAndStopDomain() + stage('CargoTracker Tests') { + agent { + label 'general-purpose' + } + steps{ + echo '*#*#*#*#*#*#*#*#*#*#*#*# Checking out cargoTracker tests *#*#*#*#*#*#*#*#*#*#*#*#*#*#*#' + checkout changelog: false, poll: false, scm: [$class: 'GitSCM', + branches: [[name: "*/Payara7"]], + userRemoteConfigs: [[url: "https://github.com/payara/cargoTracker.git"]]] + echo '*#*#*#*#*#*#*#*#*#*#*#*# Checked out cargoTracker tests *#*#*#*#*#*#*#*#*#*#*#*#*#*#*#' + + setupDomain() + + echo '*#*#*#*#*#*#*#*#*#*#*#*# Cleaning CargoTracker Database in /tmp *#*#*#*#*#*#*#*#*#*#*#*#*#*#*#' + sh "rm -rf /tmp/cargo*" + + echo '*#*#*#*#*#*#*#*#*#*#*#*# Running test *#*#*#*#*#*#*#*#*#*#*#*#*#*#*#' + sh """mvn -B -V -ff -e clean install --strict-checksums -Dsurefire.useFile=false \ + -Djavax.net.ssl.trustStore=${env.JAVA_HOME}/lib/security/cacerts \ + -Djavax.xml.accessExternalSchema=all -Dpayara.version=${pom.version} \ + -Ppayara-server-remote -DtrimStackTrace=false""" + echo '*#*#*#*#*#*#*#*#*#*#*#*# Ran test *#*#*#*#*#*#*#*#*#*#*#*#*#*#*#' + } + post { + always { + processReportAndStopDomain() + } + cleanup { + saveLogsAndCleanup 'cargotracker-log.zip' + } + } } - cleanup { - saveLogsAndCleanup 'ee7-samples-log.zip' + stage('EE7 Tests') { + agent { + label 'general-purpose' + } + steps{ + echo '*#*#*#*#*#*#*#*#*#*#*#*# Checking out EE7 tests *#*#*#*#*#*#*#*#*#*#*#*#*#*#*#' + checkout changelog: false, poll: false, scm: [$class: 'GitSCM', + branches: [[name: "*/Payara6"]], + userRemoteConfigs: [[url: "https://github.com/payara/patched-src-javaee7-samples.git"]]] + echo '*#*#*#*#*#*#*#*#*#*#*#*# Checked out EE7 tests *#*#*#*#*#*#*#*#*#*#*#*#*#*#*#' + + setupDomain() + + echo '*#*#*#*#*#*#*#*#*#*#*#*# Running test *#*#*#*#*#*#*#*#*#*#*#*#*#*#*#' + sh """mvn -B -V -ff -e clean install --strict-checksums \ + -Djavax.net.ssl.trustStore=${env.JAVA_HOME}/lib/security/cacerts \ + -Djavax.xml.accessExternalSchema=all -Dpayara.version=${pom.version} \ + -Dpayara_domain=${DOMAIN_NAME} \ + -Ppayara-server-remote,stable,payara6""" + echo '*#*#*#*#*#*#*#*#*#*#*#*# Ran test *#*#*#*#*#*#*#*#*#*#*#*#*#*#*#' + } + post { + always { + processReportAndStopDomain() + } + cleanup { + saveLogsAndCleanup 'ee7-samples-log.zip' + } + } } } } @@ -242,6 +237,12 @@ void makeDomain() { } void setupDomain() { + echo '*#*#*#*#*#*#*#*#*#*#*#*# Unstash distributions *#*#*#*#*#*#*#*#*#*#*#*#*#*#*#' + unstash name: 'payara-target' + echo '*#*#*#*#*#*#*#*#*#*#*#*# Unstash maven repository *#*#*#*#*#*#*#*#*#*#*#*#*#*#*#' + dir('/home/ubuntu/.m2/repository/'){ + unstash name: 'payara-m2-repository' + } echo '*#*#*#*#*#*#*#*#*#*#*#*# Setting up tests *#*#*#*#*#*#*#*#*#*#*#*#*#*#*#' makeDomain() sh "${ASADMIN} start-domain ${DOMAIN_NAME}" @@ -254,6 +255,11 @@ void processReportAndStopDomain() { sh "${ASADMIN} stop-database || true" } +void stopDomain() { + sh "${ASADMIN} stop-domain ${DOMAIN_NAME}" + sh "${ASADMIN} stop-database || true" +} + void saveLogsAndCleanup(String logArchiveName) { zip archive: true, dir: "appserver/distributions/payara/target/stage/payara7/glassfish/domains/${DOMAIN_NAME}/logs", glob: 'server.*', zipFile: logArchiveName echo 'tidying up after tests: '