Update logparser plugin

- update logparser plugin to user convert xml
- update logparser docstring

Change-Id: I13b36024bcaa3cfca2c8f2d3530bbc31dc9f52a8
This commit is contained in:
Dong Ma 2016-09-28 23:50:31 -07:00
parent 0ece25ced4
commit a07c886c89
2 changed files with 11 additions and 9 deletions

View File

@ -2146,9 +2146,10 @@ def logparser(registry, xml_parent, data):
"""yaml: logparser
Requires the Jenkins :jenkins-wiki:`Log Parser Plugin <Log+Parser+Plugin>`.
:arg str parse-rules: full path to parse rules
:arg str parse-rules: full path to parse rules (default '')
:arg bool unstable-on-warning: mark build unstable on warning
:arg bool fail-on-error: mark build failed on error
(default false)
:arg bool fail-on-error: mark build failed on error (default false)
Example:
@ -2158,12 +2159,13 @@ def logparser(registry, xml_parent, data):
clog = XML.SubElement(xml_parent,
'hudson.plugins.logparser.LogParserPublisher')
XML.SubElement(clog, 'unstableOnWarning').text = \
str(data.get('unstable-on-warning', False)).lower()
XML.SubElement(clog, 'failBuildOnError').text = \
str(data.get('fail-on-error', False)).lower()
# v1.08: this must be the full path, the name of the rules is not enough
XML.SubElement(clog, 'parsingRulesPath').text = data.get('parse-rules', '')
clog.set('plugin', 'log-parser')
mappings = [
('unstable-on-warning', 'unstableOnWarning', False),
('fail-on-error', 'failBuildOnError', False),
('parse-rules', 'parsingRulesPath', '')
]
helpers.convert_mapping_to_xml(clog, data, mappings, fail_required=True)
def copy_to_master(registry, xml_parent, data):

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<project>
<publishers>
<hudson.plugins.logparser.LogParserPublisher>
<hudson.plugins.logparser.LogParserPublisher plugin="log-parser">
<unstableOnWarning>true</unstableOnWarning>
<failBuildOnError>true</failBuildOnError>
<parsingRulesPath>/path/to/parserules</parsingRulesPath>