From 79f104a6be4dfd33ba4a1adea7826b4ccaad62ac Mon Sep 17 00:00:00 2001 From: Phil Henderson Date: Tue, 6 Jun 2023 15:11:08 -0400 Subject: [PATCH] DAOS-13527 test: Support default tag assignment through Jenkinsfile The test tags to use the functional test stages should be driven by the method through which the user has started the build. If the build has been built with parameters or started by a timer then the parameters of that build should drive the test tag selection. If the user pushes a PR then any tags defined via commit pragmas should be used followed by the any build parameter tags. Signed-off-by: Phil Henderson --- vars/parseStageInfo.groovy | 54 ++++++++++++++++++++++---------------- 1 file changed, 31 insertions(+), 23 deletions(-) diff --git a/vars/parseStageInfo.groovy b/vars/parseStageInfo.groovy index c641e4652..398cbe660 100755 --- a/vars/parseStageInfo.groovy +++ b/vars/parseStageInfo.groovy @@ -274,34 +274,42 @@ Map call(Map config = [:]) { } // Determine which tests tags to use - String tag - if (startedByUser() || startedByUpstream()) { - // Test tags defined by the build parameters override all other tags - tag = get_build_params_tags() - } - if (!tag && startedByTimer()) { - // Stage defined tags take precedence in timed builds - tag = config['test_tag'] - if (!tag) { - // Otherwise use the default timed build tags - tag = 'pr daily_regression' - if (env.BRANCH_NAME.startsWith('weekly-testing')) { - tag = 'full_regression' + // config Build Param Commit Pragma + // Started by 'test_tag' (TestTag) (Test-tag) Default Use + // -------------- ---------- ---------- ------------- ---------- ---------- + // PR | Upstream None None None defaul_tag defaul_tag + // PR | Upstream None None commit_tag defaul_tag commit_tag + // PR | Upstream None param_tag None defaul_tag param_tag + // PR | Upstream None param_tag commit_tag defaul_tag commit_tag + // Manual | Timer None None defaul_tag defaul_tag + // Manual | Timer None param_tag defaul_tag param_tag + // config_tag config_tag + // + String tag = config['test_tag'] + if (!tag) { + if (startedByUser() || startedByTimer()) { + // Get tags from the build parameters + tag = get_build_params_tags() + if (!tag) { + // Default to the pr tag for any other build stage + tag = 'pr' } } - } else if (!tag) { - if (env.BRANCH_NAME.matches(testBranchRE())) { - tag = 'always_passes' - } else { - // Tags defined by commit pragmas have priority in user PRs + else { + // Get tags from the commit pragmas tag = get_commit_pragma_tags(result['pragma_suffix']) if (!tag) { - // Followed by stage defined tags - tag = config['test_tag'] - /* groovylint-disable-next-line CouldBeElvis */ + // Get tags from the build parameters + tag = get_build_params_tags() if (!tag) { - // Otherwise use the default PR tag - tag = 'pr' + if (startedByUpstream()) { + // Default to run simple tests for dowstream builds + tag = 'always_passes' + } + else { + // Default to the pr tag for any other build stage + tag = 'pr' + } } } }