Update rebuild plugin to use convert xml

- Rename test file to be more descriptive
- Add minimal test file
- Add plugin="rebuild" attribute
- Add plugin desciption to doc

Change-Id: I466d8fed4c4167b9693ae3bb369611ef4b63e318
Signed-off-by: Kien Ha <kienha9922@gmail.com>
This commit is contained in:
Kien Ha 2016-07-25 15:47:53 -04:00
parent 54f4e51b2c
commit 956f0ce4f8
5 changed files with 30 additions and 10 deletions

View File

@ -748,27 +748,36 @@ def slack(registry, xml_parent, data):
def rebuild(registry, xml_parent, data):
"""yaml: rebuild
Requires the Jenkins :jenkins-wiki:`Rebuild Plugin
<Rebuild+Plugin>`.
This plug-in allows the user to rebuild a parameterized build without
entering the parameters again.It will also allow the user to edit the
parameters before rebuilding.
Requires the Jenkins :jenkins-wiki:`Rebuild Plugin <Rebuild+Plugin>`.
:arg bool auto-rebuild: Rebuild without asking for parameters
(default false)
:arg bool rebuild-disabled: Disable rebuilding for this job
(default false)
Example:
Minimal Example:
.. literalinclude::
/../../tests/properties/fixtures/rebuild.yaml
.. literalinclude:: /../../tests/properties/fixtures/rebuild-minimal.yaml
:language: yaml
Full Example:
.. literalinclude:: /../../tests/properties/fixtures/rebuild-full.yaml
:language: yaml
"""
sub_element = XML.SubElement(xml_parent,
'com.sonyericsson.rebuild.RebuildSettings')
sub_element.set('plugin', 'rebuild')
XML.SubElement(sub_element, 'autoRebuild').text = str(
data.get('auto-rebuild', False)).lower()
XML.SubElement(sub_element, 'rebuildDisabled').text = str(
data.get('rebuild-disabled', False)).lower()
mapping = [
('auto-rebuild', 'autoRebuild', False),
('rebuild-disabled', 'rebuildDisabled', False),
]
helpers.convert_mapping_to_xml(
sub_element, data, mapping, fail_required=True)
def build_discarder(registry, xml_parent, data):

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<project>
<properties>
<com.sonyericsson.rebuild.RebuildSettings>
<com.sonyericsson.rebuild.RebuildSettings plugin="rebuild">
<autoRebuild>true</autoRebuild>
<rebuildDisabled>true</rebuildDisabled>
</com.sonyericsson.rebuild.RebuildSettings>

View File

@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<project>
<properties>
<com.sonyericsson.rebuild.RebuildSettings plugin="rebuild">
<autoRebuild>false</autoRebuild>
<rebuildDisabled>false</rebuildDisabled>
</com.sonyericsson.rebuild.RebuildSettings>
</properties>
</project>

View File

@ -0,0 +1,2 @@
properties:
- rebuild