diff --git a/jenkins_jobs/modules/wrappers.py b/jenkins_jobs/modules/wrappers.py
index 0d94e2432..fa0212e70 100644
--- a/jenkins_jobs/modules/wrappers.py
+++ b/jenkins_jobs/modules/wrappers.py
@@ -920,15 +920,17 @@ def inject(registry, xml_parent, data):
:arg str script-file: path to the script file (optional)
:arg str script-content: contents of a script (optional)
:arg bool load-from-master: load files from master (default false)
+ :arg str groovy-script: contents of the groovy script (optional)
+ :arg bool groovy-sandbox: use groovy sandbox (default false)
- Example::
+ Minimal Example:
+
+ .. literalinclude:: /../../tests/wrappers/fixtures/inject-minimal.yaml
+
+ Full Example:
+
+ .. literalinclude:: /../../tests/wrappers/fixtures/inject-full.yaml
- wrappers:
- - inject:
- properties-file: /usr/local/foo
- properties-content: PATH=/foo/bar
- script-file: /usr/local/foo.sh
- script-content: echo $PATH
"""
eib = XML.SubElement(xml_parent, 'EnvInjectBuildWrapper')
info = XML.SubElement(eib, 'info')
@@ -941,6 +943,14 @@ def inject(registry, xml_parent, data):
]
convert_mapping_to_xml(info, data, mapping, fail_required=False)
+ secure_groovy_script = XML.SubElement(info, 'secureGroovyScript')
+ mapping = [
+ ('groovy-script', 'script', None),
+ ('groovy-sandbox', 'sandbox', False),
+ ]
+ convert_mapping_to_xml(secure_groovy_script, data, mapping,
+ fail_required=False)
+
def inject_ownership_variables(registry, xml_parent, data):
"""yaml: inject-ownership-variables
diff --git a/tests/wrappers/fixtures/inject-full.xml b/tests/wrappers/fixtures/inject-full.xml
new file mode 100644
index 000000000..260984754
--- /dev/null
+++ b/tests/wrappers/fixtures/inject-full.xml
@@ -0,0 +1,18 @@
+
+
+
+
+
+ example.prop full
+ EXAMPLE=foo-bar full
+ scriptfull.sh
+ test script content full
+ false
+
+
+ true
+
+
+
+
+
\ No newline at end of file
diff --git a/tests/wrappers/fixtures/inject-full.yaml b/tests/wrappers/fixtures/inject-full.yaml
new file mode 100644
index 000000000..b00171812
--- /dev/null
+++ b/tests/wrappers/fixtures/inject-full.yaml
@@ -0,0 +1,8 @@
+wrappers:
+ - inject:
+ properties-file: example.prop full
+ properties-content: EXAMPLE=foo-bar full
+ script-file: scriptfull.sh
+ script-content: test script content full
+ groovy-script: test groovy-script location full
+ groovy-sandbox: true
\ No newline at end of file
diff --git a/tests/wrappers/fixtures/inject-minimal.xml b/tests/wrappers/fixtures/inject-minimal.xml
new file mode 100644
index 000000000..fdf578071
--- /dev/null
+++ b/tests/wrappers/fixtures/inject-minimal.xml
@@ -0,0 +1,13 @@
+
+
+
+
+
+ false
+
+ false
+
+
+
+
+
\ No newline at end of file
diff --git a/tests/wrappers/fixtures/inject-minimal.yaml b/tests/wrappers/fixtures/inject-minimal.yaml
new file mode 100644
index 000000000..ec501151b
--- /dev/null
+++ b/tests/wrappers/fixtures/inject-minimal.yaml
@@ -0,0 +1,2 @@
+wrappers:
+ - inject
\ No newline at end of file