Update svn-tag parameter to support all config
Additionally update the plugin to use convert_mapping_to_xml and add min/max tests. Change-Id: I8f0a9054c12ea984a286aea1012513baac07479f Co-Authored-By: Thanh Ha <thanh.ha@linuxfoundation.org> Signed-off-by: Thanh Ha <thanh.ha@linuxfoundation.org>
This commit is contained in:
parent
a23f8bf8db
commit
208527640a
@ -479,10 +479,16 @@ def svn_tags_param(registry, xml_parent, data):
|
||||
<Parameterized+Trigger+Plugin>`.
|
||||
|
||||
:arg str name: the name of the parameter
|
||||
:arg str default: the default value of the parameter (optional)
|
||||
:arg str description: a description of the parameter (optional)
|
||||
:arg str url: the url to list tags from
|
||||
:arg str filter: the regular expression to filter tags
|
||||
:arg str credentials-id: Credentials ID to use for authentication
|
||||
(default '')
|
||||
:arg str filter: the regular expression to filter tags (default '')
|
||||
:arg str default: the default value of the parameter (default '')
|
||||
:arg str description: a description of the parameter (default '')
|
||||
:arg int max-tags: the number of tags to display (default '100')
|
||||
:arg bool sort-newest-first: sort tags from newest to oldest (default true)
|
||||
:arg bool sort-z-to-a: sort tags in reverse alphabetical order
|
||||
(default false)
|
||||
|
||||
Example::
|
||||
|
||||
@ -499,10 +505,11 @@ def svn_tags_param(registry, xml_parent, data):
|
||||
'ListSubversionTagsParameterDefinition')
|
||||
mapping = [
|
||||
('url', 'tagsDir', None),
|
||||
('filter', 'tagsFilter', None),
|
||||
('', 'reverseByDate', "true"),
|
||||
('', 'reverseByName', "false"),
|
||||
('', 'maxTags', "100"),
|
||||
('credentials-id', 'credentialsId', ''),
|
||||
('filter', 'tagsFilter', ''),
|
||||
('max-tags', 'maxTags', '100'),
|
||||
('sort-newest-first', 'reverseByDate', True),
|
||||
('sort-z-to-a', 'reverseByName', False),
|
||||
('', 'uuid', "1-1-1-1-1"),
|
||||
]
|
||||
convert_mapping_to_xml(pdef, data, mapping, fail_required=True)
|
||||
|
21
tests/parameters/fixtures/svn-tags-full.xml
Normal file
21
tests/parameters/fixtures/svn-tags-full.xml
Normal file
@ -0,0 +1,21 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<project>
|
||||
<properties>
|
||||
<hudson.model.ParametersDefinitionProperty>
|
||||
<parameterDefinitions>
|
||||
<hudson.scm.listtagsparameter.ListSubversionTagsParameterDefinition>
|
||||
<name>BRANCH_NAME</name>
|
||||
<description>svn-tags configuration</description>
|
||||
<defaultValue>default-value</defaultValue>
|
||||
<tagsDir>/path/to/svn</tagsDir>
|
||||
<credentialsId>svn-cred</credentialsId>
|
||||
<tagsFilter>v[0-9]+</tagsFilter>
|
||||
<maxTags>25</maxTags>
|
||||
<reverseByDate>false</reverseByDate>
|
||||
<reverseByName>true</reverseByName>
|
||||
<uuid>1-1-1-1-1</uuid>
|
||||
</hudson.scm.listtagsparameter.ListSubversionTagsParameterDefinition>
|
||||
</parameterDefinitions>
|
||||
</hudson.model.ParametersDefinitionProperty>
|
||||
</properties>
|
||||
</project>
|
11
tests/parameters/fixtures/svn-tags-full.yaml
Normal file
11
tests/parameters/fixtures/svn-tags-full.yaml
Normal file
@ -0,0 +1,11 @@
|
||||
parameters:
|
||||
- svn-tags:
|
||||
name: BRANCH_NAME
|
||||
url: '/path/to/svn'
|
||||
credentials-id: svn-cred
|
||||
filter: 'v[0-9]+'
|
||||
default: default-value
|
||||
description: svn-tags configuration
|
||||
max-tags: 25
|
||||
sort-newest-first: False
|
||||
sort-z-to-a: True
|
21
tests/parameters/fixtures/svn-tags-minimal.xml
Normal file
21
tests/parameters/fixtures/svn-tags-minimal.xml
Normal file
@ -0,0 +1,21 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<project>
|
||||
<properties>
|
||||
<hudson.model.ParametersDefinitionProperty>
|
||||
<parameterDefinitions>
|
||||
<hudson.scm.listtagsparameter.ListSubversionTagsParameterDefinition>
|
||||
<name>BRANCH_NAME</name>
|
||||
<description/>
|
||||
<defaultValue/>
|
||||
<tagsDir>/path/to/svn</tagsDir>
|
||||
<credentialsId/>
|
||||
<tagsFilter/>
|
||||
<maxTags>100</maxTags>
|
||||
<reverseByDate>true</reverseByDate>
|
||||
<reverseByName>false</reverseByName>
|
||||
<uuid>1-1-1-1-1</uuid>
|
||||
</hudson.scm.listtagsparameter.ListSubversionTagsParameterDefinition>
|
||||
</parameterDefinitions>
|
||||
</hudson.model.ParametersDefinitionProperty>
|
||||
</properties>
|
||||
</project>
|
4
tests/parameters/fixtures/svn-tags-minimal.yaml
Normal file
4
tests/parameters/fixtures/svn-tags-minimal.yaml
Normal file
@ -0,0 +1,4 @@
|
||||
parameters:
|
||||
- svn-tags:
|
||||
name: BRANCH_NAME
|
||||
url: '/path/to/svn'
|
Loading…
Reference in New Issue
Block a user