Add value description feature to extended choice parameter
Current version of Extended Choice Parameter jenkins plugin has a feature which you could give descriptions to assign descriptions to choice values. However current version of jenknis-job-builder does no support this feature. Add this feature into this commit. It will introduce three new xml nodes to the generated xml: <descriptionPropertyValue/> comma separated list of value descriptions <descriptionPropertyFile/> description property file <descriptionPropertyKey/> key in the description property file Change-Id: Ie464a510edf01e21c7e96df2003f2c5f7fb15720
This commit is contained in:
parent
bbed0ffbcd
commit
134364c3cc
jenkins_jobs/modules
tests/parameters/fixtures
@ -293,10 +293,16 @@ def extended_choice_param(parser, xml_parent, data):
|
||||
or multi-select box (optional, default '')
|
||||
:arg str default-value: used to set the initial selection of the
|
||||
single-select or multi-select box (optional, default '')
|
||||
:arg str value-description: comma separated list of value descriptions
|
||||
for the single select or multi-select box (optional, default '')
|
||||
:arg str default-property-file: location of property file when default
|
||||
value needs to come from a property file (optional, default '')
|
||||
:arg str default-property-key: key for the default property file
|
||||
(optional, default '')
|
||||
:arg str description-property-file: location of property file when value
|
||||
description needs to come from a property file (optional, default '')
|
||||
:arg str description-property-key: key for the value description
|
||||
property file (optional, default '')
|
||||
:arg str multi-select-delimiter: value between selections when the
|
||||
parameter is a multi-select (optiona, default ',')
|
||||
|
||||
@ -320,7 +326,8 @@ def extended_choice_param(parser, xml_parent, data):
|
||||
False)).lower()
|
||||
XML.SubElement(pdef, 'defaultValue').text = data.get(
|
||||
'default-value', '')
|
||||
|
||||
XML.SubElement(pdef, 'descriptionPropertyValue').text = data.get(
|
||||
'value-description', '')
|
||||
choice = data.get('type', 'single-select')
|
||||
choicedict = {'single-select': 'PT_SINGLE_SELECT',
|
||||
'multi-select': 'PT_MULTI_SELECT',
|
||||
@ -345,6 +352,10 @@ def extended_choice_param(parser, xml_parent, data):
|
||||
'default-property-file', '')
|
||||
XML.SubElement(pdef, 'defaultPropertyKey').text = data.get(
|
||||
'default-property-key', '')
|
||||
XML.SubElement(pdef, 'descriptionPropertyFile').text = data.get(
|
||||
'description-property-file', '')
|
||||
XML.SubElement(pdef, 'descriptionPropertyKey').text = data.get(
|
||||
'description-property-key', '')
|
||||
|
||||
|
||||
def validating_string_param(parser, xml_parent, data):
|
||||
|
@ -11,11 +11,14 @@
|
||||
<multiSelectDelimiter>,</multiSelectDelimiter>
|
||||
<quoteValue>false</quoteValue>
|
||||
<defaultValue/>
|
||||
<descriptionPropertyValue/>
|
||||
<type>PT_CHECKBOX</type>
|
||||
<propertyFile/>
|
||||
<propertyKey/>
|
||||
<defaultPropertyFile/>
|
||||
<defaultPropertyKey/>
|
||||
<descriptionPropertyFile/>
|
||||
<descriptionPropertyKey/>
|
||||
</com.cwctravel.hudson.plugins.extended__choice__parameter.ExtendedChoiceParameterDefinition>
|
||||
</parameterDefinitions>
|
||||
</hudson.model.ParametersDefinitionProperty>
|
||||
|
@ -11,11 +11,14 @@
|
||||
<multiSelectDelimiter>|</multiSelectDelimiter>
|
||||
<quoteValue>true</quoteValue>
|
||||
<defaultValue>foo</defaultValue>
|
||||
<descriptionPropertyValue/>
|
||||
<type>PT_MULTI_SELECT</type>
|
||||
<propertyFile>/home/foo/property.prop</propertyFile>
|
||||
<propertyKey>key</propertyKey>
|
||||
<defaultPropertyFile>/home/property.prop</defaultPropertyFile>
|
||||
<defaultPropertyKey>fookey</defaultPropertyKey>
|
||||
<descriptionPropertyFile/>
|
||||
<descriptionPropertyKey/>
|
||||
</com.cwctravel.hudson.plugins.extended__choice__parameter.ExtendedChoiceParameterDefinition>
|
||||
</parameterDefinitions>
|
||||
</hudson.model.ParametersDefinitionProperty>
|
||||
|
26
tests/parameters/fixtures/extended-choice-param003.xml
Normal file
26
tests/parameters/fixtures/extended-choice-param003.xml
Normal file
@ -0,0 +1,26 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<project>
|
||||
<properties>
|
||||
<hudson.model.ParametersDefinitionProperty>
|
||||
<parameterDefinitions>
|
||||
<com.cwctravel.hudson.plugins.extended__choice__parameter.ExtendedChoiceParameterDefinition>
|
||||
<name>OPTIONS</name>
|
||||
<description>Available options</description>
|
||||
<value/>
|
||||
<visibleItemCount>2</visibleItemCount>
|
||||
<multiSelectDelimiter>,</multiSelectDelimiter>
|
||||
<quoteValue>false</quoteValue>
|
||||
<defaultValue>foo</defaultValue>
|
||||
<descriptionPropertyValue>bar1, bar2, bar3</descriptionPropertyValue>
|
||||
<type>PT_SINGLE_SELECT</type>
|
||||
<propertyFile>/home/foo/property.prop</propertyFile>
|
||||
<propertyKey>key</propertyKey>
|
||||
<defaultPropertyFile>/home/property.prop</defaultPropertyFile>
|
||||
<defaultPropertyKey>fookey</defaultPropertyKey>
|
||||
<descriptionPropertyFile>/home/foo/bar.properties</descriptionPropertyFile>
|
||||
<descriptionPropertyKey>bar_desc</descriptionPropertyKey>
|
||||
</com.cwctravel.hudson.plugins.extended__choice__parameter.ExtendedChoiceParameterDefinition>
|
||||
</parameterDefinitions>
|
||||
</hudson.model.ParametersDefinitionProperty>
|
||||
</properties>
|
||||
</project>
|
13
tests/parameters/fixtures/extended-choice-param003.yaml
Normal file
13
tests/parameters/fixtures/extended-choice-param003.yaml
Normal file
@ -0,0 +1,13 @@
|
||||
parameters:
|
||||
- extended-choice:
|
||||
name: OPTIONS
|
||||
description: "Available options"
|
||||
property-file: /home/foo/property.prop
|
||||
property-key: key
|
||||
visible-items: 2
|
||||
default-value: foo
|
||||
default-property-file: /home/property.prop
|
||||
default-property-key: fookey
|
||||
description-property-file: /home/foo/bar.properties
|
||||
description-property-key: bar_desc
|
||||
value-description: bar1, bar2, bar3
|
Loading…
x
Reference in New Issue
Block a user