Add support for scripts in the inject builder

Sometimes we want to inject environment variables from
different sources, so it's very useful to be able to use
EnvInject's script parameters. This change adds support.

Change-Id: I5b3054c0fa8c5ba45fb3f73ed50a1da52f60fb8e
This commit is contained in:
Mike Heald 2014-08-28 16:00:53 +01:00 committed by Mike Heald
parent e5c0c619ba
commit 482548d865
3 changed files with 10 additions and 0 deletions

View File

@ -383,6 +383,8 @@ def inject(parser, xml_parent, data):
:arg str properties-file: the name of the property file (optional)
:arg str properties-content: the properties content (optional)
:arg str script-file: the name of a script file to run (optional)
:arg str script-content: the script content (optional)
Example:
@ -395,6 +397,10 @@ def inject(parser, xml_parent, data):
info, 'propertiesFilePath', data.get('properties-file'))
jenkins_jobs.modules.base.add_nonblank_xml_subelement(
info, 'propertiesContent', data.get('properties-content'))
jenkins_jobs.modules.base.add_nonblank_xml_subelement(
info, 'scriptFilePath', data.get('script-file'))
jenkins_jobs.modules.base.add_nonblank_xml_subelement(
info, 'scriptContent', data.get('script-content'))
def artifact_resolver(parser, xml_parent, data):

View File

@ -5,6 +5,8 @@
<info>
<propertiesFilePath>example.prop</propertiesFilePath>
<propertiesContent>EXAMPLE=foo-bar</propertiesContent>
<scriptFilePath>script.sh</scriptFilePath>
<scriptContent>script content</scriptContent>
</info>
</EnvInjectBuilder>
</builders>

View File

@ -2,3 +2,5 @@ builders:
- inject:
properties-file: example.prop
properties-content: EXAMPLE=foo-bar
script-file: script.sh
script-content: script content