Add another workaround for snapshots

As there are no parameters in root job
in snapshot jobs, there is a need to parse
fullDisplayName field and remove 9.x from
there.

Change-Id: Ie0c9727743b30030917f0cb5bea9144a7349a01d
Closes-bug: #1603088
This commit is contained in:
Alexandr Kostrikov 2016-07-21 15:55:00 +03:00
parent 36e431f693
commit 62a5f71b3b

View File

@ -152,8 +152,13 @@ def get_version_from_upstream_job(jenkins_build_data):
def get_job_parameter(jenkins_build_data, parameter):
parameters = [a['parameters'] for a in jenkins_build_data['actions']
if 'parameters' in a.keys()][0]
parameters_arr = [a['parameters'] for a in jenkins_build_data['actions']
if 'parameters' in a.keys()]
# NOTE(akostrikov) LP #1603088 The root job is a snapshot job without
# parameters. It has fullDisplayName, which is parse-able.
if len(parameters_arr) == 0:
return jenkins_build_data['fullDisplayName']
parameters = parameters_arr[0]
target_params = [p['value'] for p in parameters
if p['name'].lower() == str(parameter).lower()]
if len(target_params) > 0:
@ -568,14 +573,14 @@ def main():
# NOTE(akostrikov) LP #1603088 When there is a snapshot word in prefix,
# we can skip timestamp part of a test plan name.
if 'snapshot' not in prefix:
if 'snapshot' in prefix:
test_plan_name = ' '.join(
filter(lambda x: bool(x),
(milestone['name'], prefix, 'iso', '#' + str(iso_number))))
(milestone['name'], prefix.replace('9.x.', ''))))
else:
test_plan_name = ' '.join(
filter(lambda x: bool(x),
(milestone['name'], prefix)))
(milestone['name'], prefix, 'iso', '#' + str(iso_number))))
test_plan = project.get_plan_by_name(test_plan_name)