Description Setter Plugin support as builder

Change-Id: I8be23bd0f8e9f37f55b8da00be818a4949df89cb
This commit is contained in:
Bertrand Roussel 2016-02-15 13:32:44 -08:00 committed by Bertrand Roussel
parent bd1c93199a
commit 9a7e6ace38
3 changed files with 41 additions and 0 deletions

View File

@ -2873,3 +2873,31 @@ def runscope(parser, xml_parent, data):
except KeyError as e:
raise MissingAttributeError(e.args[0])
XML.SubElement(runscope, 'timeout').text = str(data.get('timeout', '60'))
def description_setter(parser, xml_parent, data):
"""yaml: description-setter
This plugin sets the description for each build,
based upon a RegEx test of the build log file.
Requires the Jenkins :jenkins-wiki:`Description Setter Plugin
<Description+Setter+Plugin>`.
:arg str regexp: A RegEx which is used to scan the build log file
(default '')
:arg str description: The description to set on the build (optional)
Example:
.. literalinclude::
/../../tests/builders/fixtures/description-setter001.yaml
:language: yaml
"""
descriptionsetter = XML.SubElement(
xml_parent,
'hudson.plugins.descriptionsetter.DescriptionSetterBuilder')
XML.SubElement(descriptionsetter, 'regexp').text = data.get('regexp', '')
if 'description' in data:
XML.SubElement(descriptionsetter, 'description').text = data[
'description']

View File

@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<project>
<builders>
<hudson.plugins.descriptionsetter.DescriptionSetterBuilder>
<regexp>.*(&lt;a href=.*a&gt;)</regexp>
<description>some description</description>
</hudson.plugins.descriptionsetter.DescriptionSetterBuilder>
</builders>
</project>

View File

@ -0,0 +1,4 @@
builders:
- description-setter:
regexp: ".*(<a href=.*a>)"
description: "some description"