Update description_setter plugin
- update description_setter plugin to use convert xml - update test cases - update docstring Change-Id: Ibbbdadceda0b6de6bc488727a90eee1a6ddb9463
This commit is contained in:
parent
f34a8bd02e
commit
6ffb66c94f
@ -4550,35 +4550,40 @@ def description_setter(registry, xml_parent, data):
|
||||
<Description+Setter+Plugin>`.
|
||||
|
||||
:arg str regexp: A RegEx which is used to scan the build log file
|
||||
(default '')
|
||||
:arg str regexp-for-failed: A RegEx which is used for failed builds
|
||||
(optional)
|
||||
(default '')
|
||||
:arg str description: The description to set on the build (optional)
|
||||
:arg str description-for-failed: The description to set on
|
||||
the failed builds (optional)
|
||||
:arg bool set-for-matrix: Also set the description on
|
||||
a multi-configuration build (default false)
|
||||
|
||||
Example:
|
||||
Minimal Example:
|
||||
|
||||
.. literalinclude::
|
||||
/../../tests/publishers/fixtures/description-setter001.yaml
|
||||
/../../tests/publishers/fixtures/description-setter-minimal.yaml
|
||||
:language: yaml
|
||||
|
||||
Full Example:
|
||||
|
||||
.. literalinclude::
|
||||
/../../tests/publishers/fixtures/description-setter-full.yaml
|
||||
:language: yaml
|
||||
"""
|
||||
|
||||
descriptionsetter = XML.SubElement(
|
||||
xml_parent,
|
||||
'hudson.plugins.descriptionsetter.DescriptionSetterPublisher')
|
||||
XML.SubElement(descriptionsetter, 'regexp').text = data.get('regexp', '')
|
||||
XML.SubElement(descriptionsetter, 'regexpForFailed').text = \
|
||||
data.get('regexp-for-failed', '')
|
||||
if 'description' in data:
|
||||
XML.SubElement(descriptionsetter, 'description').text = \
|
||||
data['description']
|
||||
if 'description-for-failed' in data:
|
||||
XML.SubElement(descriptionsetter, 'descriptionForFailed').text = \
|
||||
data['description-for-failed']
|
||||
for_matrix = str(data.get('set-for-matrix', False)).lower()
|
||||
XML.SubElement(descriptionsetter, 'setForMatrix').text = for_matrix
|
||||
mappings = [
|
||||
('regexp', 'regexp', ''),
|
||||
('regexp-for-failed', 'regexpForFailed', ''),
|
||||
('description', 'description', None),
|
||||
('description-for-failed', 'descriptionForFailed', None),
|
||||
('set-for-matrix', 'setForMatrix', False)
|
||||
]
|
||||
helpers.convert_mapping_to_xml(
|
||||
descriptionsetter, data, mappings, fail_required=False)
|
||||
|
||||
|
||||
def doxygen(registry, xml_parent, data):
|
||||
|
10
tests/publishers/fixtures/description-setter-minimal.xml
Normal file
10
tests/publishers/fixtures/description-setter-minimal.xml
Normal file
@ -0,0 +1,10 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<project>
|
||||
<publishers>
|
||||
<hudson.plugins.descriptionsetter.DescriptionSetterPublisher>
|
||||
<regexp/>
|
||||
<regexpForFailed/>
|
||||
<setForMatrix>false</setForMatrix>
|
||||
</hudson.plugins.descriptionsetter.DescriptionSetterPublisher>
|
||||
</publishers>
|
||||
</project>
|
@ -0,0 +1,2 @@
|
||||
publishers:
|
||||
- description-setter
|
@ -1,12 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<project>
|
||||
<publishers>
|
||||
<hudson.plugins.descriptionsetter.DescriptionSetterPublisher>
|
||||
<regexp>.*(<a href=.*a>)</regexp>
|
||||
<regexpForFailed>.*(<a href=.*a>)</regexpForFailed>
|
||||
<description>こんにちは</description>
|
||||
<descriptionForFailed>さようなら</descriptionForFailed>
|
||||
<setForMatrix>true</setForMatrix>
|
||||
</hudson.plugins.descriptionsetter.DescriptionSetterPublisher>
|
||||
</publishers>
|
||||
</project>
|
@ -1,7 +0,0 @@
|
||||
publishers:
|
||||
- description-setter:
|
||||
regexp: ".*(<a href=.*a>)"
|
||||
regexp-for-failed: ".*(<a href=.*a>)"
|
||||
description: "こんにちは"
|
||||
description-for-failed: "さようなら"
|
||||
set-for-matrix: true
|
Loading…
Reference in New Issue
Block a user