Added support for Stash Notifier

Change-Id: I1e3e95a152de116df62b9124a50e845bc026f608
This commit is contained in:
Marcus Nilsson 2013-11-13 15:44:07 +01:00
parent 28ec20bb7f
commit 90b663308c
4 changed files with 56 additions and 0 deletions

View File

@ -2874,6 +2874,40 @@ def build_publisher(parser, xml_parent, data):
str(data.get('artifact-num-to-keep', -1))
def stash(parser, xml_parent, data):
"""yaml: stash
This plugin will configure the Jenkins Stash Notifier plugin to
notify Atlassian Stash after job completes.
Requires the Jenkins `StashNotifier Plugin.
<https://wiki.jenkins-ci.org/display/JENKINS/StashNotifier+Plugin>`_
: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 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
(Default: False)
Example:
.. literalinclude:: ../../tests/publishers/fixtures/stash001.yaml
"""
top = XML.SubElement(xml_parent,
'org.jenkinsci.plugins.stashNotifier.StashNotifier')
XML.SubElement(top, 'stashServerBaseUrl').text = data.get('url', '')
XML.SubElement(top, 'stashUserName').text = data.get('username', '')
XML.SubElement(top, 'stashUserPassword').text = data.get('password', '')
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()
class Publishers(jenkins_jobs.modules.base.Base):
sequence = 70

View File

@ -155,6 +155,7 @@ setuptools.setup(
'sloccount=jenkins_jobs.modules.publishers:sloccount',
'sonar=jenkins_jobs.modules.publishers:sonar',
'ssh=jenkins_jobs.modules.publishers:ssh',
'stash=jenkins_jobs.modules.publishers:stash',
'tap=jenkins_jobs.modules.publishers:tap',
'text-finder=jenkins_jobs.modules.publishers:text_finder',
'trigger=jenkins_jobs.modules.publishers:trigger',

View File

@ -0,0 +1,13 @@
<?xml version="1.0" ?>
<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