Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions vars/functionalTest.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,8 @@
*
* config['ftest_arg'] Functional test launch.py arguments.
* Default determined by parseStageInfo().
*
* config['details_stash'] Stash name for functional test details.
*/

Map call(Map config = [:]) {
Expand Down Expand Up @@ -113,6 +115,8 @@ Map call(Map config = [:]) {
run_test_config['ftest_arg'] = config.get('ftest_arg', stage_info['ftest_arg'])
run_test_config['context'] = context
run_test_config['description'] = description
run_test_config['details_stash'] = config.get(
'details_stash', 'func' + stage_info['pragma_suffix'] + '-details')

String script = 'if ! pip3 install'
script += ''' --upgrade --upgrade-strategy only-if-needed launchable; then
Expand Down
5 changes: 4 additions & 1 deletion vars/getFunctionalTestStage.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import org.jenkinsci.plugins.pipeline.modeldefinition.Utils
* 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
* details_stash Stash name for functional test details.
* @return a scripted stage to run in a pipeline
*/
Map call(Map kwargs = [:]) {
Expand All @@ -42,6 +43,7 @@ Map call(Map kwargs = [:]) {
Boolean run_if_pr = kwargs.get('run_if_pr', false)
Boolean run_if_landing = kwargs.get('run_if_landing', false)
Map job_status = kwargs.get('job_status', [:])
String details_stash = kwargs.get('details_stash', '')

return {
stage("${name}") {
Expand Down Expand Up @@ -89,7 +91,8 @@ Map call(Map kwargs = [:]) {
nvme: nvme,
default_nvme: default_nvme,
provider: provider)['ftest_arg'],
test_function: 'runTestFunctionalV2'))
test_function: 'runTestFunctionalV2',
details_stash: details_stash))
} finally {
println("[${name}] Running functionalTestPostV2()")
functionalTestPostV2()
Expand Down
56 changes: 56 additions & 0 deletions vars/getSummaryStage.groovy
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
// vars/getSummaryStage.groovy

/**
* getSummaryStage.groovy
*
* Get a functional test stage in scripted syntax.
*
* @param kwargs Map containing the following optional arguments (empty strings yield defaults):
* name name of the stage
* docker_filename docker filename
* script_stashes list of stash names to access with runScriptWithStashes
* script_name shell script to run with runScriptWithStashes
* script_label label to use when running the script in runScriptWithStashes
* artifacts artifacts to archive
* job_status Map of status for each stage in the job/build
* @return a scripted stage to run in a pipeline
*/

List call(Map kwargs = [:]) {
String name = kwargs.get('name', 'Unknown Summary Stage')
String docker_filename = kwargs.get('docker_filename', 'utils/docker/Dockerfile.el.8')
List script_stashes = kwargs.get('script_stashes', [])
String script_name = kwargs.get('script_name', 'ci/functional_test_summary.sh')
String script_label = kwargs.get('script_label', 'Generate Functional Test Summary')
String artifacts = kwargs.get('artifacts', 'unknown_test_summary/*')
Map job_status = kwargs.get('job_status', [:])

return {
stage("${name}") {
agent {
dockerfile {
filename docker_filename
label 'docker_runner'
additionalBuildArgs dockerBuildArgs(add_repos: false)
}
try {
job_step_update(
job_status,
name,
runScriptWithStashes(
stashes: script_stashes,
script: script_name,
label: script_label
)
)
}
finally {
always {
archiveArtifacts(artifacts: artifacts, allowEmptyArchive: false)
job_status_update(job_status, name)
}
}
}
}
}
}
8 changes: 8 additions & 0 deletions vars/runTest.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ Map call(Map config = [:]) {
*
* config['description'] Description to report for SCM status.
* Default env.STAGE_NAME.
*
* config['details_stash'] Stash name for functional test details.
*/

// Todo
Expand Down Expand Up @@ -140,6 +142,12 @@ Map call(Map config = [:]) {
Date endDate = new Date()
int runTime = durationSeconds(startDate, endDate)

if (config['details_stash']) {
// Stash the launch.py generated details.json for the functional test stage
stash name: config['details_stash'],
includes: '**/details.json'
}

// We need to pass the rc to the post step.
Map results = ['result_code': rc,
'result': status,
Expand Down
3 changes: 3 additions & 0 deletions vars/runTestFunctionalV2.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ Map call(Map config = [:]) {
*
* config['description'] Description to report for SCM status.
* Default env.STAGE_NAME.
*
* config['details_stash'] Stash name for functional test details.
*/

Map stage_info = parseStageInfo(config)
Expand Down Expand Up @@ -97,5 +99,6 @@ Map call(Map config = [:]) {
String name = 'func' + stage_info['pragma_suffix'] + '-cov'
stash name: config.get('coverage_stash', name),
includes: covfile

return runData
}