publishers: add args to gitlab publisher
Add support for "Name" and "Mark unstable as success" options. Move the existing gitlab-notifier test to "minimal" and add a "full" test that exercises these new args. Change-Id: I0affb14ac51accf766d930dda816537ceb1d23fc Signed-off-by: Thanh Ha <thanh.ha@linuxfoundation.org>
This commit is contained in:
parent
229134923d
commit
7f853603c5
@ -4389,14 +4389,33 @@ def gitlab_notifier(registry, xml_parent, data):
|
|||||||
Set build status on GitLab commit.
|
Set build status on GitLab commit.
|
||||||
Requires the Jenkins :jenkins-wiki:`GitLab Plugin <GitLab+Plugin>`.
|
Requires the Jenkins :jenkins-wiki:`GitLab Plugin <GitLab+Plugin>`.
|
||||||
|
|
||||||
Example:
|
:arg str name: The name of the build in GitLab. With this you can
|
||||||
|
distinguish different Jenkins jobs for the same commit in GitLab.
|
||||||
|
(default 'jenkins')
|
||||||
|
:arg bool mark-unstable-as-success: (default false)
|
||||||
|
|
||||||
.. literalinclude:: /../../tests/publishers/fixtures/gitlab-notifier.yaml
|
Minimal Example:
|
||||||
|
|
||||||
|
.. literalinclude::
|
||||||
|
/../../tests/publishers/fixtures/gitlab-notifier-minimal.yaml
|
||||||
|
:language: yaml
|
||||||
|
|
||||||
|
Full Example:
|
||||||
|
|
||||||
|
.. literalinclude::
|
||||||
|
/../../tests/publishers/fixtures/gitlab-notifier-full.yaml
|
||||||
:language: yaml
|
:language: yaml
|
||||||
"""
|
"""
|
||||||
XML.SubElement(
|
top = XML.SubElement(
|
||||||
xml_parent,
|
xml_parent,
|
||||||
'com.dabsquared.gitlabjenkins.publisher.GitLabCommitStatusPublisher')
|
'com.dabsquared.gitlabjenkins.publisher.GitLabCommitStatusPublisher')
|
||||||
|
top.set('plugin', 'gitlab-plugin')
|
||||||
|
|
||||||
|
mappings = [
|
||||||
|
('name', 'name', 'jenkins'),
|
||||||
|
('mark-unstable-as-success', 'markUnstableAsSuccess', False),
|
||||||
|
]
|
||||||
|
helpers.convert_mapping_to_xml(top, data, mappings, fail_required=True)
|
||||||
|
|
||||||
|
|
||||||
def zulip(registry, xml_parent, data):
|
def zulip(registry, xml_parent, data):
|
||||||
|
9
tests/publishers/fixtures/gitlab-notifier-full.xml
Normal file
9
tests/publishers/fixtures/gitlab-notifier-full.xml
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<project>
|
||||||
|
<publishers>
|
||||||
|
<com.dabsquared.gitlabjenkins.publisher.GitLabCommitStatusPublisher plugin="gitlab-plugin">
|
||||||
|
<name>foobar-jenkins</name>
|
||||||
|
<markUnstableAsSuccess>true</markUnstableAsSuccess>
|
||||||
|
</com.dabsquared.gitlabjenkins.publisher.GitLabCommitStatusPublisher>
|
||||||
|
</publishers>
|
||||||
|
</project>
|
4
tests/publishers/fixtures/gitlab-notifier-full.yaml
Normal file
4
tests/publishers/fixtures/gitlab-notifier-full.yaml
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
publishers:
|
||||||
|
- gitlab-notifier:
|
||||||
|
name: foobar-jenkins
|
||||||
|
mark-unstable-as-success: true
|
9
tests/publishers/fixtures/gitlab-notifier-minimal.xml
Normal file
9
tests/publishers/fixtures/gitlab-notifier-minimal.xml
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<project>
|
||||||
|
<publishers>
|
||||||
|
<com.dabsquared.gitlabjenkins.publisher.GitLabCommitStatusPublisher plugin="gitlab-plugin">
|
||||||
|
<name>jenkins</name>
|
||||||
|
<markUnstableAsSuccess>false</markUnstableAsSuccess>
|
||||||
|
</com.dabsquared.gitlabjenkins.publisher.GitLabCommitStatusPublisher>
|
||||||
|
</publishers>
|
||||||
|
</project>
|
@ -1,6 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<project>
|
|
||||||
<publishers>
|
|
||||||
<com.dabsquared.gitlabjenkins.publisher.GitLabCommitStatusPublisher/>
|
|
||||||
</publishers>
|
|
||||||
</project>
|
|
Loading…
x
Reference in New Issue
Block a user