Merge "Improve support for EnvInject plugin"
This commit is contained in:
commit
d9c6655389
@ -920,15 +920,17 @@ def inject(registry, xml_parent, data):
|
|||||||
:arg str script-file: path to the script file (optional)
|
:arg str script-file: path to the script file (optional)
|
||||||
:arg str script-content: contents of a script (optional)
|
:arg str script-content: contents of a script (optional)
|
||||||
:arg bool load-from-master: load files from master (default false)
|
: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')
|
eib = XML.SubElement(xml_parent, 'EnvInjectBuildWrapper')
|
||||||
info = XML.SubElement(eib, 'info')
|
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)
|
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):
|
def inject_ownership_variables(registry, xml_parent, data):
|
||||||
"""yaml: inject-ownership-variables
|
"""yaml: inject-ownership-variables
|
||||||
|
18
tests/wrappers/fixtures/inject-full.xml
Normal file
18
tests/wrappers/fixtures/inject-full.xml
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<project>
|
||||||
|
<buildWrappers>
|
||||||
|
<EnvInjectBuildWrapper>
|
||||||
|
<info>
|
||||||
|
<propertiesFilePath>example.prop full</propertiesFilePath>
|
||||||
|
<propertiesContent>EXAMPLE=foo-bar full</propertiesContent>
|
||||||
|
<scriptFilePath>scriptfull.sh</scriptFilePath>
|
||||||
|
<scriptContent>test script content full</scriptContent>
|
||||||
|
<loadFilesFromMaster>false</loadFilesFromMaster>
|
||||||
|
<secureGroovyScript>
|
||||||
|
<script>test groovy-script location full</script>
|
||||||
|
<sandbox>true</sandbox>
|
||||||
|
</secureGroovyScript>
|
||||||
|
</info>
|
||||||
|
</EnvInjectBuildWrapper>
|
||||||
|
</buildWrappers>
|
||||||
|
</project>
|
8
tests/wrappers/fixtures/inject-full.yaml
Normal file
8
tests/wrappers/fixtures/inject-full.yaml
Normal file
@ -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
|
13
tests/wrappers/fixtures/inject-minimal.xml
Normal file
13
tests/wrappers/fixtures/inject-minimal.xml
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<project>
|
||||||
|
<buildWrappers>
|
||||||
|
<EnvInjectBuildWrapper>
|
||||||
|
<info>
|
||||||
|
<loadFilesFromMaster>false</loadFilesFromMaster>
|
||||||
|
<secureGroovyScript>
|
||||||
|
<sandbox>false</sandbox>
|
||||||
|
</secureGroovyScript>
|
||||||
|
</info>
|
||||||
|
</EnvInjectBuildWrapper>
|
||||||
|
</buildWrappers>
|
||||||
|
</project>
|
2
tests/wrappers/fixtures/inject-minimal.yaml
Normal file
2
tests/wrappers/fixtures/inject-minimal.yaml
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
wrappers:
|
||||||
|
- inject
|
Loading…
Reference in New Issue
Block a user