Add tests for properties inject
Replace hard-coded inject example with a literal include. Extend the example to show how to pass two environment variables. Add test fixtures for the keep-system-variables and keep-build-variables parameters. Change-Id: Ie3b5af2c38f8dde5ff739b9f6b213c1e94387aca
This commit is contained in:
parent
6c02254a0b
commit
9ca0e3c2a6
|
@ -213,7 +213,7 @@ def throttle(parser, xml_parent, data):
|
||||||
|
|
||||||
def inject(parser, xml_parent, data):
|
def inject(parser, xml_parent, data):
|
||||||
"""yaml: inject
|
"""yaml: inject
|
||||||
Allows you to inject evironment variables into the build.
|
Allows you to inject environment variables into the build.
|
||||||
Requires the Jenkins `Env Inject Plugin.
|
Requires the Jenkins `Env Inject Plugin.
|
||||||
<https://wiki.jenkins-ci.org/display/JENKINS/EnvInject+Plugin>`_
|
<https://wiki.jenkins-ci.org/display/JENKINS/EnvInject+Plugin>`_
|
||||||
|
|
||||||
|
@ -227,11 +227,11 @@ def inject(parser, xml_parent, data):
|
||||||
:arg bool keep-system-variables: keep system variables (default true)
|
:arg bool keep-system-variables: keep system variables (default true)
|
||||||
:arg bool keep-build-variables: keep build variable (default true)
|
:arg bool keep-build-variables: keep build variable (default true)
|
||||||
|
|
||||||
Example::
|
Example:
|
||||||
|
|
||||||
|
.. literalinclude:: /../../tests/properties/fixtures/inject001.yaml
|
||||||
|
:language: yaml
|
||||||
|
|
||||||
properties:
|
|
||||||
- inject:
|
|
||||||
properties-content: FOO=bar
|
|
||||||
"""
|
"""
|
||||||
inject = XML.SubElement(xml_parent,
|
inject = XML.SubElement(xml_parent,
|
||||||
'EnvInjectJobProperty')
|
'EnvInjectJobProperty')
|
||||||
|
|
|
@ -0,0 +1,16 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<project>
|
||||||
|
<properties>
|
||||||
|
<EnvInjectJobProperty>
|
||||||
|
<info>
|
||||||
|
<propertiesContent>FOO=bar
|
||||||
|
BAZ=foobar
|
||||||
|
</propertiesContent>
|
||||||
|
<loadFilesFromMaster>false</loadFilesFromMaster>
|
||||||
|
</info>
|
||||||
|
<on>true</on>
|
||||||
|
<keepJenkinsSystemVariables>true</keepJenkinsSystemVariables>
|
||||||
|
<keepBuildVariables>true</keepBuildVariables>
|
||||||
|
</EnvInjectJobProperty>
|
||||||
|
</properties>
|
||||||
|
</project>
|
|
@ -0,0 +1,5 @@
|
||||||
|
properties:
|
||||||
|
- inject:
|
||||||
|
properties-content: |
|
||||||
|
FOO=bar
|
||||||
|
BAZ=foobar
|
|
@ -0,0 +1,13 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<project>
|
||||||
|
<properties>
|
||||||
|
<EnvInjectJobProperty>
|
||||||
|
<info>
|
||||||
|
<loadFilesFromMaster>false</loadFilesFromMaster>
|
||||||
|
</info>
|
||||||
|
<on>true</on>
|
||||||
|
<keepJenkinsSystemVariables>true</keepJenkinsSystemVariables>
|
||||||
|
<keepBuildVariables>true</keepBuildVariables>
|
||||||
|
</EnvInjectJobProperty>
|
||||||
|
</properties>
|
||||||
|
</project>
|
|
@ -0,0 +1,3 @@
|
||||||
|
properties:
|
||||||
|
- inject:
|
||||||
|
enabled: true
|
|
@ -0,0 +1,13 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<project>
|
||||||
|
<properties>
|
||||||
|
<EnvInjectJobProperty>
|
||||||
|
<info>
|
||||||
|
<loadFilesFromMaster>false</loadFilesFromMaster>
|
||||||
|
</info>
|
||||||
|
<on>true</on>
|
||||||
|
<keepJenkinsSystemVariables>false</keepJenkinsSystemVariables>
|
||||||
|
<keepBuildVariables>false</keepBuildVariables>
|
||||||
|
</EnvInjectJobProperty>
|
||||||
|
</properties>
|
||||||
|
</project>
|
|
@ -0,0 +1,4 @@
|
||||||
|
properties:
|
||||||
|
- inject:
|
||||||
|
keep-build-variables: false
|
||||||
|
keep-system-variables: false
|
Loading…
Reference in New Issue