Added support for Rich Text Publisher Plugin

This commit adds support for the Rich Text Publisher Plugin avaiable at
https://wiki.jenkins-ci.org/display/JENKINS/Rich+Text+Publisher+Plugin

Change-Id: Id3bf21dfe8ae5a6392fb15334461b0ce4a95e1ae
This commit is contained in:
mlua 2014-10-23 10:08:22 +02:00
parent 3bf5bde63f
commit 3b79764615
6 changed files with 78 additions and 0 deletions

View File

@ -2230,6 +2230,48 @@ def html_publisher(parser, xml_parent, data):
XML.SubElement(ptarget, 'wrapperName').text = "htmlpublisher-wrapper.html"
def rich_text_publisher(parser, xml_parent, data):
"""yaml: rich_text_publisher
This plugin puts custom rich text message to the Build pages and Job main
page.
Requires the Jenkins `Rich Text Publisher Plugin.
<https://wiki.jenkins-ci.org/display/JENKINS/Rich+Text+Publisher+Plugin>`_
:arg str stable-text: The stable text
:arg str unstable-text: The unstable text if different from stable
(default '')
:arg str failed-text: The failed text if different from stable (default '')
:arg str parser-name: HTML, Confluence or WikiText
Example:
.. literalinclude:: /../../tests/publishers/fixtures/richtext001.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
def tap(parser, xml_parent, data):
"""yaml: tap
Adds support to TAP test result files

View File

@ -149,6 +149,7 @@ jenkins_jobs.publishers =
pmd=jenkins_jobs.modules.publishers:pmd
post-tasks=jenkins_jobs.modules.publishers:post_tasks
postbuildscript=jenkins_jobs.modules.publishers:postbuildscript
rich-text-publisher=jenkins_jobs.modules.publishers:rich_text_publisher
robot=jenkins_jobs.modules.publishers:robot
ruby-metrics=jenkins_jobs.modules.publishers:ruby_metrics
scp=jenkins_jobs.modules.publishers:scp

View File

@ -0,0 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<project>
<publishers>
<org.korosoft.jenkins.plugin.rtp.RichTextPublisher>
<stableText>testing</stableText>
<unstableText/>
<failedText/>
<unstableAsStable>True</unstableAsStable>
<failedAsStable>True</failedAsStable>
<parserName>HTML</parserName>
</org.korosoft.jenkins.plugin.rtp.RichTextPublisher>
</publishers>
</project>

View File

@ -0,0 +1,4 @@
publishers:
- rich-text-publisher:
stable-text: testing
parser-name: HTML

View File

@ -0,0 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<project>
<publishers>
<org.korosoft.jenkins.plugin.rtp.RichTextPublisher>
<stableText>the stable text</stableText>
<unstableText>the unstable text</unstableText>
<failedText/>
<unstableAsStable>False</unstableAsStable>
<failedAsStable>True</failedAsStable>
<parserName>HTML</parserName>
</org.korosoft.jenkins.plugin.rtp.RichTextPublisher>
</publishers>
</project>

View File

@ -0,0 +1,5 @@
publishers:
- rich-text-publisher:
stable-text: the stable text
unstable-text: the unstable text
parser-name: HTML