Update stash plugin

- update stash plugin to convert xml
- update test cases

Change-Id: I55ce1ee25700200869c711e81f80df3f0b5fc7b3
This commit is contained in:
Dong Ma 2017-06-25 16:16:55 +08:00
parent de631d49d3
commit d0ce567efb
5 changed files with 50 additions and 8 deletions

View File

@ -4417,9 +4417,14 @@ def stash(registry, xml_parent, data):
:arg bool include-build-number: Include build number in key
(default false)
Example:
Minimal Example:
.. literalinclude:: /../../tests/publishers/fixtures/stash001.yaml
.. literalinclude:: /../../tests/publishers/fixtures/stash-minimal.yaml
:language: yaml
Full Example:
.. literalinclude:: /../../tests/publishers/fixtures/stash-full.yaml
:language: yaml
"""
top = XML.SubElement(xml_parent,
@ -4436,12 +4441,13 @@ def stash(registry, xml_parent, data):
XML.SubElement(top, 'stashUserPassword'
).text = helpers.get_value_from_yaml_or_config_file(
'password', 'stash', data, registry.jjb_config)
XML.SubElement(top, 'ignoreUnverifiedSSLPeer').text = str(
data.get('ignore-ssl', False)).lower()
XML.SubElement(top, 'commitSha1').text = data.get('commit-sha1', '')
XML.SubElement(top, 'includeBuildNumberInKey').text = str(
data.get('include-build-number', False)).lower()
mappings = [
('ignore-ssl', 'ignoreUnverifiedSSLPeer', False),
('commit-sha1', 'commitSha1', ''),
('include-build-number', 'includeBuildNumberInKey', False)
]
helpers.convert_mapping_to_xml(
top, data, mappings, fail_required=True)
def dependency_check(registry, xml_parent, data):

View File

@ -0,0 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<project>
<publishers>
<org.jenkinsci.plugins.stashNotifier.StashNotifier>
<stashServerBaseUrl>https://mystash</stashServerBaseUrl>
<stashUserName>a</stashUserName>
<stashUserPassword>b</stashUserPassword>
<ignoreUnverifiedSSLPeer>true</ignoreUnverifiedSSLPeer>
<commitSha1>c</commitSha1>
<includeBuildNumberInKey>true</includeBuildNumberInKey>
</org.jenkinsci.plugins.stashNotifier.StashNotifier>
</publishers>
</project>

View File

@ -0,0 +1,8 @@
publishers:
- stash:
url: "https://mystash"
username: a
password: b
ignore-ssl: true
commit-sha1: c
include-build-number: true

View File

@ -0,0 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<project>
<publishers>
<org.jenkinsci.plugins.stashNotifier.StashNotifier>
<stashServerBaseUrl/>
<stashUserName/>
<stashUserPassword/>
<ignoreUnverifiedSSLPeer>false</ignoreUnverifiedSSLPeer>
<commitSha1/>
<includeBuildNumberInKey>false</includeBuildNumberInKey>
</org.jenkinsci.plugins.stashNotifier.StashNotifier>
</publishers>
</project>

View File

@ -0,0 +1,2 @@
publishers:
- stash