diff --git a/Jenkinsfile b/Jenkinsfile index c004cc6b4..bc68749bb 100755 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -336,7 +336,7 @@ pipeline { // lots more test cases could be cooked up, to be sure script { stages = [[name: 'Fake CentOS 7 Functional stage', - tag: '-hw'], + tag: '-hw',], [name: 'Fake CentOS 7 Functional Hardware Medium stage', tag: 'hw,medium,-provider'], [name: 'Fake CentOS 7 Functional Hardware Medium Provider stage', diff --git a/vars/parseStageInfo.groovy b/vars/parseStageInfo.groovy index 8bae10561..edee5a324 100755 --- a/vars/parseStageInfo.groovy +++ b/vars/parseStageInfo.groovy @@ -70,6 +70,14 @@ String get_commit_pragma_tags(String pragma_suffix) { return pragma_tag } +String get_param_or_pragma(param, pragma, pragma_suffix, launch_arg, predefined) { + // Get the launch.py argument value from either the build parameter, stage-specific commit + // pragma, general commit pragma, or predefined value + String res = params.$param ?: cachedCommitPragma( + pragma + pragma_suffix, cachedCommitPragma(pragma, predefined)) + + return res ? ' ' + launch_arg + '= ' + res : '' +} /* groovylint-disable-next-line MethodSize */ void call(Map config = [:]) { @@ -206,7 +214,6 @@ void call(Map config = [:]) { String cluster_size = '' String ftest_arg_nvme = '' - String ftest_arg_repeat = '' String ftest_arg_provider = '' if (stage_name.contains('Functional')) { result['test'] = 'Functional' @@ -285,32 +292,22 @@ void call(Map config = [:]) { tag = tag.trim() } - // Get the ftest --nvme argument from either the build parameters or commit pragmas - ftest_arg_nvme = params.TestNvme ?: cachedCommitPragma( - 'Test-nvme' + result['pragma_suffix'], cachedCommitPragma('Test-nvme', ftest_arg_nvme)) - - // Get the ftest --repeat argument from either the build parameters or commit pragmas - ftest_arg_repeat = params.TestRepeat ?: cachedCommitPragma( - 'Test-repeat' + result['pragma_suffix'], cachedCommitPragma('Test-repeat', null)) - - // Get the ftest --provider argument from either the build parameters or commit pragmas if not - // already defined by the stage - if (!ftest_arg_provider) { - ftest_arg_provider = params.TestProvider ?: cachedCommitPragma( - 'Test-provider' + result['pragma_suffix'], cachedCommitPragma('Test-provider', null)) - } - - // Assemble the ftest args + // Assemble the ftest args from either the build parameters or commit pragmas result['ftest_arg'] = '' - if (ftest_arg_nvme) { - result['ftest_arg'] += ' --nvme=' + ftest_arg_nvme - } - if (ftest_arg_repeat) { - result['ftest_arg'] += ' --repeat=' + ftest_arg_repeat - } + result['ftest_arg'] += get_param_or_pragma( + 'TestNvme', 'Test-nvme', result['pragma_suffix'],'--nvme', ftest_arg_nvme) + result['ftest_arg'] += get_param_or_pragma( + 'TestRepeat', 'Test-repeat', result['pragma_suffix'], '--repeat', null) if (ftest_arg_provider) { + // Use the specific provider defined by the stage result['ftest_arg'] += ' --provider=' + ftest_arg_provider + } else { + // Only use a build parameter or commit pragma provider for non-provider-specific stages + result['ftest_arg'] += get_param_or_pragma( + 'TestProvider', 'Test-provider', result['pragma_suffix'], '--provider', null) } + result['ftest_arg'] += get_param_or_pragma( + 'TestStorageTier', 'Test-storage-tier', result['pragma_suffix'], '--storage_tier', null) if (result['ftest_tag']) { result['ftest_tag'] = result['ftest_tag'].trim() }