From 15a0896791009815cfbec6e52bfd832e9cb39b7f Mon Sep 17 00:00:00 2001 From: Ruslan Marinin Date: Thu, 29 Apr 2021 20:24:20 +0300 Subject: [PATCH] fixed broken active choice reactive param after job creation Change-Id: I7e7362a73e9478bdbd445f5178f982afa346f58a --- jenkins_jobs/modules/parameters.py | 6 +++++- .../fixtures/active-choices-reactive-param001.xml | 2 ++ .../fixtures/active-choices-reactive-param002.xml | 2 ++ 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/jenkins_jobs/modules/parameters.py b/jenkins_jobs/modules/parameters.py index 3a6c39b1e..2ae77e79c 100644 --- a/jenkins_jobs/modules/parameters.py +++ b/jenkins_jobs/modules/parameters.py @@ -1310,7 +1310,11 @@ def active_choices_reactive_param(registry, xml_parent, data): __active_choice_param_internal(pdef, data) - mapping = [("referenced-parameters", "referencedParameters", "")] + mapping = [ + ("referenced-parameters", "referencedParameters", ""), + ("random-name", "randomName", "choice-param-{0}".format(data["name"]).lower()), + ("visible-items", "visibleItemCount", 1), + ] helpers.convert_mapping_to_xml(pdef, data, mapping, fail_required=False) XML.SubElement(pdef, "parameters", {"class": "linked-hash-map"}) diff --git a/tests/yamlparser/fixtures/active-choices-reactive-param001.xml b/tests/yamlparser/fixtures/active-choices-reactive-param001.xml index c4f951f51..aef000027 100644 --- a/tests/yamlparser/fixtures/active-choices-reactive-param001.xml +++ b/tests/yamlparser/fixtures/active-choices-reactive-param001.xml @@ -29,6 +29,8 @@ active-choices-job active-choices-job + choice-param-foo + 1 diff --git a/tests/yamlparser/fixtures/active-choices-reactive-param002.xml b/tests/yamlparser/fixtures/active-choices-reactive-param002.xml index b9db3ec0c..16b6bcdd2 100644 --- a/tests/yamlparser/fixtures/active-choices-reactive-param002.xml +++ b/tests/yamlparser/fixtures/active-choices-reactive-param002.xml @@ -51,6 +51,8 @@ active-choices-job active-choices-job foo,bar + choice-param-lorem + 1