Add support for GH Custom Notification Context

Task: #35637
Story: #2006141
Change-Id: Id4bbc73a709a7cd292072ab66666bd647f0514a6
This commit is contained in:
Ivan Fernandez Calvo 2019-07-01 12:56:33 +02:00 committed by Thanh Ha
parent 5d15fe7631
commit 073e7bb5e5
No known key found for this signature in database
GPG Key ID: 5783F720616E3180
3 changed files with 17 additions and 0 deletions

View File

@ -796,6 +796,10 @@ def github_scm(xml_parent, data):
discovered initially or a change from the previous revision has been
detected. (optional)
Refer to :func:`~build_strategies <build_strategies>`.
:arg str notification-context: Change the default GitHub check notification
context from "continuous-integration/jenkins/SUFFIX" to a custom text,
Requires the :jenkins-wiki:`Github Custom Notification Context SCM
Behaviour <Github+Custom+Notification+Context+SCM+Behaviour+Plugin>`.
:arg dict property-strategies: Provides control over how to build a branch
(like to disable SCM triggering or to override the pipeline durability)
(optional)
@ -980,6 +984,14 @@ def github_scm(xml_parent, data):
if data.get('build-strategies', None):
build_strategies(xml_parent, data)
if data.get('notification-context', None):
rshf = XML.SubElement(traits,
'org.jenkinsci.plugins.githubScmTraitNotificationContext.'
'NotificationContextTrait')
XML.SubElement(rshf, 'contextLabel').text = data.get(
'notification-context')
XML.SubElement(rshf, 'typeSuffix').text = 'true'
# handle the default git extensions like:
# - clean
# - shallow-clone

View File

@ -55,6 +55,10 @@
<jenkins.scm.impl.trait.RegexSCMHeadFilterTrait>
<regex>(.*/master|.*/release/.*)</regex>
</jenkins.scm.impl.trait.RegexSCMHeadFilterTrait>
<org.jenkinsci.plugins.githubScmTraitNotificationContext.NotificationContextTrait>
<contextLabel>jenkins.example.com/my_context</contextLabel>
<typeSuffix>true</typeSuffix>
</org.jenkinsci.plugins.githubScmTraitNotificationContext.NotificationContextTrait>
<jenkins.plugins.git.traits.CleanAfterCheckoutTrait>
<extension class="hudson.plugins.git.extensions.impl.CleanCheckout"/>
</jenkins.plugins.git.traits.CleanAfterCheckoutTrait>

View File

@ -15,6 +15,7 @@ scm:
discover-pr-forks-trust: everyone
discover-pr-origin: both
discover-tags: true
notification-context: 'jenkins.example.com/my_context'
property-strategies:
all-branches:
- suppress-scm-triggering: true