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:
parent
54f4e51b2c
commit
956f0ce4f8
@ -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):
|
||||
|
@ -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>
|
9
tests/properties/fixtures/rebuild-minimal.xml
Normal file
9
tests/properties/fixtures/rebuild-minimal.xml
Normal 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>
|
2
tests/properties/fixtures/rebuild-minimal.yaml
Normal file
2
tests/properties/fixtures/rebuild-minimal.yaml
Normal file
@ -0,0 +1,2 @@
|
||||
properties:
|
||||
- rebuild
|
Loading…
Reference in New Issue
Block a user