diff --git a/jenkins_jobs/modules/general.py b/jenkins_jobs/modules/general.py
index 51953a269..6248d5533 100644
--- a/jenkins_jobs/modules/general.py
+++ b/jenkins_jobs/modules/general.py
@@ -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
diff --git a/tests/general/fixtures/raw-xml-toplevel.xml b/tests/general/fixtures/raw-xml-toplevel.xml
new file mode 100644
index 000000000..0893bf545
--- /dev/null
+++ b/tests/general/fixtures/raw-xml-toplevel.xml
@@ -0,0 +1,13 @@
+
+
+
+ false
+ false
+ false
+ false
+ true
+
+ [refs/heads/branch]
+ feature
+
+
diff --git a/tests/general/fixtures/raw-xml-toplevel.yaml b/tests/general/fixtures/raw-xml-toplevel.yaml
new file mode 100644
index 000000000..0b3b19d25
--- /dev/null
+++ b/tests/general/fixtures/raw-xml-toplevel.yaml
@@ -0,0 +1,3 @@
+raw:
+ xml: |
+ [refs/heads/branch]feature