Update rich-text-publisher plugin
- update rich-text-publisher plugin to convert xml - add plugin='rich-text-publisher-plugin' - update docstring - update test cases Change-Id: I771b4dcc09b598c193416ce3f3ba48597dc5efad
This commit is contained in:
parent
83114faba6
commit
08113e362a
|
@ -3349,38 +3349,45 @@ def rich_text_publisher(registry, xml_parent, data):
|
|||
Requires the Jenkins :jenkins-wiki:`Rich Text Publisher Plugin
|
||||
<Rich+Text+Publisher+Plugin>`.
|
||||
|
||||
:arg str stable-text: The stable text
|
||||
:arg str stable-text: The stable text (required)
|
||||
:arg str unstable-text: The unstable text if different from stable
|
||||
(default '')
|
||||
(default '')
|
||||
:arg bool unstable-as-stable: The same text block is used for stable and
|
||||
unstable builds (default true)
|
||||
:arg str failed-text: The failed text if different from stable (default '')
|
||||
:arg str parser-name: HTML, Confluence or WikiText
|
||||
:arg bool failed-as-stable: The same text block is used for stable and
|
||||
failed builds (default true)
|
||||
:arg str parser-name: HTML, Confluence or WikiText (default 'WikiText')
|
||||
|
||||
|
||||
Example:
|
||||
Minimal Example:
|
||||
|
||||
.. literalinclude:: /../../tests/publishers/fixtures/richtext001.yaml
|
||||
.. literalinclude:: /../../tests/publishers/fixtures/richtext-minimal.yaml
|
||||
:language: yaml
|
||||
|
||||
Full Example:
|
||||
|
||||
.. literalinclude::
|
||||
/../../tests/publishers/fixtures/richtext-complete.yaml
|
||||
:language: yaml
|
||||
"""
|
||||
|
||||
parsers = ['HTML', 'Confluence', 'WikiText']
|
||||
parser_name = data['parser-name']
|
||||
if parser_name not in parsers:
|
||||
raise JenkinsJobsException('parser-name must be one of: %s' %
|
||||
", ".join(parsers))
|
||||
|
||||
reporter = XML.SubElement(
|
||||
xml_parent,
|
||||
'org.korosoft.jenkins.plugin.rtp.RichTextPublisher')
|
||||
XML.SubElement(reporter, 'stableText').text = data['stable-text']
|
||||
XML.SubElement(reporter, 'unstableText').text =\
|
||||
data.get('unstable-text', '')
|
||||
XML.SubElement(reporter, 'failedText').text = data.get('failed-text', '')
|
||||
XML.SubElement(reporter, 'unstableAsStable').text =\
|
||||
'False' if data.get('unstable-text', '') else 'True'
|
||||
XML.SubElement(reporter, 'failedAsStable').text =\
|
||||
'False' if data.get('failed-text', '') else 'True'
|
||||
XML.SubElement(reporter, 'parserName').text = parser_name
|
||||
reporter.set('plugin', 'rich-text-publisher-plugin')
|
||||
|
||||
mappings = [
|
||||
('stable-text', 'stableText', None),
|
||||
('unstable-text', 'unstableText', ''),
|
||||
('failed-text', 'failedText', ''),
|
||||
('unstable-as-stable', 'unstableAsStable', True),
|
||||
('failed-as-stable', 'failedAsStable', True),
|
||||
('parser-name', 'parserName', 'WikiText', parsers)
|
||||
]
|
||||
helpers.convert_mapping_to_xml(
|
||||
reporter, data, mappings, fail_required=True)
|
||||
|
||||
|
||||
def tap(registry, xml_parent, data):
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<project>
|
||||
<publishers>
|
||||
<org.korosoft.jenkins.plugin.rtp.RichTextPublisher>
|
||||
<org.korosoft.jenkins.plugin.rtp.RichTextPublisher plugin="rich-text-publisher-plugin">
|
||||
<stableText>the stable text</stableText>
|
||||
<unstableText>the unstable text</unstableText>
|
||||
<failedText/>
|
||||
<unstableAsStable>False</unstableAsStable>
|
||||
<failedAsStable>True</failedAsStable>
|
||||
<failedText>the failed text</failedText>
|
||||
<unstableAsStable>false</unstableAsStable>
|
||||
<failedAsStable>false</failedAsStable>
|
||||
<parserName>HTML</parserName>
|
||||
</org.korosoft.jenkins.plugin.rtp.RichTextPublisher>
|
||||
</publishers>
|
|
@ -2,4 +2,7 @@ publishers:
|
|||
- rich-text-publisher:
|
||||
stable-text: the stable text
|
||||
unstable-text: the unstable text
|
||||
failed-text: the failed text
|
||||
unstable-as-stable: false
|
||||
failed-as-stable: false
|
||||
parser-name: HTML
|
|
@ -1,13 +1,13 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<project>
|
||||
<publishers>
|
||||
<org.korosoft.jenkins.plugin.rtp.RichTextPublisher>
|
||||
<org.korosoft.jenkins.plugin.rtp.RichTextPublisher plugin="rich-text-publisher-plugin">
|
||||
<stableText>testing</stableText>
|
||||
<unstableText/>
|
||||
<failedText/>
|
||||
<unstableAsStable>True</unstableAsStable>
|
||||
<failedAsStable>True</failedAsStable>
|
||||
<parserName>HTML</parserName>
|
||||
<unstableAsStable>true</unstableAsStable>
|
||||
<failedAsStable>true</failedAsStable>
|
||||
<parserName>WikiText</parserName>
|
||||
</org.korosoft.jenkins.plugin.rtp.RichTextPublisher>
|
||||
</publishers>
|
||||
</project>
|
|
@ -1,4 +1,3 @@
|
|||
publishers:
|
||||
- rich-text-publisher:
|
||||
stable-text: testing
|
||||
parser-name: HTML
|
Loading…
Reference in New Issue