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):
|
||||
"""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.
|
||||
<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-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,
|
||||
'EnvInjectJobProperty')
|
||||
|
16
tests/properties/fixtures/inject001.xml
Normal file
16
tests/properties/fixtures/inject001.xml
Normal file
@ -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>
|
5
tests/properties/fixtures/inject001.yaml
Normal file
5
tests/properties/fixtures/inject001.yaml
Normal file
@ -0,0 +1,5 @@
|
||||
properties:
|
||||
- inject:
|
||||
properties-content: |
|
||||
FOO=bar
|
||||
BAZ=foobar
|
13
tests/properties/fixtures/inject002.xml
Normal file
13
tests/properties/fixtures/inject002.xml
Normal file
@ -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>
|
3
tests/properties/fixtures/inject002.yaml
Normal file
3
tests/properties/fixtures/inject002.yaml
Normal file
@ -0,0 +1,3 @@
|
||||
properties:
|
||||
- inject:
|
||||
enabled: true
|
13
tests/properties/fixtures/inject003.xml
Normal file
13
tests/properties/fixtures/inject003.xml
Normal file
@ -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>
|
4
tests/properties/fixtures/inject003.yaml
Normal file
4
tests/properties/fixtures/inject003.yaml
Normal file
@ -0,0 +1,4 @@
|
||||
properties:
|
||||
- inject:
|
||||
keep-build-variables: false
|
||||
keep-system-variables: false
|
Loading…
Reference in New Issue
Block a user