Adding setup of credentialsId in stashNotifier

New plugin version of stashNotifier now supports credentialsId
to be setup. This PR aims to manage this new feature

Change-Id: I4b3c33efba8cfd1cce01a4b7a1c8f6f95db56a30
This commit is contained in:
Nicolas Glayre 2015-12-22 16:40:24 +01:00
parent 1d15574dd4
commit 535054b5ac
3 changed files with 31 additions and 6 deletions

View File

@ -3786,6 +3786,7 @@ def stash(parser, xml_parent, data):
:arg string url: Base url of Stash Server (Default: "")
:arg string username: Username of Stash Server (Default: "")
:arg string password: Password of Stash Server (Default: "")
:arg string credentials-id: Credentials of Stash Server (optional)
:arg bool ignore-ssl: Ignore unverified SSL certificate (Default: False)
:arg string commit-sha1: Commit SHA1 to notify (Default: "")
:arg bool include-build-number: Include build number in key
@ -3800,12 +3801,17 @@ def stash(parser, xml_parent, data):
'org.jenkinsci.plugins.stashNotifier.StashNotifier')
XML.SubElement(top, 'stashServerBaseUrl').text = data.get('url', '')
XML.SubElement(top, 'stashUserName'
).text = get_value_from_yaml_or_config_file(
'username', 'stash', data, parser)
XML.SubElement(top, 'stashUserPassword'
).text = get_value_from_yaml_or_config_file(
'password', 'stash', data, parser)
if data.get('credentials-id') is not None:
XML.SubElement(top, 'credentialsId').text = str(
data.get('credentials-id'))
else:
XML.SubElement(top, 'stashUserName'
).text = get_value_from_yaml_or_config_file(
'username', 'stash', data, parser)
XML.SubElement(top, 'stashUserPassword'
).text = get_value_from_yaml_or_config_file(
'password', 'stash', data, parser)
XML.SubElement(top, 'ignoreUnverifiedSSLPeer').text = str(
data.get('ignore-ssl', False)).lower()
XML.SubElement(top, 'commitSha1').text = data.get('commit-sha1', '')

View File

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

View File

@ -0,0 +1,7 @@
publishers:
- stash:
url: "https://mystash"
credentials-id: "MyCredentialsId"
ignore-ssl: true
commit-sha1: c
include-build-number: true