diff --git a/jenkins_jobs/modules/scm.py b/jenkins_jobs/modules/scm.py index 523807fb4..d68f37bb0 100644 --- a/jenkins_jobs/modules/scm.py +++ b/jenkins_jobs/modules/scm.py @@ -302,6 +302,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 `. * **sparse-checkout** (`dict`) * **paths** (`list`) - List of paths to sparse checkout. (optional) * **submodule** (`dict`) @@ -626,6 +629,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) diff --git a/tests/multibranch/fixtures/scm_bitbucket_full.xml b/tests/multibranch/fixtures/scm_bitbucket_full.xml index 409e5cc29..899457676 100644 --- a/tests/multibranch/fixtures/scm_bitbucket_full.xml +++ b/tests/multibranch/fixtures/scm_bitbucket_full.xml @@ -96,6 +96,7 @@ 100 + false diff --git a/tests/multibranch/fixtures/scm_bitbucket_full.yaml b/tests/multibranch/fixtures/scm_bitbucket_full.yaml index ddc504744..4a7c52a47 100644 --- a/tests/multibranch/fixtures/scm_bitbucket_full.yaml +++ b/tests/multibranch/fixtures/scm_bitbucket_full.yaml @@ -67,5 +67,6 @@ scm: parent-credentials: true timeout: 100 timeout: "100" + skip-notifications: true use-author: true wipe-workspace: true diff --git a/tests/multibranch/fixtures/scm_github_full.xml b/tests/multibranch/fixtures/scm_github_full.xml index 9e9d6933a..4272dd202 100644 --- a/tests/multibranch/fixtures/scm_github_full.xml +++ b/tests/multibranch/fixtures/scm_github_full.xml @@ -78,6 +78,7 @@ 100 + false diff --git a/tests/multibranch/fixtures/scm_github_full.yaml b/tests/multibranch/fixtures/scm_github_full.yaml index dbb8d8aea..ce07fade7 100644 --- a/tests/multibranch/fixtures/scm_github_full.yaml +++ b/tests/multibranch/fixtures/scm_github_full.yaml @@ -64,5 +64,6 @@ scm: parent-credentials: true timeout: 100 timeout: "100" + skip-notifications: true use-author: true wipe-workspace: true