Implements wrapper for ownership plugin.
This wrapper sets "Inject ownership variables into environment" Change-Id: Ib8a37c1a5cd3c6ec35d7fb25fddee82fdeb76aaa
This commit is contained in:
parent
fef529287e
commit
c10c862df4
@ -519,6 +519,31 @@ def inject(parser, xml_parent, data):
|
||||
XML.SubElement(info, 'loadFilesFromMaster').text = 'false'
|
||||
|
||||
|
||||
def inject_ownership_variables(parser, xml_parent, data):
|
||||
"""yaml: inject-ownership-variables
|
||||
Inject ownership variables to the build as environment variables.
|
||||
Requires the Jenkins `EnvInject Plugin and Jenkins Ownership plugin
|
||||
<https://wiki.jenkins-ci.org/display/JENKINS/EnvInject+Plugin>
|
||||
<https://wiki.jenkins-ci.org/display/JENKINS/Ownership+Plugin>`_
|
||||
|
||||
:arg bool job-variables: inject job ownership variables to the job
|
||||
(default false)
|
||||
:arg bool node-variables: inject node ownership variables to the job
|
||||
(default false)
|
||||
|
||||
Example:
|
||||
|
||||
.. literalinclude:: /../../tests/wrappers/fixtures/ownership001.yaml
|
||||
|
||||
"""
|
||||
ownership = XML.SubElement(xml_parent, 'com.synopsys.arc.jenkins.plugins.'
|
||||
'ownership.wrappers.OwnershipBuildWrapper')
|
||||
XML.SubElement(ownership, 'injectNodeOwnership').text = \
|
||||
str(data.get('node-variables', False)).lower()
|
||||
XML.SubElement(ownership, 'injectJobOwnership').text = \
|
||||
str(data.get('job-variables', False)).lower()
|
||||
|
||||
|
||||
def inject_passwords(parser, xml_parent, data):
|
||||
"""yaml: inject-passwords
|
||||
Inject passwords to the build as environment variables.
|
||||
|
@ -191,6 +191,7 @@ jenkins_jobs.wrappers =
|
||||
delivery-pipeline=jenkins_jobs.modules.wrappers:delivery_pipeline
|
||||
env-file=jenkins_jobs.modules.wrappers:env_file
|
||||
exclusion=jenkins_jobs.modules.wrappers:exclusion
|
||||
inject-ownership-variables=jenkins_jobs.modules.wrappers:inject_ownership_variables
|
||||
inject-passwords=jenkins_jobs.modules.wrappers:inject_passwords
|
||||
inject=jenkins_jobs.modules.wrappers:inject
|
||||
jclouds=jenkins_jobs.modules.wrappers:jclouds
|
||||
|
9
tests/wrappers/fixtures/ownership001.xml
Normal file
9
tests/wrappers/fixtures/ownership001.xml
Normal file
@ -0,0 +1,9 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<project>
|
||||
<buildWrappers>
|
||||
<com.synopsys.arc.jenkins.plugins.ownership.wrappers.OwnershipBuildWrapper>
|
||||
<injectNodeOwnership>true</injectNodeOwnership>
|
||||
<injectJobOwnership>true</injectJobOwnership>
|
||||
</com.synopsys.arc.jenkins.plugins.ownership.wrappers.OwnershipBuildWrapper>
|
||||
</buildWrappers>
|
||||
</project>
|
4
tests/wrappers/fixtures/ownership001.yaml
Normal file
4
tests/wrappers/fixtures/ownership001.yaml
Normal file
@ -0,0 +1,4 @@
|
||||
wrappers:
|
||||
- inject-ownership-variables:
|
||||
job-variables: true
|
||||
node-variables: true
|
Loading…
Reference in New Issue
Block a user