Update LogStash plugin to use convert xml
- Fix doc syntax - Add plugin="logstash" attribute Change-Id: Ie5ea7e230d8d406bc0a597da6342a6f36e09b952 Signed-off-by: Kien Ha <kienha9922@gmail.com>
This commit is contained in:
parent
a88104422e
commit
57a0a2235f
@ -5253,28 +5253,31 @@ def logstash(parser, xml_parent, data):
|
|||||||
your job data. Also stores test metrics from Junit.
|
your job data. Also stores test metrics from Junit.
|
||||||
Requires the Jenkins :jenkins-wiki:`Logstash Plugin <Logstash+Plugin>`.
|
Requires the Jenkins :jenkins-wiki:`Logstash Plugin <Logstash+Plugin>`.
|
||||||
|
|
||||||
:arg num max-lines: The maximum number of log lines to send to Logstash.
|
:arg int max-lines: The maximum number of log lines to send to Logstash.
|
||||||
( default 1000 )
|
(default 1000)
|
||||||
:arg bool fail-build: Mark build as failed if this step fails.
|
:arg bool fail-build: Mark build as failed if this step fails.
|
||||||
( default false )
|
(default false)
|
||||||
|
|
||||||
Minimal Example:
|
Minimal Example:
|
||||||
|
|
||||||
.. literalinclude:: /../../tests/publishers/fixtures/logstash-min.yaml
|
.. literalinclude:: /../../tests/publishers/fixtures/logstash-min.yaml
|
||||||
|
:language: yaml
|
||||||
|
|
||||||
Full Example:
|
Full Example:
|
||||||
|
|
||||||
.. literalinclude:: /../../tests/publishers/fixtures/logstash-full.yaml
|
.. literalinclude:: /../../tests/publishers/fixtures/logstash-full.yaml
|
||||||
|
:language: yaml
|
||||||
"""
|
"""
|
||||||
|
|
||||||
logstash = XML.SubElement(xml_parent,
|
logstash = XML.SubElement(xml_parent,
|
||||||
'jenkins.plugins.logstash.LogstashNotifier')
|
'jenkins.plugins.logstash.LogstashNotifier')
|
||||||
XML.SubElement(logstash, 'maxLines').text = str(
|
logstash.set('plugin', 'logstash')
|
||||||
data.get('max-lines', 1000))
|
|
||||||
|
|
||||||
XML.SubElement(logstash, 'failBuild').text = str(
|
mapping = [
|
||||||
data.get('fail-build', False))
|
('max-lines', 'maxLines', 1000),
|
||||||
|
('fail-build', 'failBuild', False),
|
||||||
|
]
|
||||||
|
helpers.convert_mapping_to_xml(logstash, data, mapping, fail_required=True)
|
||||||
|
|
||||||
|
|
||||||
def image_gallery(parser, xml_parent, data):
|
def image_gallery(parser, xml_parent, data):
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<project>
|
<project>
|
||||||
<publishers>
|
<publishers>
|
||||||
<jenkins.plugins.logstash.LogstashNotifier>
|
<jenkins.plugins.logstash.LogstashNotifier plugin="logstash">
|
||||||
<maxLines>2000</maxLines>
|
<maxLines>2000</maxLines>
|
||||||
<failBuild>True</failBuild>
|
<failBuild>true</failBuild>
|
||||||
</jenkins.plugins.logstash.LogstashNotifier>
|
</jenkins.plugins.logstash.LogstashNotifier>
|
||||||
</publishers>
|
</publishers>
|
||||||
</project>
|
</project>
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<project>
|
<project>
|
||||||
<publishers>
|
<publishers>
|
||||||
<jenkins.plugins.logstash.LogstashNotifier>
|
<jenkins.plugins.logstash.LogstashNotifier plugin="logstash">
|
||||||
<maxLines>1000</maxLines>
|
<maxLines>1000</maxLines>
|
||||||
<failBuild>False</failBuild>
|
<failBuild>false</failBuild>
|
||||||
</jenkins.plugins.logstash.LogstashNotifier>
|
</jenkins.plugins.logstash.LogstashNotifier>
|
||||||
</publishers>
|
</publishers>
|
||||||
</project>
|
</project>
|
||||||
|
Loading…
Reference in New Issue
Block a user