diff --git a/jenkins_jobs/modules/properties.py b/jenkins_jobs/modules/properties.py index e9b3a1a1d..2ea842b88 100644 --- a/jenkins_jobs/modules/properties.py +++ b/jenkins_jobs/modules/properties.py @@ -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 `. + + :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. diff --git a/jenkins_jobs/modules/publishers.py b/jenkins_jobs/modules/publishers.py index b29a7726d..66238b6a3 100644 --- a/jenkins_jobs/modules/publishers.py +++ b/jenkins_jobs/modules/publishers.py @@ -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 `. + + 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. diff --git a/tests/properties/fixtures/gitlab.xml b/tests/properties/fixtures/gitlab.xml new file mode 100644 index 000000000..4ab73fef1 --- /dev/null +++ b/tests/properties/fixtures/gitlab.xml @@ -0,0 +1,8 @@ + + + + + gitlab-connection + + + diff --git a/tests/properties/fixtures/gitlab.yaml b/tests/properties/fixtures/gitlab.yaml new file mode 100644 index 000000000..fe13541c9 --- /dev/null +++ b/tests/properties/fixtures/gitlab.yaml @@ -0,0 +1,3 @@ +properties: + - gitlab: + connection: gitlab-connection diff --git a/tests/publishers/fixtures/gitlab-notifier.xml b/tests/publishers/fixtures/gitlab-notifier.xml new file mode 100644 index 000000000..9685dc9f2 --- /dev/null +++ b/tests/publishers/fixtures/gitlab-notifier.xml @@ -0,0 +1,6 @@ + + + + + + diff --git a/tests/publishers/fixtures/gitlab-notifier.yaml b/tests/publishers/fixtures/gitlab-notifier.yaml new file mode 100644 index 000000000..5966e5ba7 --- /dev/null +++ b/tests/publishers/fixtures/gitlab-notifier.yaml @@ -0,0 +1,2 @@ +publishers: + - gitlab-notifier