-
Notifications
You must be signed in to change notification settings - Fork 738
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow tests targets selection #1300
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -126,9 +126,11 @@ def set_repos_variables() { | |
* if the map contains no mapping for the key. | ||
*/ | ||
def get_value(MAP, KEY) { | ||
for (item in MAP) { | ||
if ("${item.key}" == "${KEY}") { | ||
return "${item.value}" | ||
if (MAP != null) { | ||
for (item in MAP) { | ||
if ("${item.key}" == "${KEY}") { | ||
return "${item.value}" | ||
} | ||
} | ||
} | ||
|
||
|
@@ -141,9 +143,16 @@ def get_value(MAP, KEY) { | |
* Returns empty string if no values is provided in the variables file (not | ||
* required for public repositories). | ||
*/ | ||
def get_git_user_credentials_id () { | ||
if (VARIABLES.user != null) { | ||
return VARIABLES.user.credentials_id | ||
def get_git_user_credentials_id() { | ||
return get_user_credentials_id("git") | ||
} | ||
|
||
/* | ||
* Returns Jenkins credentials ID from the variable file for given key. | ||
*/ | ||
def get_user_credentials_id(KEY) { | ||
if ((VARIABLES.credentials != null) && (VARIABLES.credentials."${KEY}" != null)) { | ||
return VARIABLES.credentials."${KEY}" | ||
} | ||
|
||
return '' | ||
|
@@ -207,6 +216,17 @@ def set_test_variables() { | |
TEST_DEPENDENCIES_JOB_NAME = VARIABLES.test_dependencies_job_name | ||
} | ||
|
||
/* | ||
* Set TESTS_TARGETS, indicating the level of testing. | ||
*/ | ||
def set_test_targets() { | ||
TESTS_TARGETS = params.TESTS_TARGETS | ||
if (!TESTS_TARGETS) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Especially since I got burned by my change in #1320 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. In groovy, both null and the empty string evaluate to false thus the contraption: and the opposite:
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Right. I made the mistake of wrapping quotes around |
||
// set default TESTS_TARGETS for pipeline job (run all tests) | ||
TESTS_TARGETS = "_sanity,_extended" | ||
} | ||
} | ||
|
||
/* | ||
* Initializes all of the required variables for a Jenkins job by given job type. | ||
*/ | ||
|
@@ -240,6 +260,7 @@ def set_job_variables(job_type) { | |
case "pipeline": | ||
// set variables for a pipeline job | ||
set_repos_variables() | ||
set_test_targets() | ||
break | ||
default: | ||
error("Unknown Jenkins job type!") | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Currently, it will not work to pass other targets to internal builds because of this default: handling.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Correct (throws an error).
In order to work with other targets we need Jenkins job[s] and pipeline/groovy scripts that are not available at this moment. As agreed today, we will discuss and address this at a later time (and another PR).