Skip to content

Commit

Permalink
DAOS-13527 test: Support default tag assignment through Jenkinsfile
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
phender committed Jun 6, 2023
1 parent 1aed1d4 commit 79f104a
Showing 1 changed file with 31 additions and 23 deletions.
54 changes: 31 additions & 23 deletions vars/parseStageInfo.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -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 <any> defaul_tag defaul_tag
// Manual | Timer None param_tag <any> defaul_tag param_tag
// <any> config_tag <any> <any> <any> 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'
}
}
}
}
Expand Down

0 comments on commit 79f104a

Please sign in to comment.