Allow raw XML at project top-level
This allows a `raw` section at the top-level of a job definition. Change-Id: Id76bbfbde8df49b221fcd1198354ba8b5ce9fb02
This commit is contained in:
parent
556deebe25
commit
a63d3c8d11
@ -95,6 +95,10 @@ Example:
|
||||
history. It adds the ``logrotate`` attribute to the :ref:`Job`
|
||||
definition. All logrotate attributes default to "-1" (keep forever).
|
||||
|
||||
* **raw**:
|
||||
If present, this section should contain a single **xml** entry. This XML
|
||||
will be inserted at the top-level of the :ref:`Job` definition.
|
||||
|
||||
"""
|
||||
|
||||
import xml.etree.ElementTree as XML
|
||||
@ -171,6 +175,9 @@ class General(jenkins_jobs.modules.base.Base):
|
||||
lr_anum = XML.SubElement(lr_xml, 'artifactNumToKeep')
|
||||
lr_anum.text = str(logrotate.get('artifactNumToKeep', -1))
|
||||
|
||||
if 'raw' in data:
|
||||
raw(parser, xml, data['raw'])
|
||||
|
||||
|
||||
def raw(parser, xml_parent, data):
|
||||
# documented in definition.rst since includes and docs is not working well
|
||||
|
13
tests/general/fixtures/raw-xml-toplevel.xml
Normal file
13
tests/general/fixtures/raw-xml-toplevel.xml
Normal file
@ -0,0 +1,13 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<project>
|
||||
<actions/>
|
||||
<keepDependencies>false</keepDependencies>
|
||||
<blockBuildWhenDownstreamBuilding>false</blockBuildWhenDownstreamBuilding>
|
||||
<blockBuildWhenUpstreamBuilding>false</blockBuildWhenUpstreamBuilding>
|
||||
<concurrentBuild>false</concurrentBuild>
|
||||
<canRoam>true</canRoam>
|
||||
<createdByJenkinsAutojobs>
|
||||
<ref>refs/heads/branch</ref>
|
||||
<tag>feature</tag>
|
||||
</createdByJenkinsAutojobs>
|
||||
</project>
|
3
tests/general/fixtures/raw-xml-toplevel.yaml
Normal file
3
tests/general/fixtures/raw-xml-toplevel.yaml
Normal file
@ -0,0 +1,3 @@
|
||||
raw:
|
||||
xml: |
|
||||
<createdByJenkinsAutojobs><ref>refs/heads/branch</ref><tag>feature</tag></createdByJenkinsAutojobs>
|
Loading…
Reference in New Issue
Block a user