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:
parent
e29d88d4cd
commit
0d4d20742a
@ -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.
|
||||
|
@ -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.
|
||||
|
8
tests/properties/fixtures/gitlab.xml
Normal file
8
tests/properties/fixtures/gitlab.xml
Normal 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>
|
3
tests/properties/fixtures/gitlab.yaml
Normal file
3
tests/properties/fixtures/gitlab.yaml
Normal file
@ -0,0 +1,3 @@
|
||||
properties:
|
||||
- gitlab:
|
||||
connection: gitlab-connection
|
6
tests/publishers/fixtures/gitlab-notifier.xml
Normal file
6
tests/publishers/fixtures/gitlab-notifier.xml
Normal file
@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<project>
|
||||
<publishers>
|
||||
<com.dabsquared.gitlabjenkins.publisher.GitLabCommitStatusPublisher/>
|
||||
</publishers>
|
||||
</project>
|
2
tests/publishers/fixtures/gitlab-notifier.yaml
Normal file
2
tests/publishers/fixtures/gitlab-notifier.yaml
Normal file
@ -0,0 +1,2 @@
|
||||
publishers:
|
||||
- gitlab-notifier
|
Loading…
Reference in New Issue
Block a user