Skip to content

Commit 555d367

Browse files
committed
Applying feedback
Signed-off-by: Phil Henderson <[email protected]>
1 parent 14c8bdf commit 555d367

File tree

2 files changed

+17
-32
lines changed

2 files changed

+17
-32
lines changed

Jenkinsfile

+1-1
Original file line numberDiff line numberDiff line change
@@ -377,7 +377,7 @@ pipeline {
377377
cmp = cmp.replace('@stages.tag@', stage.tag)
378378
// Useful for debugging since Jenkins'
379379
// assert() is pretty lame
380-
// println('assert(' + parseStageInfo()['test_tag'] + " == ${cmp})")
380+
println('assert(' + parseStageInfo()['test_tag'] + " == ${cmp})")
381381
assert(parseStageInfo()['test_tag'] == cmp)
382382
}
383383
}

vars/parseStageInfo.groovy

+16-31
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,12 @@ String get_commit_pragma_tags(String pragma_suffix) {
7070
return pragma_tag
7171
}
7272

73+
String get_param_or_pragma(param, pragma, arg, predefined) {
74+
String res = params.$param ?: cachedCommitPragma(
75+
pragma + result['pragma_suffix'], cachedCommitPragma(pragma, predefined))
76+
77+
return res ? ' ' + arg + '= ' + res : ''
78+
}
7379

7480
/* groovylint-disable-next-line MethodSize */
7581
void call(Map config = [:]) {
@@ -206,9 +212,7 @@ void call(Map config = [:]) {
206212

207213
String cluster_size = ''
208214
String ftest_arg_nvme = ''
209-
String ftest_arg_repeat = ''
210215
String ftest_arg_provider = ''
211-
String ftest_arg_storage_tier = ''
212216
if (stage_name.contains('Functional')) {
213217
result['test'] = 'Functional'
214218
result['node_count'] = 9
@@ -286,39 +290,20 @@ void call(Map config = [:]) {
286290
tag = tag.trim()
287291
}
288292

289-
// Get the ftest --nvme argument from either the build parameters or commit pragmas
290-
ftest_arg_nvme = params.TestNvme ?: cachedCommitPragma(
291-
'Test-nvme' + result['pragma_suffix'], cachedCommitPragma('Test-nvme', ftest_arg_nvme))
292-
293-
// Get the ftest --repeat argument from either the build parameters or commit pragmas
294-
ftest_arg_repeat = params.TestRepeat ?: cachedCommitPragma(
295-
'Test-repeat' + result['pragma_suffix'], cachedCommitPragma('Test-repeat', null))
296-
297-
// Get the ftest --provider argument from either the build parameters or commit pragmas if not
298-
// already defined by the stage
299-
if (!ftest_arg_provider) {
300-
ftest_arg_provider = params.TestProvider ?: cachedCommitPragma(
301-
'Test-provider' + result['pragma_suffix'], cachedCommitPragma('Test-provider', null))
302-
}
303-
304-
// Get the ftest --storage_tier argument from either the build parameters or commit pragmas
305-
ftest_arg_storage_tier = params.TestStorageTier ?: cachedCommitPragma(
306-
'Test-storage-tier' + result['pragma_suffix'], cachedCommitPragma('Test-storage-tier', null))
307-
308-
// Assemble the ftest args
293+
// Assemble the ftest args from either the build parameters or commit pragmas
309294
result['ftest_arg'] = ''
310-
if (ftest_arg_nvme) {
311-
result['ftest_arg'] += ' --nvme=' + ftest_arg_nvme
312-
}
313-
if (ftest_arg_repeat) {
314-
result['ftest_arg'] += ' --repeat=' + ftest_arg_repeat
315-
}
295+
result['ftest_arg'] += get_param_or_pragma('TestNvme', 'Test-nvme', '--nvme', ftest_arg_nvme)
296+
result['ftest_arg'] += get_param_or_pragma('TestRepeat', 'Test-repeat', '--repeat', null)
316297
if (ftest_arg_provider) {
298+
// Use the specific provider defined by the stage
317299
result['ftest_arg'] += ' --provider=' + ftest_arg_provider
300+
} else {
301+
// Only use a build parameter or commit pragma provider for non-provider-specific stages
302+
result['ftest_arg'] += get_param_or_pragma(
303+
'TestProvider', 'Test-provider', '--provider', null)
318304
}
319-
if (ftest_arg_storage_tier) {
320-
result['ftest_arg'] += ' --storage_tier=' + ftest_arg_storage_tier
321-
}
305+
result['ftest_arg'] += get_param_or_pragma(
306+
'TestStorageTier', 'Test-storage-tier', '--storage_tier', null)
322307
if (result['ftest_tag']) {
323308
result['ftest_tag'] = result['ftest_tag'].trim()
324309
}

0 commit comments

Comments
 (0)