diff --git a/jenkins_jobs/modules/properties.py b/jenkins_jobs/modules/properties.py index b3bb04faf..6da81bdc5 100644 --- a/jenkins_jobs/modules/properties.py +++ b/jenkins_jobs/modules/properties.py @@ -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 - `. + 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 `. :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): diff --git a/tests/properties/fixtures/rebuild.xml b/tests/properties/fixtures/rebuild-full.xml similarity index 77% rename from tests/properties/fixtures/rebuild.xml rename to tests/properties/fixtures/rebuild-full.xml index 87111ddc0..00be5bab0 100644 --- a/tests/properties/fixtures/rebuild.xml +++ b/tests/properties/fixtures/rebuild-full.xml @@ -1,7 +1,7 @@ - + true true diff --git a/tests/properties/fixtures/rebuild.yaml b/tests/properties/fixtures/rebuild-full.yaml similarity index 100% rename from tests/properties/fixtures/rebuild.yaml rename to tests/properties/fixtures/rebuild-full.yaml diff --git a/tests/properties/fixtures/rebuild-minimal.xml b/tests/properties/fixtures/rebuild-minimal.xml new file mode 100644 index 000000000..e280a20e0 --- /dev/null +++ b/tests/properties/fixtures/rebuild-minimal.xml @@ -0,0 +1,9 @@ + + + + + false + false + + + diff --git a/tests/properties/fixtures/rebuild-minimal.yaml b/tests/properties/fixtures/rebuild-minimal.yaml new file mode 100644 index 000000000..935c02517 --- /dev/null +++ b/tests/properties/fixtures/rebuild-minimal.yaml @@ -0,0 +1,2 @@ +properties: + - rebuild