add support for EnvInject mask password params option
Added support for EnvInject mask password params option Added unit test to cover inject_passwords in wrappers module Change-Id: Ic6eb44cc6946f3f4636212868b6665dbde853c40
This commit is contained in:
parent
4bf020e07e
commit
42670e9772
@ -600,23 +600,22 @@ def inject_passwords(parser, xml_parent, data):
|
|||||||
<https://wiki.jenkins-ci.org/display/JENKINS/EnvInject+Plugin>`_
|
<https://wiki.jenkins-ci.org/display/JENKINS/EnvInject+Plugin>`_
|
||||||
|
|
||||||
:arg bool global: inject global passwords to the job
|
:arg bool global: inject global passwords to the job
|
||||||
|
:arg bool mask-password-params: mask passsword parameters
|
||||||
:arg list job-passwords: key value pair of job passwords
|
:arg list job-passwords: key value pair of job passwords
|
||||||
|
|
||||||
:Parameter: * **name** (`str`) Name of password
|
:Parameter: * **name** (`str`) Name of password
|
||||||
* **password** (`str`) Encrypted password
|
* **password** (`str`) Encrypted password
|
||||||
|
|
||||||
Example::
|
Example:
|
||||||
|
|
||||||
|
.. literalinclude:: /../../tests/wrappers/fixtures/passwords001.yaml
|
||||||
|
|
||||||
wrappers:
|
|
||||||
- inject-passwords:
|
|
||||||
global: true
|
|
||||||
job-passwords:
|
|
||||||
- name: ADMIN
|
|
||||||
password: 0v8ZCNaHwq1hcx+sHwRLdg9424uBh4Pin0zO4sBIb+U=
|
|
||||||
"""
|
"""
|
||||||
eib = XML.SubElement(xml_parent, 'EnvInjectPasswordWrapper')
|
eib = XML.SubElement(xml_parent, 'EnvInjectPasswordWrapper')
|
||||||
XML.SubElement(eib, 'injectGlobalPasswords').text = \
|
XML.SubElement(eib, 'injectGlobalPasswords').text = \
|
||||||
str(data.get('global', False)).lower()
|
str(data.get('global', False)).lower()
|
||||||
|
XML.SubElement(eib, 'maskPasswordParameters').text = \
|
||||||
|
str(data.get('mask-password-params', False)).lower()
|
||||||
entries = XML.SubElement(eib, 'passwordEntries')
|
entries = XML.SubElement(eib, 'passwordEntries')
|
||||||
passwords = data.get('job-passwords', [])
|
passwords = data.get('job-passwords', [])
|
||||||
if passwords:
|
if passwords:
|
||||||
|
15
tests/wrappers/fixtures/passwords001.xml
Normal file
15
tests/wrappers/fixtures/passwords001.xml
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<project>
|
||||||
|
<buildWrappers>
|
||||||
|
<EnvInjectPasswordWrapper>
|
||||||
|
<injectGlobalPasswords>true</injectGlobalPasswords>
|
||||||
|
<maskPasswordParameters>true</maskPasswordParameters>
|
||||||
|
<passwordEntries>
|
||||||
|
<EnvInjectPasswordEntry>
|
||||||
|
<name>ADMIN</name>
|
||||||
|
<value>0v8ZCNaHwq1hcx+sHwRLdg9424uBh4Pin0zO4sBIb+U=</value>
|
||||||
|
</EnvInjectPasswordEntry>
|
||||||
|
</passwordEntries>
|
||||||
|
</EnvInjectPasswordWrapper>
|
||||||
|
</buildWrappers>
|
||||||
|
</project>
|
8
tests/wrappers/fixtures/passwords001.yaml
Normal file
8
tests/wrappers/fixtures/passwords001.yaml
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
wrappers:
|
||||||
|
- inject-passwords:
|
||||||
|
global: true
|
||||||
|
mask-password-params: true
|
||||||
|
job-passwords:
|
||||||
|
- name: ADMIN
|
||||||
|
password: 0v8ZCNaHwq1hcx+sHwRLdg9424uBh4Pin0zO4sBIb+U=
|
||||||
|
|
Loading…
Reference in New Issue
Block a user