diff --git a/vars/docOnlyChange.groovy b/vars/docOnlyChange.groovy index b9b90733a..8757189ea 100644 --- a/vars/docOnlyChange.groovy +++ b/vars/docOnlyChange.groovy @@ -19,7 +19,7 @@ boolean call(String target_branch) { return false } - return sh(label: "Determine if doc-only change", + return sh(label: "[${env.STAGE_NAME}] Determine if doc-only change", script: ["CHANGE_ID=${env.CHANGE_ID}", "TARGET_BRANCH=${target_branch}", 'ci/doc_only_change.sh'].join(' '), diff --git a/vars/skipFunctionalTestStage.groovy b/vars/skipFunctionalTestStage.groovy index ea3a2e2be..cd2f2c5ff 100644 --- a/vars/skipFunctionalTestStage.groovy +++ b/vars/skipFunctionalTestStage.groovy @@ -25,21 +25,21 @@ Map call(Map kwargs = [:]) { Boolean run_if_pr = kwargs['run_if_pr'] ?: false String target_branch = env.CHANGE_TARGET ? env.CHANGE_TARGET : env.BRANCH_NAME - echo "[${env.STAGE_NAME}] Running skipFunctionalTestStage: " + + stageMessage("Running skipFunctionalTestStage: " + "tags=${tags}, pragma_suffix=${pragma_suffix}, size=${size}, distro=${distro}, " + "build_param=${build_param}, build_param_value=${build_param_value}, " + "run_if_landing=${run_if_landing}, run_if_pr=${run_if_pr}, " + "startedByUser()=${startedByUser()}, startedByTimer()=${startedByTimer()}, " + - "startedByUpstream()=${startedByUpstream()}, target_branch=${target_branch}" + "startedByUpstream()=${startedByUpstream()}, target_branch=${target_branch}") // Regardless of how the stage has been started always skip a stage that has either already // passed or does not contain any tests match the tags. if (stageAlreadyPassed()) { - echo "[${env.STAGE_NAME}] Skipping the stage due to all tests passing in the previous build" + stageMessage("Skipping the stage due to all tests passing in the previous build") return true } if (!testsInStage(tags)) { - echo "[${env.STAGE_NAME}] Skipping the stage due to detecting no tests matching the '${tags}' tags" + stageMessage("Skipping the stage due to detecting no tests matching the '${tags}' tags") return true } @@ -47,41 +47,41 @@ Map call(Map kwargs = [:]) { // upstream build then use the stage's build parameter (check box) to determine if the stage // should be run or skipped. if (startedByUser() && (build_param_value == 'false')) { - echo "[${env.STAGE_NAME}] Skipping the stage in user started build due to ${build_param} param" + stageMessage("Skipping the stage in user started build due to ${build_param} param") return true } if (startedByUser() && (build_param_value == 'true')) { - echo "[${env.STAGE_NAME}] Running the stage in user started build due to ${build_param} param" + stageMessage("Running the stage in user started build due to ${build_param} param") return false } if (startedByTimer() && (build_param_value == 'false')) { - echo "[${env.STAGE_NAME}] Skipping the stage in timer started build due to ${build_param} param" + stageMessage("Skipping the stage in timer started build due to ${build_param} param") return true } if (startedByTimer() && (build_param_value == 'true')) { - echo "[${env.STAGE_NAME}] Running the stage in timer started build due to ${build_param} param" + stageMessage("Running the stage in timer started build due to ${build_param} param") return false } if (startedByUpstream() && (build_param_value == 'false')) { - echo "[${env.STAGE_NAME}] Skipping the stage in an upstream build due to ${build_param} param" + stageMessage("Skipping the stage in an upstream build due to ${build_param} param") return true } if (startedByUpstream() && (build_param_value == 'true')) { - echo "[${env.STAGE_NAME}] Running the stage in an upstream build due to ${build_param} param" + stageMessage("Running the stage in an upstream build due to ${build_param} param") return false } if (env.UNIT_TEST && env.UNIT_TEST == 'true') { - echo "[${env.STAGE_NAME}] Ignoring the landing build check due to Unit Testing" + stageMessage("Ignoring the landing build check due to Unit Testing") } else { // If the stage is being run in a landing build use the 'run_if_landing' input to determine // whether the stage should be run or skipped. if (startedByLanding() && !run_if_landing) { - echo "[${env.STAGE_NAME}] Skipping the stage in a landing build on master/release branch" + stageMessage("Skipping the stage in a landing build on master/release branch") return true } if (startedByLanding() && run_if_landing) { - echo "[${env.STAGE_NAME}] Running the stage in a landing build on master/release branch" + stageMessage("Running the stage in a landing build on master/release branch") return false } } @@ -105,10 +105,10 @@ Map call(Map kwargs = [:]) { for (commit_pragma in commit_pragmas + skip_pragmas) { String value = (commit_pragma.startsWith('Skip-') || (commit_pragma == 'Run-GHA')) ? 'true' : 'false' if (env.UNIT_TEST && env.UNIT_TEST == 'true') { - echo "[${env.STAGE_NAME}] Checking if stage should be skipped with ${commit_pragma} == ${value}" + stageMessage("Checking if stage should be skipped with ${commit_pragma} == ${value}") } if (cachedCommitPragma(commit_pragma, '').toLowerCase() == value) { - echo "[${env.STAGE_NAME}] Skipping the stage in commit build due to '${commit_pragma}: ${value}' commit pragma" + stageMessage("Skipping the stage in commit build due to '${commit_pragma}: ${value}' commit pragma") return true } } @@ -118,10 +118,10 @@ Map call(Map kwargs = [:]) { for (commit_pragma in commit_pragmas) { String value = commit_pragma.startsWith('Run-') ? 'true' : 'false' if (env.UNIT_TEST && env.UNIT_TEST == 'true') { - echo "[${env.STAGE_NAME}] Checking if stage should be run with ${commit_pragma} == ${value}" + stageMessage("Checking if stage should be run with ${commit_pragma} == ${value}") } if (cachedCommitPragma(commit_pragma, '').toLowerCase() == value) { - echo "[${env.STAGE_NAME}] Running the stage in commit build due to '${commit_pragma}: ${value}' commit pragma" + stageMessage("Running the stage in commit build due to '${commit_pragma}: ${value}' commit pragma") return false } } @@ -129,14 +129,14 @@ Map call(Map kwargs = [:]) { // If the stage is being run in a build started by a commit with only documentation changes, // skip the stage. if (docOnlyChange(target_branch) && prRepos(distro) == '') { - echo "[${env.STAGE_NAME}] Skipping the stage in commit build due to document only file changes" + stageMessage("Skipping the stage in commit build due to document only file changes") return true } // If the stage is being run in a build started by a commit, skip the build if // DAOS_STACK_CI_HARDWARE_SKIP is set. if (env.DAOS_STACK_CI_HARDWARE_SKIP == 'true' ) { - echo "[${env.STAGE_NAME}] Skipping the stage in commit build due to DAOS_STACK_CI_HARDWARE_SKIP parameter" + stageMessage("Skipping the stage in commit build due to DAOS_STACK_CI_HARDWARE_SKIP parameter") return true } @@ -144,18 +144,18 @@ Map call(Map kwargs = [:]) { // not set. /* groovylint-disable-next-line UnnecessaryGetter */ if (isPr() && !run_if_pr) { - echo "[${env.STAGE_NAME}] Skipping the stage in commit PR build (override with '${commit_pragmas[0]}: false')" + stageMessage("Skipping the stage in commit PR build (override with '${commit_pragmas[0]}: false')") return true } // If the stage is being run in a build started by a commit skip, finally use the stage's // build parameter to determine if the stage should be skipped. if (build_param_value == 'false') { - echo "[${env.STAGE_NAME}] Skipping the stage in commit build due to ${build_param} param" + stageMessage("Skipping the stage in commit build due to ${build_param} param") return true } // Otherwise run the stage - echo "[${env.STAGE_NAME}] Running the stage in a commit build" + stageMessage("Running the stage in a commit build") return false } diff --git a/vars/skipStage.groovy b/vars/skipStage.groovy index c19785500..38ac1492b 100644 --- a/vars/skipStage.groovy +++ b/vars/skipStage.groovy @@ -151,13 +151,24 @@ boolean skip_build_bullseye(String target_branch, String distro) { quickFunctional() } +void report_skip(Boolean skip_stage) { + if(skip_stage) { + stageMessage('Skipping the stage') + } else { + stageMessage('Running the stage') + } + return skip_stage +} + /* groovylint-disable-next-line MethodSize */ boolean call(Map config = [:]) { + stageMessage('Determining if the stage should be skipped') if (config['stage']) { - return skip_stage_pragma(config['stage'], config['def_val']) + return report_skip(skip_stage_pragma(config['stage'], config['def_val'])) } if (stageAlreadyPassed(stage_name: config['stage_name'], postfix: config['axes'])) { + stageMessage('Skipping an already passed stage') return true } @@ -166,121 +177,123 @@ boolean call(Map config = [:]) { switch (env.STAGE_NAME) { case 'Cancel Previous Builds': - return cachedCommitPragma('Cancel-prev-build') == 'false' || - /* groovylint-disable-next-line UnnecessaryGetter */ - (!isPr() && !startedByUpstream()) + return report_skip( + cachedCommitPragma('Cancel-prev-build') == 'false' || + /* groovylint-disable-next-line UnnecessaryGetter */ + (!isPr() && !startedByUpstream())) case 'Check Packaging': - return skip_stage_pragma('packaging-check') + return report_skip(skip_stage_pragma('packaging-check')) case 'Lint': - return quickBuild() + return report_skip(quickBuild()) case 'Pre-build': - return docOnlyChange(target_branch) || - target_branch =~ branchTypeRE('weekly') || - rpmTestVersion() != '' || - quickBuild() + return report_skip( + docOnlyChange(target_branch) || + target_branch =~ branchTypeRE('weekly') || + rpmTestVersion() != '' || + quickBuild()) case 'checkpatch': - return skip_stage_pragma('checkpatch') + return report_skip(skip_stage_pragma('checkpatch')) case 'Python Bandit check': - return skip_stage_pragma('python-bandit') + return report_skip(skip_stage_pragma('python-bandit')) case 'Build': // always build branch landings as we depend on lastSuccessfulBuild // always having RPMs in it - return (env.BRANCH_NAME != target_branch) && - skip_stage_pragma('build') || - rpmTestVersion() != '' || - (quickFunctional() && - prReposContains(null, jobName())) + return report_skip( + (env.BRANCH_NAME != target_branch) && + skip_stage_pragma('build') || + rpmTestVersion() != '' || + (quickFunctional() && prReposContains(null, jobName()))) case 'Build RPM on CentOS 7': - return paramsValue('CI_RPM_centos7_NOBUILD', false) || - (docOnlyChange(target_branch) && - prRepos('centos7') == '') || - prReposContains('centos7', jobName()) || - skip_stage_pragma('build-centos7-rpm') + return report_skip( + paramsValue('CI_RPM_centos7_NOBUILD', false) || + (docOnlyChange(target_branch) && prRepos('centos7') == '') || + prReposContains('centos7', jobName()) || + skip_stage_pragma('build-centos7-rpm')) case 'Build RPM on EL 8': case 'Build RPM on EL 8.5': case 'Build RPM on CentOS 8': - return paramsValue('CI_RPM_el8_NOBUILD', false) || - (docOnlyChange(target_branch) && - prRepos('el8') == '') || - prReposContains('el8', jobName()) || - skip_stage_pragma('build-el8-rpm') + return report_skip( + paramsValue('CI_RPM_el8_NOBUILD', false) || + (docOnlyChange(target_branch) && prRepos('el8') == '') || + prReposContains('el8', jobName()) || + skip_stage_pragma('build-el8-rpm')) case 'Build RPM on EL 9': - return paramsValue('CI_RPM_el9_NOBUILD', false) || - (docOnlyChange(target_branch) && - prRepos('el9') == '') || - prReposContains('el9', jobName()) || - skip_stage_pragma('build-el9-rpm') + return report_skip( + paramsValue('CI_RPM_el9_NOBUILD', false) || + (docOnlyChange(target_branch) && prRepos('el9') == '') || + prReposContains('el9', jobName()) || + skip_stage_pragma('build-el9-rpm')) case 'Build RPM on Leap 15': case 'Build RPM on Leap 15.4': case 'Build RPM on Leap 15.5': - return paramsValue('CI_RPM_leap15_NOBUILD', false) || - target_branch =~ branchTypeRE('weekly') || - (docOnlyChange(target_branch) && - prRepos('leap15') == '') || - prReposContains('leap15', jobName()) || - skip_stage_pragma('build-leap15-rpm') + return report_skip( + paramsValue('CI_RPM_leap15_NOBUILD', false) || + target_branch =~ branchTypeRE('weekly') || + (docOnlyChange(target_branch) && prRepos('leap15') == '') || + prReposContains('leap15', jobName()) || + skip_stage_pragma('build-leap15-rpm')) case 'Build DEB on Ubuntu 20.04': - return paramsValue('CI_RPM_ubuntu20_NOBUILD', false) || - target_branch =~ branchTypeRE('weekly') || - (docOnlyChange(target_branch) && - prRepos('ubuntu20') == '') || - prReposContains('ubuntu20', jobName()) || - skip_stage_pragma('build-ubuntu20-rpm') + return report_skip( + paramsValue('CI_RPM_ubuntu20_NOBUILD', false) || + target_branch =~ branchTypeRE('weekly') || + (docOnlyChange(target_branch) && prRepos('ubuntu20') == '') || + prReposContains('ubuntu20', jobName()) || + skip_stage_pragma('build-ubuntu20-rpm')) case 'Build on CentOS 8': case 'Build on EL 8': case 'Build on EL 8.8': - return skip_build_on_el_gcc(target_branch, '8') + return report_skip(skip_build_on_el_gcc(target_branch, '8')) case 'Build on CentOS 7 Bullseye': - return skip_build_bullseye(target_branch, 'centos7') + return report_skip(skip_build_bullseye(target_branch, 'centos7')) case 'Build on CentOS 8 Bullseye': case 'Build on EL 8 Bullseye': case 'Build on EL 8.8 Bullseye': - return skip_build_bullseye(target_branch, 'el8') + return report_skip(skip_build_bullseye(target_branch, 'el8')) case 'Build on CentOS 7 debug': if (run_default_skipped_stage('build-centos7-gcc-debug')) { - return false + return report_skip(false) } - return paramsValue('CI_BUILD_PACKAGES_ONLY', false) || - (docOnlyChange(target_branch) && - prRepos('centos7') == '') || - quickBuild() + return report_skip( + paramsValue('CI_BUILD_PACKAGES_ONLY', false) || + (docOnlyChange(target_branch) && prRepos('centos7') == '') || + quickBuild()) case 'Build on CentOS 8 debug': case 'Build on EL 8 debug': case 'Build on EL 8.8 debug': - return paramsValue('CI_BUILD_PACKAGES_ONLY', false) || - skip_stage_pragma('build-centos7-gcc-debug') || - (docOnlyChange(target_branch) && - prRepos('el8') == '') || - quickBuild() + return report_skip( + paramsValue('CI_BUILD_PACKAGES_ONLY', false) || + skip_stage_pragma('build-centos7-gcc-debug') || + (docOnlyChange(target_branch) && prRepos('el8') == '') || + quickBuild()) case 'Build on CentOS 7 release': - return paramsValue('CI_BUILD_PACKAGES_ONLY', false) || - skip_stage_pragma('build-centos7-gcc-release', 'true') || - (docOnlyChange(target_branch) && - prRepos('centos7') == '') || - quickBuild() + return report_skip( + paramsValue('CI_BUILD_PACKAGES_ONLY', false) || + skip_stage_pragma('build-centos7-gcc-release', 'true') || + (docOnlyChange(target_branch) && prRepos('centos7') == '') || + quickBuild()) case 'Build on CentOS 7': - return paramsValue('CI_BUILD_PACKAGES_ONLY', false) || - skip_stage_pragma('build-centos7-gcc', 'false') || - (docOnlyChange(target_branch) && - prRepos('centos7') == '') || - quickFunctional() + return report_skip( + paramsValue('CI_BUILD_PACKAGES_ONLY', false) || + skip_stage_pragma('build-centos7-gcc', 'false') || + (docOnlyChange(target_branch) && prRepos('centos7') == '') || + quickFunctional()) case 'Build on CentOS 8 release': case 'Build on EL 8 release': case 'Build on EL 8.8 release': - return paramsValue('CI_BUILD_PACKAGES_ONLY', false) || - skip_stage_pragma('build-el8-gcc-release', 'true') || - (docOnlyChange(target_branch) && - prRepos('el8') == '') || - quickBuild() + return report_skip( + paramsValue('CI_BUILD_PACKAGES_ONLY', false) || + skip_stage_pragma('build-el8-gcc-release', 'true') || + (docOnlyChange(target_branch) && prRepos('el8') == '') || + quickBuild()) case 'Build on CentOS 7 with Clang': case 'Build on CentOS 7 with Clang debug': if (run_default_skipped_stage('build-centos7-clang-debug')) { - return false + return report_skip(false) } - return paramsValue('CI_BUILD_PACKAGES_ONLY', false) || - skip_build_on_landing_branch(target_branch) || - (docOnlyChange(target_branch) && - prRepos('centos7') == '') + return report_skip( + paramsValue('CI_BUILD_PACKAGES_ONLY', false) || + skip_build_on_landing_branch(target_branch) || + (docOnlyChange(target_branch) && prRepos('centos7') == '')) case 'Build on CentOS 8 with Clang': case 'Build on CentOS 8 with Clang debug': case 'Build on EL 8 with Clang': @@ -288,281 +301,279 @@ boolean call(Map config = [:]) { case 'Build on EL 8 with Clang debug': case 'Build on EL 8.8 with Clang debug': if (run_default_skipped_stage('build-el8-clang-debug')) { - return false + return report_skip(false) } - return paramsValue('CI_BUILD_PACKAGES_ONLY', false) || - skip_build_on_landing_branch(target_branch) || - (docOnlyChange(target_branch) && - prRepos('el8') == '') + return report_skip( + paramsValue('CI_BUILD_PACKAGES_ONLY', false) || + skip_build_on_landing_branch(target_branch) || + (docOnlyChange(target_branch) && prRepos('el8') == '')) case 'Build on Ubuntu 20.04': - return paramsValue('CI_BUILD_PACKAGES_ONLY', false) || - skip_build_on_landing_branch(target_branch) || - (docOnlyChange(target_branch) && - prRepos('ubuntu20') == '') + return report_skip( + paramsValue('CI_BUILD_PACKAGES_ONLY', false) || + skip_build_on_landing_branch(target_branch) || + (docOnlyChange(target_branch) && prRepos('ubuntu20') == '')) case 'Build on Leap 15 with Clang': case 'Build on Leap 15.4 with Clang': case 'Build on Leap 15.5 with Clang': - return paramsValue('CI_BUILD_PACKAGES_ONLY', false) || - skip_build_on_landing_branch(target_branch) || - (docOnlyChange(target_branch) && - prRepos('leap15') == '') + return report_skip( + paramsValue('CI_BUILD_PACKAGES_ONLY', false) || + skip_build_on_landing_branch(target_branch) || + (docOnlyChange(target_branch) && prRepos('leap15') == '')) /* groovylint-disable-next-line DuplicateCaseStatement */ case 'Build on CentOS 8': case 'Build on EL 8': - return paramsValue('CI_BUILD_PACKAGES_ONLY', false) || - skip_stage_pragma('build-el8-gcc-dev') || - (docOnlyChange(target_branch) && - prRepos('el8') == '') || - quickBuild() + return report_skip( + paramsValue('CI_BUILD_PACKAGES_ONLY', false) || + skip_stage_pragma('build-el8-gcc-dev') || + (docOnlyChange(target_branch) && + prRepos('el8') == '') || + quickBuild()) case 'Build on Ubuntu 20.04 with Clang': - return paramsValue('CI_BUILD_PACKAGES_ONLY', false) || - target_branch =~ branchTypeRE('weekly') || - skip_stage_pragma('build-ubuntu-clang') || - (docOnlyChange(target_branch) && - prRepos('ubuntu20') == '') || - quickBuild() + return report_skip( + paramsValue('CI_BUILD_PACKAGES_ONLY', false) || + target_branch =~ branchTypeRE('weekly') || + skip_stage_pragma('build-ubuntu-clang') || + (docOnlyChange(target_branch) && prRepos('ubuntu20') == '') || + quickBuild()) case 'Build on Leap 15': case 'Build on Leap 15.4': case 'Build on Leap 15.5': - return paramsValue('CI_BUILD_PACKAGES_ONLY', false) || - skip_stage_pragma('build-leap15-gcc') || - (docOnlyChange(target_branch) && - prRepos('leap15') == '') || - quickBuild() + return report_skip( + paramsValue('CI_BUILD_PACKAGES_ONLY', false) || + skip_stage_pragma('build-leap15-gcc') || + (docOnlyChange(target_branch) && prRepos('leap15') == '') || + quickBuild()) case 'Build on Leap 15 with Intel-C and TARGET_PREFIX': case 'Build on Leap 15.4 with Intel-C and TARGET_PREFIX': case 'Build on Leap 15.5 with Intel-C and TARGET_PREFIX': - return paramsValue('CI_BUILD_PACKAGES_ONLY', false) || - target_branch =~ branchTypeRE('weekly') || - skip_stage_pragma('build-leap15-icc') || - (docOnlyChange(target_branch) && - prRepos('leap15') == '') || - quickBuild() + return report_skip( + paramsValue('CI_BUILD_PACKAGES_ONLY', false) || + target_branch =~ branchTypeRE('weekly') || + skip_stage_pragma('build-leap15-icc') || + (docOnlyChange(target_branch) && prRepos('leap15') == '') || + quickBuild()) case 'Unit Tests': - return env.NO_CI_TESTING == 'true' || - paramsValue('CI_BUILD_PACKAGES_ONLY', false) || - skip_stage_pragma('build') || - rpmTestVersion() != '' || - docOnlyChange(target_branch) || - skip_build_on_el_gcc(target_branch, '8') || - skip_stage_pragma('unit-tests') + return report_skip( + env.NO_CI_TESTING == 'true' || + paramsValue('CI_BUILD_PACKAGES_ONLY', false) || + skip_stage_pragma('build') || + rpmTestVersion() != '' || + docOnlyChange(target_branch) || + skip_build_on_el_gcc(target_branch, '8') || + skip_stage_pragma('unit-tests')) case 'NLT': case 'NLT on CentOS 8': case 'NLT on EL 8': case 'NLT on EL 8.8': - return skip_stage_pragma('nlt') || - quickBuild() || - stageAlreadyPassed() + return report_skip( + skip_stage_pragma('nlt') || + quickBuild() || + stageAlreadyPassed()) case 'Unit Test Bullseye': case 'Unit Test Bullseye on CentOS 8': case 'Unit Test Bullseye on EL 8': case 'Unit Test Bullseye on EL 8.8': - return skip_stage_pragma('bullseye', 'true') || - stageAlreadyPassed() + return report_skip( + skip_stage_pragma('bullseye', 'true') || + stageAlreadyPassed()) case 'Unit Test bdev with memcheck on EL 8': case 'Unit Test bdev with memcheck on EL 8.8': case 'Unit Test with memcheck on CentOS 8': case 'Unit Test with memcheck on EL 8': case 'Unit Test with memcheck on EL 8.8': case 'Unit Test with memcheck': - return !paramsValue('CI_UNIT_TEST_MEMCHECK', true) || - skip_stage_pragma('unit-test-memcheck') || - stageAlreadyPassed() + return report_skip( + !paramsValue('CI_UNIT_TEST_MEMCHECK', true) || + skip_stage_pragma('unit-test-memcheck') || + stageAlreadyPassed()) case 'Unit Test': case 'Unit Test on CentOS 8': case 'Unit Test on EL 8': case 'Unit Test on EL 8.8': case 'Unit Test bdev on EL 8': case 'Unit Test bdev on EL 8.8': - return !paramsValue('CI_UNIT_TEST', true) || - skip_stage_pragma('unit-test') || - skip_stage_pragma('run_test') || - stageAlreadyPassed() + return report_skip( + !paramsValue('CI_UNIT_TEST', true) || + skip_stage_pragma('unit-test') || + skip_stage_pragma('run_test') || + stageAlreadyPassed()) case 'Test': - return env.NO_CI_TESTING == 'true' || - (skip_stage_pragma('build') && - rpmTestVersion() == '') || - skip_stage_pragma('test') || - (env.BRANCH_NAME =~ branchTypeRE('testing') && - !startedByTimer() && - !startedByUpstream() && - !startedByUser()) || - skip_if_unstable() + return report_skip( + env.NO_CI_TESTING == 'true' || + (skip_stage_pragma('build') && rpmTestVersion() == '') || + skip_stage_pragma('test') || + (env.BRANCH_NAME =~ branchTypeRE('testing') && !startedByTimer() && !startedByUpstream() && !startedByUser()) || + skip_if_unstable()) case 'Test on CentOS 7 [in] Vagrant': - return skip_stage_pragma('vagrant-test', 'true') && - !env.BRANCH_NAME =~ branchTypeRE('weekly') || - stageAlreadyPassed() + return report_skip( + skip_stage_pragma('vagrant-test', 'true') && + !env.BRANCH_NAME =~ branchTypeRE('weekly') || + stageAlreadyPassed()) case 'Coverity on CentOS 7': case 'Coverity on CentOS 8': case 'Coverity on EL 8': case 'Coverity on EL 8.8': case 'Coverity': - return paramsValue('CI_BUILD_PACKAGES_ONLY', false) || - rpmTestVersion() != '' || - skip_stage_pragma('coverity-test', 'true') || - quickFunctional() || - docOnlyChange(target_branch) || - skip_stage_pragma('build') + return report_skip( + paramsValue('CI_BUILD_PACKAGES_ONLY', false) || + rpmTestVersion() != '' || + skip_stage_pragma('coverity-test', 'true') || + quickFunctional() || + docOnlyChange(target_branch) || + skip_stage_pragma('build')) case 'Functional on CentOS 7': - return skip_ftest('el7', target_branch, tags) + return report_skip(skip_ftest('el7', target_branch, tags)) case 'Functional on CentOS 7 with Valgrind': - return skip_ftest_valgrind('el7', target_branch, tags) + return report_skip(skip_ftest_valgrind('el7', target_branch, tags)) case 'Functional on CentOS 8 with Valgrind': case 'Functional on EL 8 with Valgrind': case 'Functional on EL 8.8 with Valgrind': - return skip_ftest_valgrind('el8', target_branch, tags) + return report_skip(skip_ftest_valgrind('el8', target_branch, tags)) case 'Functional on CentOS 8': case 'Functional on EL 8': case 'Functional on EL 8.8': - return skip_ftest('el8', target_branch, tags) + return report_skip(skip_ftest('el8', target_branch, tags)) case 'Functional on EL 9': - return skip_ftest('el9', target_branch, tags) + return report_skip(skip_ftest('el9', target_branch, tags)) case 'Functional on Leap 15': case 'Functional on Leap 15.4': case 'Functional on Leap 15.5': - return skip_ftest('leap15', target_branch, tags) + return report_skip(skip_ftest('leap15', target_branch, tags)) case 'Functional on Ubuntu 20.04': /* we don't do any testing on Ubuntu yet skip_ftest('ubuntu20', target_branch, tags) */ - return true + return report_skip(true) case 'Fault injection testing': case 'Fault injection testing on CentOS 8': case 'Fault injection testing on EL 8': case 'Fault injection testing on EL 8.8': - return skip_stage_pragma('fault-injection-test') || - !paramsValue('CI_FI_el8_TEST', true) || - quickFunctional() || - docOnlyChange(target_branch) || - skip_stage_pragma('func-test') || - skip_stage_pragma('func-test-vm') || - stageAlreadyPassed() + return report_skip( + skip_stage_pragma('fault-injection-test') || + !paramsValue('CI_FI_el8_TEST', true) || + quickFunctional() || + docOnlyChange(target_branch) || + skip_stage_pragma('func-test') || + skip_stage_pragma('func-test-vm') || + stageAlreadyPassed()) case 'Test CentOS 7 RPMs': - return !paramsValue('CI_RPMS_el7_TEST', true) || - target_branch =~ branchTypeRE('weekly') || - skip_stage_pragma('test') || - skip_stage_pragma('test-rpms') || - skip_stage_pragma('test-centos-rpms') || - skip_stage_pragma('test-centos-7-rpms') || - docOnlyChange(target_branch) || - (quickFunctional() && - !paramsValue('CI_RPMS_el7_TEST', true) && - !run_default_skipped_stage('test-centos-7-rpms')) || - stageAlreadyPassed() + return report_skip( + !paramsValue('CI_RPMS_el7_TEST', true) || + target_branch =~ branchTypeRE('weekly') || + skip_stage_pragma('test') || + skip_stage_pragma('test-rpms') || + skip_stage_pragma('test-centos-rpms') || + skip_stage_pragma('test-centos-7-rpms') || + docOnlyChange(target_branch) || + (quickFunctional() && !paramsValue('CI_RPMS_el7_TEST', true) && !run_default_skipped_stage('test-centos-7-rpms')) || + stageAlreadyPassed()) case 'Test CentOS 8.3.2011 RPMs': - return !paramsValue('CI_RPMS_centos8.3.2011_TEST', true) || - target_branch =~ branchTypeRE('weekly') || - skip_stage_pragma('test') || - skip_stage_pragma('test-rpms') || - skip_stage_pragma('test-centos-8.3-rpms') || - docOnlyChange(target_branch) || - (quickFunctional() && - !paramsValue('CI_RPMS_el8_3_2011_TEST', true) && - !run_default_skipped_stage('test-centos-8.3-rpms')) || - stageAlreadyPassed() + return report_skip( + !paramsValue('CI_RPMS_centos8.3.2011_TEST', true) || + target_branch =~ branchTypeRE('weekly') || + skip_stage_pragma('test') || + skip_stage_pragma('test-rpms') || + skip_stage_pragma('test-centos-8.3-rpms') || + docOnlyChange(target_branch) || + (quickFunctional() && !paramsValue('CI_RPMS_el8_3_2011_TEST', true) && !run_default_skipped_stage('test-centos-8.3-rpms')) || + stageAlreadyPassed()) case 'Test CentOS 8.4.2105 RPMs': case 'Test EL 8.4 RPMs': - return !paramsValue('CI_RPMS_el8.4.2105_TEST', true) || - target_branch =~ branchTypeRE('weekly') || - skip_stage_pragma('test') || - skip_stage_pragma('test-rpms') || - skip_stage_pragma('test-el-8.4-rpms') || - docOnlyChange(target_branch) || - (quickFunctional() && - !paramsValue('CI_RPMS_el8_4_TEST', true) && - !run_default_skipped_stage('test-el-8.4-rpms')) || - stageAlreadyPassed() + return report_skip( + !paramsValue('CI_RPMS_el8.4.2105_TEST', true) || + target_branch =~ branchTypeRE('weekly') || + skip_stage_pragma('test') || + skip_stage_pragma('test-rpms') || + skip_stage_pragma('test-el-8.4-rpms') || + docOnlyChange(target_branch) || + (quickFunctional() && !paramsValue('CI_RPMS_el8_4_TEST', true) && !run_default_skipped_stage('test-el-8.4-rpms')) || + stageAlreadyPassed()) case 'Test CentOS 8.5.2111 RPMs': case 'Test EL 8.5 RPMs': - return !paramsValue('CI_RPMS_el8.5.2111_TEST', true) || - target_branch =~ branchTypeRE('weekly') || - skip_stage_pragma('test') || - skip_stage_pragma('test-rpms') || - skip_stage_pragma('test-el-8.5-rpms') || - docOnlyChange(target_branch) || - (quickFunctional() && - !paramsValue('CI_RPMS_el8_5_TEST', true) && - !run_default_skipped_stage('test-el-8.5-rpms')) || - stageAlreadyPassed() + return report_skip( + !paramsValue('CI_RPMS_el8.5.2111_TEST', true) || + target_branch =~ branchTypeRE('weekly') || + skip_stage_pragma('test') || + skip_stage_pragma('test-rpms') || + skip_stage_pragma('test-el-8.5-rpms') || + docOnlyChange(target_branch) || + (quickFunctional() && !paramsValue('CI_RPMS_el8_5_TEST', true) && !run_default_skipped_stage('test-el-8.5-rpms')) || + stageAlreadyPassed()) case 'Test EL 8.6 RPMs': case 'Test RPMs on EL 8.6': - return !paramsValue('CI_RPMS_el8.6_TEST', true) || - target_branch =~ branchTypeRE('weekly') || - skip_stage_pragma('test') || - skip_stage_pragma('test-rpms') || - skip_stage_pragma('test-el-8.6-rpms') || - docOnlyChange(target_branch) || - (quickFunctional() && - !paramsValue('CI_RPMS_el8_6_TEST', true) && - !run_default_skipped_stage('test-el-8.6-rpms')) || - (rpmTestVersion() != '') || - stageAlreadyPassed() + return report_skip( + !paramsValue('CI_RPMS_el8.6_TEST', true) || + target_branch =~ branchTypeRE('weekly') || + skip_stage_pragma('test') || + skip_stage_pragma('test-rpms') || + skip_stage_pragma('test-el-8.6-rpms') || + docOnlyChange(target_branch) || + (quickFunctional() && !paramsValue('CI_RPMS_el8_6_TEST', true) && !run_default_skipped_stage('test-el-8.6-rpms')) || + (rpmTestVersion() != '') || + stageAlreadyPassed()) case 'Test Leap 15 RPMs': case 'Test Leap 15.2 RPMs': // Skip by default as it doesn't pass with Leap15.3 due to // requiring a newer glibc - return !paramsValue('CI_RPMS_leap15_TEST', true) || - skip_stage_pragma('test-leap-15-rpms', 'true') || - stageAlreadyPassed() + return report_skip( + !paramsValue('CI_RPMS_leap15_TEST', true) || + skip_stage_pragma('test-leap-15-rpms', 'true') || + stageAlreadyPassed()) case 'Test RPMs on Leap 15.4': - return !paramsValue('CI_RPMS_leap15.4_TEST', true) || - target_branch =~ branchTypeRE('weekly') || - skip_stage_pragma('test') || - skip_stage_pragma('test-rpms') || - skip_stage_pragma('test-leap-15.4-rpms', 'true') || - docOnlyChange(target_branch) || - (quickFunctional() && - !paramsValue('CI_RPMS_leap15_4_TEST', true) && - !run_default_skipped_stage('test-leap-15.4-rpms')) || - (rpmTestVersion() != '') || - stageAlreadyPassed() + return report_skip( + !paramsValue('CI_RPMS_leap15.4_TEST', true) || + target_branch =~ branchTypeRE('weekly') || + skip_stage_pragma('test') || + skip_stage_pragma('test-rpms') || + skip_stage_pragma('test-leap-15.4-rpms', 'true') || + docOnlyChange(target_branch) || + (quickFunctional() && !paramsValue('CI_RPMS_leap15_4_TEST', true) && !run_default_skipped_stage('test-leap-15.4-rpms')) || + (rpmTestVersion() != '') || stageAlreadyPassed()) case 'Scan CentOS 7 RPMs': - return skip_scan_rpms('centos7', target_branch) + return report_skip(skip_scan_rpms('centos7', target_branch)) case 'Scan CentOS 8 RPMs': case 'Scan EL 8 RPMs': - return skip_scan_rpms('el8', target_branch) + return report_skip(skip_scan_rpms('el8', target_branch)) case 'Scan Leap 15 RPMs': case 'Scan Leap 15.4 RPMs': case 'Scan Leap 15.5 RPMs': - return skip_scan_rpms('leap15', target_branch) + return report_skip(skip_scan_rpms('leap15', target_branch)) case 'Test Hardware': - return env.NO_CI_TESTING == 'true' || - skip_stage_pragma('func-test') || - skip_stage_pragma('func-hw-test') || - (skip_stage_pragma('build') && - rpmTestVersion() == '') || - skip_stage_pragma('test') || - (env.BRANCH_NAME =~ branchTypeRE('testing') && - !startedByTimer() && - !startedByUpstream() && - !startedByUser()) || - skip_if_unstable() + return report_skip( + env.NO_CI_TESTING == 'true' || + skip_stage_pragma('func-test') || + skip_stage_pragma('func-hw-test') || + (skip_stage_pragma('build') && rpmTestVersion() == '') || + skip_stage_pragma('test') || + (env.BRANCH_NAME =~ branchTypeRE('testing') && !startedByTimer() && !startedByUpstream() && !startedByUser()) || + skip_if_unstable()) case 'Functional_Hardware_Small': case 'Functional Hardware Small': - return skip_ftest_hw('small', target_branch, tags) + return report_skip(skip_ftest_hw('small', target_branch, tags)) case 'Functional_Hardware_Medium': case 'Functional Hardware Medium': - return skip_ftest_hw('medium', target_branch, tags) + return report_skip(skip_ftest_hw('medium', target_branch, tags)) case 'Functional Hardware Medium TCP Provider': - return skip_ftest_hw('medium-tcp-provider', target_branch, tags) + return report_skip(skip_ftest_hw('medium-tcp-provider', target_branch, tags)) case 'Functional Hardware Medium Verbs Provider': - return skip_ftest_hw('medium-verbs-provider', target_branch, tags) + return report_skip(skip_ftest_hw('medium-verbs-provider', target_branch, tags)) case 'Functional Hardware Medium UCX Provider': - return skip_ftest_hw('medium-ucx-provider', target_branch, tags) + return report_skip(skip_ftest_hw('medium-ucx-provider', target_branch, tags)) case 'Functional_Hardware_Large': case 'Functional Hardware Large': - return skip_ftest_hw('large', target_branch, tags) + return report_skip(skip_ftest_hw('large', target_branch, tags)) case 'Functional_Hardware_24': case 'Functional Hardware 24': - return skip_ftest_hw('24', target_branch, tags) + return report_skip(skip_ftest_hw('24', target_branch, tags)) case 'Bullseye Report': case 'Bullseye Report on CentOS 8': case 'Bullseye Report on EL 8': - return env.BULLSEYE == null || - skip_stage_pragma('bullseye', 'true') + return report_skip( + env.BULLSEYE == null || + skip_stage_pragma('bullseye', 'true')) case 'DAOS Build and Test': - return skip_stage_pragma('daos-build-and-test') + return report_skip(skip_stage_pragma('daos-build-and-test')) default: - println("Don't know how to skip stage \"${env.STAGE_NAME}\", not skipping") - return false + stageMessage("Don't know how to skip stage, not skipping!") + return report_skip(false) } } diff --git a/vars/stageAlreadyPassed.groovy b/vars/stageAlreadyPassed.groovy index 34e8b18df..3dd115e73 100644 --- a/vars/stageAlreadyPassed.groovy +++ b/vars/stageAlreadyPassed.groovy @@ -40,6 +40,7 @@ Boolean call(Map kwargs = [:]) { try { String stage_status = readFile(file: status_file).trim() if (stage_status == 'SUCCESS') { + stageMessage("This stage has already passed") return true } println('Previous run this stage ended with status ' + @@ -75,6 +76,7 @@ Boolean call(Map kwargs = [:]) { validResponseCodes: '100:599') if (response.status == 200 && response.content == 'SUCCESS') { + stageMessage("This stage has already passed") return true } } diff --git a/vars/stageMessage.groovy b/vars/stageMessage.groovy new file mode 100644 index 000000000..4fabe224b --- /dev/null +++ b/vars/stageMessage.groovy @@ -0,0 +1,12 @@ +// vars/stageMessage.groovy + +/** + * stageMessage.groovy + * + * Echo a message for the stage. + * + * @param message String containing the text to display from the stage + */ +Map call(String message) { + echo "[${env.STAGE_NAME}] ${message}" +}