diff --git a/vars/getFunctionalTestStage.groovy b/vars/getFunctionalTestStage.groovy index c69185e32..5f9308cda 100644 --- a/vars/getFunctionalTestStage.groovy +++ b/vars/getFunctionalTestStage.groovy @@ -25,6 +25,7 @@ import org.jenkinsci.plugins.pipeline.modeldefinition.Utils * rpmDistValue(distro) * base_branch if specified, checkout sources from this branch before running tests * other_packages space-separated string of additional RPM packages to install + * runStage whether or not to run the stage; overrides skipFunctionalTestStage() * run_if_pr whether or not the stage should run for PR builds * run_if_landing whether or not the stage should run for landing builds * job_status Map of status for each stage in the job/build @@ -47,6 +48,14 @@ Map call(Map kwargs = [:]) { String other_packages = kwargs.get('other_packages', '') Boolean run_if_pr = kwargs.get('run_if_pr', false) Boolean run_if_landing = kwargs.get('run_if_landing', false) + + // Temporarily use a String to allow determing if the value was unset, but when used pass the + // value in as a Boolean. This allows stages that have not yet been converted to use runStage + // to be skipped by the existing skipFunctionalTestStage logic, while new stages can use + // runStage directly. Once all stages have been converted to use runStage, this should be + // changed to a Boolean. + String runStage = kwargs.get('runStage', 'undefined').toString() + Map job_status = kwargs.get('job_status', [:]) return { @@ -57,57 +66,69 @@ Map call(Map kwargs = [:]) { String tags = getFunctionalTags( pragma_suffix: pragma_suffix, stage_tags: stage_tags, default_tags: default_tags) - Map skip_kwargs = [ + if (runStage == 'false') { + println("[${name}] Stage skipped by runStage=false") + Utils.markStageSkippedForConditional("${name}") + return + } else if (runStage == 'undefined') { + // To be removed once all stages have been converted to use runStage. + Map skip_kwargs = [ 'tags': tags, 'pragma_suffix': pragma_suffix, 'distro': distro, 'run_if_pr': run_if_pr, 'run_if_landing': run_if_landing] - if (skipFunctionalTestStage(skip_kwargs)) { - println("[${name}] Stage skipped by skipFunctionalTestStage()") + if (skipFunctionalTestStage(skip_kwargs)) { + println("[${name}] Stage skipped by skipFunctionalTestStage()") + Utils.markStageSkippedForConditional("${name}") + return + } + } else if (!testsInStage(tags)) { + println("[${name}] Stage skipped by no tests matching the '${tags}' tags") Utils.markStageSkippedForConditional("${name}") - } else { - node(cachedCommitPragma("Test-label${pragma_suffix}", label)) { - // Ensure access to any branch provisioning scripts exist - println("[${name}] Check out '${base_branch}' from version control") - if (base_branch) { - checkoutScm( - url: 'https://github.com/daos-stack/daos.git', - branch: base_branch, - withSubmodules: false, - pruneStaleBranch: true) - } else { - checkoutScm(pruneStaleBranch: true) - } + return + } + + node(cachedCommitPragma("Test-label${pragma_suffix}", label)) { + // Ensure access to any branch provisioning scripts exist + println("[${name}] Check out '${base_branch}' from version control") + if (base_branch) { + checkoutScm( + url: 'https://github.com/daos-stack/daos.git', + branch: base_branch, + withSubmodules: false, + pruneStaleBranch: true) + } else { + checkoutScm(pruneStaleBranch: true) + } - try { - println("[${name}] Running functionalTest() on ${label} with tags=${tags}") - jobStatusUpdate( - job_status, - name, - functionalTest( - image_version: image_version, - inst_repos: daosRepos(distro), - inst_rpms: functionalPackages( - clientVersion: 1, - nextVersion: next_version, - addDaosPkgs: 'tests-internal', - rpmDistribution: rpm_distro) + ' ' + other_packages, - test_tag: tags, - ftest_arg: getFunctionalArgs( - pragma_suffix: pragma_suffix, - nvme: nvme, - default_nvme: default_nvme, - provider: provider)['ftest_arg'], - test_function: 'runTestFunctionalV2')) - } finally { - println("[${name}] Running functionalTestPostV2()") - functionalTestPostV2() - jobStatusUpdate(job_status, name) - } + try { + println("[${name}] Running functionalTest() on ${label} with tags=${tags}") + jobStatusUpdate( + job_status, + name, + functionalTest( + image_version: image_version, + inst_repos: daosRepos(distro), + inst_rpms: functionalPackages( + clientVersion: 1, + nextVersion: next_version, + addDaosPkgs: 'tests-internal', + rpmDistribution: rpm_distro) + ' ' + other_packages, + test_tag: tags, + ftest_arg: getFunctionalArgs( + pragma_suffix: pragma_suffix, + nvme: nvme, + default_nvme: default_nvme, + provider: provider)['ftest_arg'], + test_function: 'runTestFunctionalV2')) + } finally { + println("[${name}] Running functionalTestPostV2()") + functionalTestPostV2() + jobStatusUpdate(job_status, name) } } - println("[${name}] Finished with ${job_status}") } + println("[${name}] Finished with ${job_status}") } } diff --git a/vars/unitPackages.groovy b/vars/unitPackages.groovy index 2c59cfd11..1baa0b74c 100644 --- a/vars/unitPackages.groovy +++ b/vars/unitPackages.groovy @@ -26,16 +26,8 @@ String call(Map config = [:]) { Map stage_info = parseStageInfo(config) String target = stage_info['target'] - boolean quick_build = quickBuild() - if (target.startsWith('centos') || target.startsWith('el')) { - if (quick_build) { - // the script run below will read from this file - unstash target + '-required-mercury-rpm-version' - } - - return sh(script: "${script} ${target} " + - String.valueOf(quick_build), + return sh(script: "${script} ${target}", returnStdout: true) } error 'unitPackages not implemented for ' + target