Add support for GitLab notifier and connection property

Adds a gitlab-notifier publisher that allows to set the commit status
on GitLab. The GitLab connection is specified using a property.

Reference: https://github.com/jenkinsci/gitlab-plugin/pull/229

Change-Id: I45b4ec2e3c5ff08922270c5c0539d4ee2086a752
This commit is contained in:
Christian Fetzer 2016-06-15 21:19:13 +02:00
parent e29d88d4cd
commit 0d4d20742a
6 changed files with 56 additions and 0 deletions

View File

@ -140,6 +140,28 @@ def github(parser, xml_parent, data):
raise MissingAttributeError(e)
def gitlab(parser, xml_parent, data):
"""yaml: gitlab
Sets the GitLab connection for the project. Configured via Jenkins Global
Configuration.
Requires the Jenkins :jenkins-wiki:`GitLab Plugin <GitLab+Plugin>`.
:arg str connection: the GitLab connection name (required)
Example:
.. literalinclude:: /../../tests/properties/fixtures/gitlab.yaml
:language: yaml
"""
gitlab = XML.SubElement(xml_parent,
'com.dabsquared.gitlabjenkins.connection.'
'GitLabConnectionProperty')
try:
XML.SubElement(gitlab, 'gitLabConnection').text = data['connection']
except KeyError as e:
raise MissingAttributeError(e)
def least_load(parser, xml_parent, data):
"""yaml: least-load
Enables the Least Load Plugin.

View File

@ -3969,6 +3969,21 @@ def github_notifier(parser, xml_parent, data):
'com.cloudbees.jenkins.GitHubCommitNotifier')
def gitlab_notifier(parser, xml_parent, data):
"""yaml: gitlab-notifier
Set build status on GitLab commit.
Requires the Jenkins :jenkins-wiki:`GitLab Plugin <GitLab+Plugin>`.
Example:
.. literalinclude:: /../../tests/publishers/fixtures/gitlab-notifier.yaml
:language: yaml
"""
XML.SubElement(
xml_parent,
'com.dabsquared.gitlabjenkins.publisher.GitLabCommitStatusPublisher')
def zulip(parser, xml_parent, data):
"""yaml: zulip
Set build status on zulip.

View File

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<project>
<properties>
<com.dabsquared.gitlabjenkins.connection.GitLabConnectionProperty>
<gitLabConnection>gitlab-connection</gitLabConnection>
</com.dabsquared.gitlabjenkins.connection.GitLabConnectionProperty>
</properties>
</project>

View File

@ -0,0 +1,3 @@
properties:
- gitlab:
connection: gitlab-connection

View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<project>
<publishers>
<com.dabsquared.gitlabjenkins.publisher.GitLabCommitStatusPublisher/>
</publishers>
</project>

View File

@ -0,0 +1,2 @@
publishers:
- gitlab-notifier