feat: support the skip-notifications-trait plugin for git repos

Change-Id: If466d36671a8d87e0543d625f5b4e5302111874d
This commit is contained in:
Giel van Schijndel 2020-09-16 12:44:22 +02:00
parent afc2b6fd42
commit c1e3807ac7
5 changed files with 11 additions and 0 deletions

View File

@ -299,6 +299,9 @@ def git(registry, xml_parent, data):
(default false)
* **honor-refspec** (`bool`) - Perform initial clone using the refspec
defined for the repository (default false)
* **skip-notifications** (`bool`) - Skip build status notifications
(default false). Requires the Jenkins
:jenkins-plugins:`Skip Notifications Trait Plugin <skip-notifications-trait>`.
* **sparse-checkout** (`dict`)
* **paths** (`list`) - List of paths to sparse checkout. (optional)
* **submodule** (`dict`)
@ -607,6 +610,10 @@ def git_extensions(xml_parent, data):
).lower()
if "reference-repo" in data:
XML.SubElement(ext, "reference").text = str(data["reference-repo"])
skip_notifications = data.get("skip-notifications", False)
if trait and skip_notifications:
trait_name = "com.cloudbees.jenkins.plugins.bitbucket.notifications.SkipNotificationsTrait"
XML.SubElement(xml_parent, trait_name)
if not trait and "sparse-checkout" in data:
ext_name = impl_prefix + "SparseCheckoutPaths"
ext = XML.SubElement(xml_parent, ext_name)

View File

@ -91,6 +91,7 @@
<timeout>100</timeout>
</extension>
</jenkins.plugins.git.traits.CloneOptionTrait>
<com.cloudbees.jenkins.plugins.bitbucket.notifications.SkipNotificationsTrait/>
<jenkins.plugins.git.traits.SubmoduleOptionTrait>
<extension class="hudson.plugins.git.extensions.impl.SubmoduleOption">
<disableSubmodules>false</disableSubmodules>

View File

@ -64,5 +64,6 @@ scm:
parent-credentials: true
timeout: 100
timeout: "100"
skip-notifications: true
use-author: true
wipe-workspace: true

View File

@ -73,6 +73,7 @@
<timeout>100</timeout>
</extension>
</jenkins.plugins.git.traits.CloneOptionTrait>
<com.cloudbees.jenkins.plugins.bitbucket.notifications.SkipNotificationsTrait/>
<jenkins.plugins.git.traits.SubmoduleOptionTrait>
<extension class="hudson.plugins.git.extensions.impl.SubmoduleOption">
<disableSubmodules>false</disableSubmodules>

View File

@ -61,5 +61,6 @@ scm:
parent-credentials: true
timeout: 100
timeout: "100"
skip-notifications: true
use-author: true
wipe-workspace: true