Support for GitHub Checks plugin
Change-Id: I0dcf84a56a26f8cccbfdcc6fe60567a4120e78f9
This commit is contained in:
parent
495d516c5c
commit
5e22f44854
|
@ -1194,6 +1194,7 @@ def github_scm(xml_parent, data):
|
||||||
if data.get("build-strategies", None):
|
if data.get("build-strategies", None):
|
||||||
build_strategies(xml_parent, data)
|
build_strategies(xml_parent, data)
|
||||||
|
|
||||||
|
add_github_checks_traits(traits, data)
|
||||||
add_notification_context_trait(traits, data)
|
add_notification_context_trait(traits, data)
|
||||||
add_filter_by_name_wildcard_behaviors(traits, data)
|
add_filter_by_name_wildcard_behaviors(traits, data)
|
||||||
|
|
||||||
|
@ -1925,3 +1926,59 @@ def add_notification_context_trait(traits, data):
|
||||||
nc_trait_suffix.text = str(nc_suffix).lower()
|
nc_trait_suffix.text = str(nc_suffix).lower()
|
||||||
else:
|
else:
|
||||||
nc_trait_suffix.text = nc_suffix
|
nc_trait_suffix.text = nc_suffix
|
||||||
|
|
||||||
|
|
||||||
|
def add_github_checks_traits(traits, data):
|
||||||
|
"""Enable and configure the usage of GitHub Checks API
|
||||||
|
|
||||||
|
Requires the :jenkins-plugins:`Github Checks <github-checks>` plugin.
|
||||||
|
|
||||||
|
:arg dict status-checks:
|
||||||
|
|
||||||
|
* **name** (str): The text of the context label for GitHub Checks entry
|
||||||
|
* **skip** (bool): Skips publishing Checks (optional, default false)
|
||||||
|
* **skip-branch-source-notifications** (bool): Disables the default
|
||||||
|
option of publishing statuses through Status API
|
||||||
|
(optional, default false)
|
||||||
|
* **publish-unstable-as-neutral** (bool): Publishes UNSTABLE builds
|
||||||
|
as neutral (not failed) checks
|
||||||
|
(optional, default false)
|
||||||
|
* **suppress-log-output** (bool): Suppresses sending build logs to GitHub
|
||||||
|
(optional, default false)
|
||||||
|
* **suppress-progress-updates** (bool): Suppresses updating build progress
|
||||||
|
(optional, default false)
|
||||||
|
* **verbose-logs** (bool): Enables sending build console logs to GitHub
|
||||||
|
(optional, default false)
|
||||||
|
"""
|
||||||
|
if data.get("status-checks", None):
|
||||||
|
status_checks_section = data["status-checks"]
|
||||||
|
if status_checks_section.get("verbose-logs", None):
|
||||||
|
sct = XML.SubElement(
|
||||||
|
traits,
|
||||||
|
"io.jenkins.plugins.checks.github.config.GitHubSCMSourceChecksTrait",
|
||||||
|
{"plugin": "github-checks"},
|
||||||
|
)
|
||||||
|
sct_mapping = [("verbose-logs", "verboseConsoleLog", "false")]
|
||||||
|
helpers.convert_mapping_to_xml(
|
||||||
|
sct, status_checks_section, sct_mapping, fail_required=True
|
||||||
|
)
|
||||||
|
|
||||||
|
status_check_trait = XML.SubElement(
|
||||||
|
traits,
|
||||||
|
"io.jenkins.plugins.checks.github.status.GitHubSCMSourceStatusChecksTrait",
|
||||||
|
{"plugin": "github-checks"},
|
||||||
|
)
|
||||||
|
status_check_trait_mapping = [
|
||||||
|
("skip", "skip", "false"),
|
||||||
|
("skip-branch-source-notifications", "skipNotifications", "false"),
|
||||||
|
("publish-unstable-as-neutral", "unstableBuildNeutral", "false"),
|
||||||
|
("name", "name", "Jenkins"),
|
||||||
|
("suppress-log-output", "suppressLogs", "false"),
|
||||||
|
("suppress-progress-updates", "skipProgressUpdates", "false"),
|
||||||
|
]
|
||||||
|
helpers.convert_mapping_to_xml(
|
||||||
|
status_check_trait,
|
||||||
|
status_checks_section,
|
||||||
|
status_check_trait_mapping,
|
||||||
|
fail_required=True,
|
||||||
|
)
|
||||||
|
|
|
@ -76,6 +76,17 @@
|
||||||
<tagIncludes>bar*</tagIncludes>
|
<tagIncludes>bar*</tagIncludes>
|
||||||
<tagExcludes>*qaz</tagExcludes>
|
<tagExcludes>*qaz</tagExcludes>
|
||||||
</net.gleske.scmfilter.impl.trait.WildcardSCMOriginFilterTrait>
|
</net.gleske.scmfilter.impl.trait.WildcardSCMOriginFilterTrait>
|
||||||
|
<io.jenkins.plugins.checks.github.config.GitHubSCMSourceChecksTrait plugin="github-checks">
|
||||||
|
<verboseConsoleLog>true</verboseConsoleLog>
|
||||||
|
</io.jenkins.plugins.checks.github.config.GitHubSCMSourceChecksTrait>
|
||||||
|
<io.jenkins.plugins.checks.github.status.GitHubSCMSourceStatusChecksTrait plugin="github-checks">
|
||||||
|
<skip>true</skip>
|
||||||
|
<skipNotifications>true</skipNotifications>
|
||||||
|
<unstableBuildNeutral>true</unstableBuildNeutral>
|
||||||
|
<name>my-checks</name>
|
||||||
|
<suppressLogs>true</suppressLogs>
|
||||||
|
<skipProgressUpdates>true</skipProgressUpdates>
|
||||||
|
</io.jenkins.plugins.checks.github.status.GitHubSCMSourceStatusChecksTrait>
|
||||||
<org.jenkinsci.plugins.githubScmTraitNotificationContext.NotificationContextTrait>
|
<org.jenkinsci.plugins.githubScmTraitNotificationContext.NotificationContextTrait>
|
||||||
<contextLabel>jenkins.example.com/my_context</contextLabel>
|
<contextLabel>jenkins.example.com/my_context</contextLabel>
|
||||||
<typeSuffix>false</typeSuffix>
|
<typeSuffix>false</typeSuffix>
|
||||||
|
|
|
@ -35,6 +35,14 @@ scm:
|
||||||
notification-context:
|
notification-context:
|
||||||
label: 'jenkins.example.com/my_context'
|
label: 'jenkins.example.com/my_context'
|
||||||
suffix: false
|
suffix: false
|
||||||
|
status-checks:
|
||||||
|
name: my-checks
|
||||||
|
skip: true
|
||||||
|
skip-branch-source-notifications: true
|
||||||
|
publish-unstable-as-neutral: true
|
||||||
|
suppress-log-output: true
|
||||||
|
suppress-progress-updates: true
|
||||||
|
verbose-logs: true
|
||||||
property-strategies:
|
property-strategies:
|
||||||
all-branches:
|
all-branches:
|
||||||
- suppress-scm-triggering: true
|
- suppress-scm-triggering: true
|
||||||
|
|
Loading…
Reference in New Issue