add two new options to Log Parser Plugin
Support both global and per-project rules, and the showGraphs option, both of which became possible in the 2.0 release: https://github.com/jenkinsci/log-parser-plugin/compare/log-parser-1.0.8...log-parser-2.0ecde717b9b
6e75ecc8f9
Change-Id: I38b0058467d16ca7e3c4d3dc4edb2c9294551f15
This commit is contained in:
parent
a5eb235881
commit
d3307d6938
@ -2335,23 +2335,39 @@ def logparser(registry, xml_parent, data):
|
||||
Requires the Jenkins :jenkins-wiki:`Log Parser Plugin <Log+Parser+Plugin>`.
|
||||
|
||||
:arg str parse-rules: full path to parse rules (default '')
|
||||
:arg bool use-project-rules: use project rules instead of global
|
||||
(default true)
|
||||
:arg bool unstable-on-warning: mark build unstable on warning
|
||||
(default false)
|
||||
:arg bool fail-on-error: mark build failed on error (default false)
|
||||
:arg bool show-graphs: show parser trend graphs (default true)
|
||||
|
||||
Example:
|
||||
|
||||
.. literalinclude:: /../../tests/publishers/fixtures/logparser001.yaml
|
||||
|
||||
Minimal Example:
|
||||
|
||||
.. literalinclude:: /../../tests/publishers/fixtures/logparser-minimal.yaml
|
||||
:language: yaml
|
||||
|
||||
Full Example:
|
||||
|
||||
.. literalinclude:: /../../tests/publishers/fixtures/logparser-full.yaml
|
||||
:language: yaml
|
||||
"""
|
||||
|
||||
clog = XML.SubElement(xml_parent,
|
||||
'hudson.plugins.logparser.LogParserPublisher')
|
||||
clog.set('plugin', 'log-parser')
|
||||
rules_path_element = ("projectRulePath"
|
||||
if data.get("use-project-rules", True)
|
||||
else "parsingRulesPath")
|
||||
mappings = [
|
||||
('unstable-on-warning', 'unstableOnWarning', False),
|
||||
('fail-on-error', 'failBuildOnError', False),
|
||||
('parse-rules', 'parsingRulesPath', '')
|
||||
('show-graphs', 'showGraphs', True),
|
||||
('use-project-rules', 'useProjectRule', True),
|
||||
('parse-rules', rules_path_element, ''),
|
||||
]
|
||||
helpers.convert_mapping_to_xml(clog, data, mappings, fail_required=True)
|
||||
|
||||
|
@ -4,7 +4,9 @@
|
||||
<hudson.plugins.logparser.LogParserPublisher plugin="log-parser">
|
||||
<unstableOnWarning>true</unstableOnWarning>
|
||||
<failBuildOnError>true</failBuildOnError>
|
||||
<parsingRulesPath>/path/to/parserules</parsingRulesPath>
|
||||
<showGraphs>false</showGraphs>
|
||||
<useProjectRule>false</useProjectRule>
|
||||
<parsingRulesPath>/path/to/global-rules</parsingRulesPath>
|
||||
</hudson.plugins.logparser.LogParserPublisher>
|
||||
</publishers>
|
||||
</project>
|
7
tests/publishers/fixtures/logparser-full.yaml
Normal file
7
tests/publishers/fixtures/logparser-full.yaml
Normal file
@ -0,0 +1,7 @@
|
||||
publishers:
|
||||
- logparser:
|
||||
use-project-rules: false
|
||||
parse-rules: "/path/to/global-rules"
|
||||
unstable-on-warning: true
|
||||
fail-on-error: true
|
||||
show-graphs: false
|
12
tests/publishers/fixtures/logparser-minimal.xml
Normal file
12
tests/publishers/fixtures/logparser-minimal.xml
Normal file
@ -0,0 +1,12 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<project>
|
||||
<publishers>
|
||||
<hudson.plugins.logparser.LogParserPublisher plugin="log-parser">
|
||||
<unstableOnWarning>false</unstableOnWarning>
|
||||
<failBuildOnError>false</failBuildOnError>
|
||||
<showGraphs>true</showGraphs>
|
||||
<useProjectRule>true</useProjectRule>
|
||||
<projectRulePath>project-log-parser-rules.txt</projectRulePath>
|
||||
</hudson.plugins.logparser.LogParserPublisher>
|
||||
</publishers>
|
||||
</project>
|
3
tests/publishers/fixtures/logparser-minimal.yaml
Normal file
3
tests/publishers/fixtures/logparser-minimal.yaml
Normal file
@ -0,0 +1,3 @@
|
||||
publishers:
|
||||
- logparser:
|
||||
parse-rules: "project-log-parser-rules.txt"
|
@ -1,5 +0,0 @@
|
||||
publishers:
|
||||
- logparser:
|
||||
parse-rules: "/path/to/parserules"
|
||||
unstable-on-warning: true
|
||||
fail-on-error: true
|
Loading…
Reference in New Issue
Block a user