add: type-suffix for GitHub notification-context trait

Change-Id: Ibadc0de88d87df95d0319da8872c881247cd1ba6
Story: 2009995
This commit is contained in:
Kristian Kraljic 2022-04-29 22:52:13 +02:00
parent 5e66a5fbea
commit bf38568363
10 changed files with 737 additions and 25 deletions

View File

@ -228,10 +228,12 @@ def github_org(xml_parent, data):
Requires the :jenkins-plugins:`SCM Filter Branch PR Plugin
<scm-filter-branch-pr>`. Refer to
:func:`~add_filter_branch_pr_behaviors <project_multibranch.add_filter_branch_pr_behaviors>`.
:arg str notification-context: Change the default GitHub check notification
context from "continuous-integration/jenkins/SUFFIX" to a custom text,
:arg dict notification-context: Change the default GitHub check notification
context from "continuous-integration/jenkins/SUFFIX" to a custom label / suffix.
(set a label and suffix to true or false, optional)
Requires the :jenkins-plugins:`Github Custom Notification Context SCM
Behaviour <github-scm-trait-notification-context>`.
Refer to :func:`~add_notification_context_trait <project_multibranch.add_notification_context_trait>`.
:arg dict property-strategies: Provides control over how to build a branch
(like to disable SCM triggering or to override the pipeline durability)
(optional)
@ -387,14 +389,7 @@ def github_org(xml_parent, data):
if data.get("build-strategies", None):
multibranch.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"
multibranch.add_notification_context_trait(traits, data)
# handle the default git extensions like:
# - clean

View File

@ -983,10 +983,12 @@ 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,
:arg dict notification-context: Change the default GitHub check notification
context from "continuous-integration/jenkins/SUFFIX" to a custom label / suffix.
(set a label and suffix to true or false, optional)
Requires the :jenkins-plugins:`Github Custom Notification Context SCM
Behaviour <github-scm-trait-notification-context>`.
Refer to :func:`~add_notification_context_trait <add_notification_context_trait>`.
:arg dict property-strategies: Provides control over how to build a branch
(like to disable SCM triggering or to override the pipeline durability)
(optional)
@ -1158,15 +1160,7 @@ 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"
add_notification_context_trait(traits, data)
add_filter_by_name_wildcard_behaviors(traits, data)
# handle the default git extensions like:
@ -1856,3 +1850,43 @@ def add_filter_by_name_wildcard_behaviors(traits, data):
wscmf_name_mapping,
fail_required=True,
)
def add_notification_context_trait(traits, data):
"""Change the default GitHub check notification context from
"continuous-integration/jenkins/SUFFIX" to a custom label / suffix.
(set a label and suffix to true or false, optional)
Requires the :jenkins-plugins:`Github Custom Notification Context SCM
Behaviour <github-scm-trait-notification-context>`.
:arg dict notification-context: Definition of notification-context. A
`label` must be specified. `suffix` may be specified with true /
false, default being true.
* **label** (str): The text of the context label for Github status
notifications.
* **suffix** (bool): Appends the relevant suffix to the context label
based on the build type. '/pr-merge', '/pr-head' or '/branch'
(optional, default true)
"""
if data.get("notification-context", None):
nc_trait = XML.SubElement(
traits,
"org.jenkinsci.plugins.githubScmTraitNotificationContext."
"NotificationContextTrait",
)
nc = data.get("notification-context")
nc_trait_label = XML.SubElement(nc_trait, "contextLabel")
nc_trait_suffix = XML.SubElement(nc_trait, "typeSuffix")
if isinstance(nc, str):
nc_trait_label.text = nc
nc_trait_suffix.text = "true"
else:
nc_trait_label.text = nc.get("label")
nc_suffix = nc.get("suffix", None)
if nc_suffix is None:
nc_trait_suffix.text = "true"
elif type(nc_suffix) == bool:
nc_trait_suffix.text = str(nc_suffix).lower()
else:
nc_trait_suffix.text = nc_suffix

View File

@ -63,7 +63,7 @@
</net.gleske.scmfilter.impl.trait.WildcardSCMOriginFilterTrait>
<org.jenkinsci.plugins.githubScmTraitNotificationContext.NotificationContextTrait>
<contextLabel>jenkins.example.com/my_context</contextLabel>
<typeSuffix>true</typeSuffix>
<typeSuffix>false</typeSuffix>
</org.jenkinsci.plugins.githubScmTraitNotificationContext.NotificationContextTrait>
<jenkins.plugins.git.traits.CleanAfterCheckoutTrait>
<extension class="hudson.plugins.git.extensions.impl.CleanCheckout"/>

View File

@ -29,7 +29,9 @@ github-org:
discover-pr-forks-trust: everyone
discover-pr-origin: both
discover-tags: true
notification-context: 'jenkins.example.com/my_context'
notification-context:
label: 'jenkins.example.com/my_context'
suffix: false
property-strategies:
all-branches:
- suppress-scm-triggering: true

View File

@ -0,0 +1,229 @@
<?xml version="1.0" encoding="utf-8"?>
<jenkins.branch.OrganizationFolder plugin="branch-api">
<properties/>
<folderViews class="jenkins.branch.OrganizationFolderViewHolder">
<owner reference="../.."/>
</folderViews>
<healthMetrics>
<com.cloudbees.hudson.plugins.folder.health.WorstChildHealthMetric plugin="cloudbees-folder">
<nonRecursive>false</nonRecursive>
</com.cloudbees.hudson.plugins.folder.health.WorstChildHealthMetric>
</healthMetrics>
<icon class="jenkins.branch.MetadataActionFolderIcon">
<owner class="jenkins.branch.OrganizationFolder" reference="../.."/>
</icon>
<orphanedItemStrategy class="com.cloudbees.hudson.plugins.folder.computed.DefaultOrphanedItemStrategy" plugin="cloudbees-folder">
<pruneDeadBranches>true</pruneDeadBranches>
<daysToKeep>-1</daysToKeep>
<numToKeep>-1</numToKeep>
</orphanedItemStrategy>
<triggers/>
<navigators>
<org.jenkinsci.plugins.github__branch__source.GitHubSCMNavigator plugin="github-branch-source">
<repoOwner>example-owner</repoOwner>
<apiUri>http://example.org/github</apiUri>
<credentialsId>example-credential</credentialsId>
<traits>
<org.jenkinsci.plugins.github__branch__source.BranchDiscoveryTrait>
<strategyId>3</strategyId>
</org.jenkinsci.plugins.github__branch__source.BranchDiscoveryTrait>
<org.jenkinsci.plugins.github__branch__source.SSHCheckoutTrait>
<credentialsId>ssh_secret</credentialsId>
</org.jenkinsci.plugins.github__branch__source.SSHCheckoutTrait>
<org.jenkinsci.plugins.github__branch__source.TagDiscoveryTrait/>
<org.jenkinsci.plugins.github__branch__source.ForkPullRequestDiscoveryTrait>
<strategyId>3</strategyId>
<trust class="org.jenkinsci.plugins.github_branch_source.ForkPullRequestDiscoveryTrait$TrustEveryone"/>
</org.jenkinsci.plugins.github__branch__source.ForkPullRequestDiscoveryTrait>
<org.jenkinsci.plugins.github__branch__source.OriginPullRequestDiscoveryTrait>
<strategyId>3</strategyId>
</org.jenkinsci.plugins.github__branch__source.OriginPullRequestDiscoveryTrait>
<jenkins.scm.impl.trait.RegexSCMHeadFilterTrait>
<regex>(.*/master|.*/release/.*)</regex>
</jenkins.scm.impl.trait.RegexSCMHeadFilterTrait>
<net.gleske.scmfilter.impl.trait.RegexSCMHeadFilterTrait plugin="scm-filter-branch-pr">
<regex>foo/.*</regex>
<tagRegex>20\..*</tagRegex>
</net.gleske.scmfilter.impl.trait.RegexSCMHeadFilterTrait>
<net.gleske.scmfilter.impl.trait.WildcardSCMHeadFilterTrait plugin="scm-filter-branch-pr">
<includes>foo*</includes>
<excludes>bar*</excludes>
<tagIncludes>qaz*</tagIncludes>
<tagExcludes>*baz</tagExcludes>
</net.gleske.scmfilter.impl.trait.WildcardSCMHeadFilterTrait>
<net.gleske.scmfilter.impl.trait.RegexSCMOriginFilterTrait plugin="scm-filter-branch-pr">
<regex>(foo/.*|bar/.*)</regex>
<tagRegex>1\..*</tagRegex>
</net.gleske.scmfilter.impl.trait.RegexSCMOriginFilterTrait>
<net.gleske.scmfilter.impl.trait.WildcardSCMOriginFilterTrait plugin="scm-filter-branch-pr">
<includes>qaz*</includes>
<excludes>baz*</excludes>
<tagIncludes>bar*</tagIncludes>
<tagExcludes>*qaz</tagExcludes>
</net.gleske.scmfilter.impl.trait.WildcardSCMOriginFilterTrait>
<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>
<jenkins.plugins.git.traits.CleanBeforeCheckoutTrait>
<extension class="hudson.plugins.git.extensions.impl.CleanBeforeCheckout"/>
</jenkins.plugins.git.traits.CleanBeforeCheckoutTrait>
<jenkins.plugins.git.traits.UserIdentityTrait>
<extension class="hudson.plugins.git.extensions.impl.UserIdentity">
<email>no-reply@ci.example.com</email>
</extension>
</jenkins.plugins.git.traits.UserIdentityTrait>
<jenkins.plugins.git.traits.CloneOptionTrait>
<extension class="hudson.plugins.git.extensions.impl.CloneOption">
<shallow>true</shallow>
<depth>3</depth>
<noTags>true</noTags>
<timeout>100</timeout>
</extension>
</jenkins.plugins.git.traits.CloneOptionTrait>
<com.cloudbees.jenkins.plugins.bitbucket.notifications.SkipNotificationsTrait/>
<jenkins.plugins.git.traits.SparseCheckoutPathsTrait>
<extension class="hudson.plugins.git.extensions.impl.SparseCheckoutPaths">
<sparseCheckoutPaths>
<hudson.plugins.git.extensions.impl.SparseCheckoutPath>
<path>path1</path>
</hudson.plugins.git.extensions.impl.SparseCheckoutPath>
<hudson.plugins.git.extensions.impl.SparseCheckoutPath>
<path>path2</path>
</hudson.plugins.git.extensions.impl.SparseCheckoutPath>
<hudson.plugins.git.extensions.impl.SparseCheckoutPath>
<path>path3</path>
</hudson.plugins.git.extensions.impl.SparseCheckoutPath>
</sparseCheckoutPaths>
</extension>
</jenkins.plugins.git.traits.SparseCheckoutPathsTrait>
<jenkins.plugins.git.traits.SubmoduleOptionTrait>
<extension class="hudson.plugins.git.extensions.impl.SubmoduleOption">
<disableSubmodules>false</disableSubmodules>
<recursiveSubmodules>true</recursiveSubmodules>
<trackingSubmodules>false</trackingSubmodules>
<parentCredentials>true</parentCredentials>
<reference/>
<timeout>100</timeout>
<threads>1</threads>
</extension>
</jenkins.plugins.git.traits.SubmoduleOptionTrait>
<jenkins.plugins.git.traits.CheckoutOptionTrait>
<extension class="hudson.plugins.git.extensions.impl.CheckoutOption">
<timeout>100</timeout>
</extension>
</jenkins.plugins.git.traits.CheckoutOptionTrait>
<jenkins.plugins.git.traits.PruneStaleBranchTrait>
<extension class="hudson.plugins.git.extensions.impl.PruneStaleBranch"/>
</jenkins.plugins.git.traits.PruneStaleBranchTrait>
<jenkins.plugins.git.traits.WipeWorkspaceTrait>
<extension class="hudson.plugins.git.extensions.impl.WipeWorkspace"/>
</jenkins.plugins.git.traits.WipeWorkspaceTrait>
<jenkins.plugins.git.traits.AuthorInChangelogTrait>
<extension class="hudson.plugins.git.extensions.impl.AuthorInChangelog"/>
</jenkins.plugins.git.traits.AuthorInChangelogTrait>
<jenkins.plugins.git.traits.GitLFSPullTrait>
<extension class="hudson.plugins.git.extensions.impl.GitLFSPull"/>
</jenkins.plugins.git.traits.GitLFSPullTrait>
<jenkins.plugins.git.traits.RefSpecsSCMSourceTrait plugin="git">
<templates>
<jenkins.plugins.git.traits.RefSpecsSCMSourceTrait_-RefSpecTemplate>
<value>+refs/heads/*:refs/remotes/@{remote}/*</value>
</jenkins.plugins.git.traits.RefSpecsSCMSourceTrait_-RefSpecTemplate>
</templates>
</jenkins.plugins.git.traits.RefSpecsSCMSourceTrait>
<com.adobe.jenkins.disable__github__multibranch__status.DisableStatusUpdateTrait plugin="disable-github-multibranch-status"/>
</traits>
<strategy class="jenkins.branch.DefaultBranchPropertyStrategy">
<properties class="java.util.Arrays$ArrayList">
<a class="jenkins.branch.BranchProperty-array">
<jenkins.branch.NoTriggerBranchProperty/>
<org.jenkinsci.plugins.workflow.multibranch.DurabilityHintBranchProperty plugin="workflow-multibranch">
<hint>MAX_SURVIVABILITY</hint>
</org.jenkinsci.plugins.workflow.multibranch.DurabilityHintBranchProperty>
<com.adobe.jenkins.github__pr__comment__build.TriggerPRCommentBranchProperty plugin="github-pr-comment-build">
<commentBody>Ci build!</commentBody>
</com.adobe.jenkins.github__pr__comment__build.TriggerPRCommentBranchProperty>
<com.adobe.jenkins.github__pr__comment__build.TriggerPRReviewBranchProperty plugin="github-pr-comment-build"/>
<com.adobe.jenkins.github__pr__comment__build.TriggerPRUpdateBranchProperty plugin="github-pr-comment-build"/>
</a>
</properties>
</strategy>
<buildStrategies>
<jenkins.branch.buildstrategies.basic.AllBranchBuildStrategyImpl plugin="basic-branch-build-strategies">
<strategies>
<jenkins.branch.buildstrategies.basic.BranchBuildStrategyImpl plugin="basic-branch-build-strategies"/>
<jenkins.branch.buildstrategies.basic.SkipInitialBuildOnFirstBranchIndexing plugin="basic-branch-build-strategies"/>
</strategies>
</jenkins.branch.buildstrategies.basic.AllBranchBuildStrategyImpl>
<jenkins.branch.buildstrategies.basic.AnyBranchBuildStrategyImpl plugin="basic-branch-build-strategies">
<strategies>
<jenkins.branch.buildstrategies.basic.ChangeRequestBuildStrategyImpl plugin="basic-branch-build-strategies">
<ignoreTargetOnlyChanges>false</ignoreTargetOnlyChanges>
</jenkins.branch.buildstrategies.basic.ChangeRequestBuildStrategyImpl>
<jenkins.branch.buildstrategies.basic.TagBuildStrategyImpl plugin="basic-branch-build-strategies">
<atMostMillis>-1</atMostMillis>
<atLeastMillis>-1</atLeastMillis>
</jenkins.branch.buildstrategies.basic.TagBuildStrategyImpl>
</strategies>
</jenkins.branch.buildstrategies.basic.AnyBranchBuildStrategyImpl>
<jenkins.branch.buildstrategies.basic.TagBuildStrategyImpl plugin="basic-branch-build-strategies">
<atMostMillis>86400000</atMostMillis>
<atLeastMillis>604800000</atLeastMillis>
</jenkins.branch.buildstrategies.basic.TagBuildStrategyImpl>
<jenkins.branch.buildstrategies.basic.TagBuildStrategyImpl plugin="basic-branch-build-strategies">
<atMostMillis>-1</atMostMillis>
<atLeastMillis>-1</atLeastMillis>
</jenkins.branch.buildstrategies.basic.TagBuildStrategyImpl>
<jenkins.branch.buildstrategies.basic.ChangeRequestBuildStrategyImpl plugin="basic-branch-build-strategies">
<ignoreTargetOnlyChanges>true</ignoreTargetOnlyChanges>
</jenkins.branch.buildstrategies.basic.ChangeRequestBuildStrategyImpl>
<jenkins.branch.buildstrategies.basic.ChangeRequestBuildStrategyImpl plugin="basic-branch-build-strategies">
<ignoreTargetOnlyChanges>false</ignoreTargetOnlyChanges>
</jenkins.branch.buildstrategies.basic.ChangeRequestBuildStrategyImpl>
<jenkins.branch.buildstrategies.basic.BranchBuildStrategyImpl plugin="basic-branch-build-strategies"/>
<jenkins.branch.buildstrategies.basic.SkipInitialBuildOnFirstBranchIndexing plugin="basic-branch-build-strategies"/>
<jenkins.branch.buildstrategies.basic.NamedBranchBuildStrategyImpl plugin="basic-branch-build-strategies">
<filters>
<jenkins.branch.buildstrategies.basic.NamedBranchBuildStrategyImpl_-ExactNameFilter>
<name>test</name>
<caseSensitive>true</caseSensitive>
</jenkins.branch.buildstrategies.basic.NamedBranchBuildStrategyImpl_-ExactNameFilter>
<jenkins.branch.buildstrategies.basic.NamedBranchBuildStrategyImpl_-RegexNameFilter>
<regex>test.*$</regex>
<caseSensitive>true</caseSensitive>
</jenkins.branch.buildstrategies.basic.NamedBranchBuildStrategyImpl_-RegexNameFilter>
<jenkins.branch.buildstrategies.basic.NamedBranchBuildStrategyImpl_-WildcardsNameFilter>
<includes>testinclude</includes>
<excludes>testexclude</excludes>
</jenkins.branch.buildstrategies.basic.NamedBranchBuildStrategyImpl_-WildcardsNameFilter>
</filters>
</jenkins.branch.buildstrategies.basic.NamedBranchBuildStrategyImpl>
<jenkins.branch.buildstrategies.basic.NamedBranchBuildStrategyImpl plugin="basic-branch-build-strategies">
<filters>
<jenkins.branch.buildstrategies.basic.NamedBranchBuildStrategyImpl_-ExactNameFilter>
<name/>
<caseSensitive>false</caseSensitive>
</jenkins.branch.buildstrategies.basic.NamedBranchBuildStrategyImpl_-ExactNameFilter>
<jenkins.branch.buildstrategies.basic.NamedBranchBuildStrategyImpl_-RegexNameFilter>
<regex>^.*$</regex>
<caseSensitive>false</caseSensitive>
</jenkins.branch.buildstrategies.basic.NamedBranchBuildStrategyImpl_-RegexNameFilter>
<jenkins.branch.buildstrategies.basic.NamedBranchBuildStrategyImpl_-WildcardsNameFilter>
<includes>*</includes>
<excludes/>
</jenkins.branch.buildstrategies.basic.NamedBranchBuildStrategyImpl_-WildcardsNameFilter>
</filters>
</jenkins.branch.buildstrategies.basic.NamedBranchBuildStrategyImpl>
</buildStrategies>
</org.jenkinsci.plugins.github__branch__source.GitHubSCMNavigator>
</navigators>
<projectFactories>
<org.jenkinsci.plugins.workflow.multibranch.WorkflowMultiBranchProjectFactory plugin="workflow-multibranch">
<scriptPath>Jenkinsfile</scriptPath>
</org.jenkinsci.plugins.workflow.multibranch.WorkflowMultiBranchProjectFactory>
</projectFactories>
</jenkins.branch.OrganizationFolder>

View File

@ -0,0 +1,101 @@
name: github-org-legacy-nc
project-type: githuborg
github-org:
api-uri: http://example.org/github
ssh-checkout:
credentials: 'ssh_secret'
repo-owner: example-owner
credentials-id: example-credential
branch-discovery: all
head-filter-regex: "(.*/master|.*/release/.*)"
head-pr-filter-behaviors:
head-pr-destined-regex:
branch-regexp: "foo/.*"
tag-regexp: "20\\..*"
head-pr-destined-wildcard:
branch-includes: "foo*"
tag-includes: "qaz*"
branch-excludes: "bar*"
tag-excludes: "*baz"
head-pr-originated-regex:
branch-regexp: "(foo/.*|bar/.*)"
tag-regexp: "1\\..*"
head-pr-originated-wildcard:
branch-includes: "qaz*"
tag-includes: "bar*"
branch-excludes: "baz*"
tag-excludes: "*qaz"
discover-pr-forks-strategy: both
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
- pipeline-branch-durability-override: max-survivability
- trigger-build-on-pr-comment: "Ci build!"
- trigger-build-on-pr-review: true
- trigger-build-on-pr-update: true
build-strategies:
- all-strategies-match:
strategies:
- regular-branches: true
- skip-initial-build: true
- any-strategies-match:
strategies:
- change-request: {}
- tags: {}
- tags:
ignore-tags-newer-than: 1
ignore-tags-older-than: 7
- tags: {}
- change-request:
ignore-target-only-changes: true
- change-request: {}
- regular-branches: true
- skip-initial-build: true
- named-branches:
- exact-name:
name: 'test'
case-sensitive: true
- regex-name:
regex: 'test.*$'
case-sensitive: true
- wildcards-name:
excludes: 'testexclude'
includes: 'testinclude'
- named-branches:
- exact-name: {}
- regex-name: {}
- wildcards-name: {}
clean:
after: true
before: true
committer:
user: CI System
email: no-reply@ci.example.com
prune: true
local-branch: true
sparse-checkout:
paths:
- "path1"
- "path2"
- "path3"
shallow-clone: true
depth: 3
do-not-fetch-tags: true
disable-pr-notifications: true
refspecs:
- '+refs/heads/*:refs/remotes/@{remote}/*'
submodule:
disable: false
recursive: true
parent-credentials: true
timeout: 100
threads: 1
timeout: "100"
skip-notifications: true
use-author: true
wipe-workspace: true
lfs-pull: true

View File

@ -77,7 +77,7 @@
</net.gleske.scmfilter.impl.trait.WildcardSCMOriginFilterTrait>
<org.jenkinsci.plugins.githubScmTraitNotificationContext.NotificationContextTrait>
<contextLabel>jenkins.example.com/my_context</contextLabel>
<typeSuffix>true</typeSuffix>
<typeSuffix>false</typeSuffix>
</org.jenkinsci.plugins.githubScmTraitNotificationContext.NotificationContextTrait>
<jenkins.plugins.git.traits.CleanAfterCheckoutTrait>
<extension class="hudson.plugins.git.extensions.impl.CleanCheckout"/>

View File

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

View File

@ -0,0 +1,245 @@
<?xml version="1.0" encoding="utf-8"?>
<org.jenkinsci.plugins.workflow.multibranch.WorkflowMultiBranchProject plugin="workflow-multibranch">
<properties/>
<views>
<hudson.model.AllView>
<name>All</name>
<filterExecutors>false</filterExecutors>
<filterQueue>false</filterQueue>
<properties class="hudson.model.View$PropertyList"/>
<owner class="org.jenkinsci.plugins.workflow.multibranch.WorkflowMultiBranchProject" reference="../../.."/>
</hudson.model.AllView>
</views>
<viewsTabBar class="hudson.views.DefaultViewsTabBar"/>
<folderViews class="jenkins.branch.MultiBranchProjectViewHolder" plugin="branch-api">
<owner class="org.jenkinsci.plugins.workflow.multibranch.WorkflowMultiBranchProject" reference="../.."/>
</folderViews>
<healthMetrics>
<com.cloudbees.hudson.plugins.folder.health.WorstChildHealthMetric plugin="cloudbees-folder">
<nonRecursive>false</nonRecursive>
</com.cloudbees.hudson.plugins.folder.health.WorstChildHealthMetric>
</healthMetrics>
<icon class="jenkins.branch.MetadataActionFolderIcon" plugin="branch-api">
<owner class="org.jenkinsci.plugins.workflow.multibranch.WorkflowMultiBranchProject" reference="../.."/>
</icon>
<orphanedItemStrategy class="com.cloudbees.hudson.plugins.folder.computed.DefaultOrphanedItemStrategy" plugin="cloudbees-folder">
<pruneDeadBranches>true</pruneDeadBranches>
<daysToKeep>-1</daysToKeep>
<numToKeep>-1</numToKeep>
</orphanedItemStrategy>
<triggers/>
<sources class="jenkins.branch.MultiBranchProject$BranchSourceList" plugin="branch-api">
<data>
<jenkins.branch.BranchSource>
<source class="org.jenkinsci.plugins.github_branch_source.GitHubSCMSource" plugin="github-branch-source">
<id>gh-example-owner-example-repo</id>
<repoOwner>example-owner</repoOwner>
<repository>example-repo</repository>
<apiUri>http://example.org/github</apiUri>
<credentialsId>example-credential</credentialsId>
<traits>
<org.jenkinsci.plugins.github__branch__source.BranchDiscoveryTrait>
<strategyId>3</strategyId>
</org.jenkinsci.plugins.github__branch__source.BranchDiscoveryTrait>
<org.jenkinsci.plugins.github__branch__source.SSHCheckoutTrait>
<credentialsId>ssh_secret</credentialsId>
</org.jenkinsci.plugins.github__branch__source.SSHCheckoutTrait>
<org.jenkinsci.plugins.github__branch__source.TagDiscoveryTrait/>
<org.jenkinsci.plugins.github__branch__source.ForkPullRequestDiscoveryTrait>
<strategyId>3</strategyId>
<trust class="org.jenkinsci.plugins.github_branch_source.ForkPullRequestDiscoveryTrait$TrustEveryone"/>
</org.jenkinsci.plugins.github__branch__source.ForkPullRequestDiscoveryTrait>
<org.jenkinsci.plugins.github__branch__source.OriginPullRequestDiscoveryTrait>
<strategyId>3</strategyId>
</org.jenkinsci.plugins.github__branch__source.OriginPullRequestDiscoveryTrait>
<jenkins.scm.impl.trait.RegexSCMHeadFilterTrait>
<regex>(.*/master|.*/release/.*)</regex>
</jenkins.scm.impl.trait.RegexSCMHeadFilterTrait>
<net.gleske.scmfilter.impl.trait.RegexSCMHeadFilterTrait plugin="scm-filter-branch-pr">
<regex>foo/.*</regex>
<tagRegex>20\..*</tagRegex>
</net.gleske.scmfilter.impl.trait.RegexSCMHeadFilterTrait>
<net.gleske.scmfilter.impl.trait.WildcardSCMHeadFilterTrait plugin="scm-filter-branch-pr">
<includes>foo*</includes>
<excludes>bar*</excludes>
<tagIncludes>qaz*</tagIncludes>
<tagExcludes>*baz</tagExcludes>
</net.gleske.scmfilter.impl.trait.WildcardSCMHeadFilterTrait>
<net.gleske.scmfilter.impl.trait.RegexSCMOriginFilterTrait plugin="scm-filter-branch-pr">
<regex>(foo/.*|bar/.*)</regex>
<tagRegex>1\..*</tagRegex>
</net.gleske.scmfilter.impl.trait.RegexSCMOriginFilterTrait>
<net.gleske.scmfilter.impl.trait.WildcardSCMOriginFilterTrait plugin="scm-filter-branch-pr">
<includes>qaz*</includes>
<excludes>baz*</excludes>
<tagIncludes>bar*</tagIncludes>
<tagExcludes>*qaz</tagExcludes>
</net.gleske.scmfilter.impl.trait.WildcardSCMOriginFilterTrait>
<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>
<jenkins.plugins.git.traits.CleanBeforeCheckoutTrait>
<extension class="hudson.plugins.git.extensions.impl.CleanBeforeCheckout"/>
</jenkins.plugins.git.traits.CleanBeforeCheckoutTrait>
<jenkins.plugins.git.traits.UserIdentityTrait>
<extension class="hudson.plugins.git.extensions.impl.UserIdentity">
<email>no-reply@ci.example.com</email>
</extension>
</jenkins.plugins.git.traits.UserIdentityTrait>
<jenkins.plugins.git.traits.CloneOptionTrait>
<extension class="hudson.plugins.git.extensions.impl.CloneOption">
<shallow>true</shallow>
<depth>3</depth>
<noTags>true</noTags>
<timeout>100</timeout>
</extension>
</jenkins.plugins.git.traits.CloneOptionTrait>
<com.cloudbees.jenkins.plugins.bitbucket.notifications.SkipNotificationsTrait/>
<jenkins.plugins.git.traits.SparseCheckoutPathsTrait>
<extension class="hudson.plugins.git.extensions.impl.SparseCheckoutPaths">
<sparseCheckoutPaths>
<hudson.plugins.git.extensions.impl.SparseCheckoutPath>
<path>path1</path>
</hudson.plugins.git.extensions.impl.SparseCheckoutPath>
<hudson.plugins.git.extensions.impl.SparseCheckoutPath>
<path>path2</path>
</hudson.plugins.git.extensions.impl.SparseCheckoutPath>
<hudson.plugins.git.extensions.impl.SparseCheckoutPath>
<path>path3</path>
</hudson.plugins.git.extensions.impl.SparseCheckoutPath>
</sparseCheckoutPaths>
</extension>
</jenkins.plugins.git.traits.SparseCheckoutPathsTrait>
<jenkins.plugins.git.traits.SubmoduleOptionTrait>
<extension class="hudson.plugins.git.extensions.impl.SubmoduleOption">
<disableSubmodules>false</disableSubmodules>
<recursiveSubmodules>true</recursiveSubmodules>
<trackingSubmodules>false</trackingSubmodules>
<parentCredentials>true</parentCredentials>
<reference/>
<timeout>100</timeout>
<threads>1</threads>
</extension>
</jenkins.plugins.git.traits.SubmoduleOptionTrait>
<jenkins.plugins.git.traits.CheckoutOptionTrait>
<extension class="hudson.plugins.git.extensions.impl.CheckoutOption">
<timeout>100</timeout>
</extension>
</jenkins.plugins.git.traits.CheckoutOptionTrait>
<jenkins.plugins.git.traits.PruneStaleBranchTrait>
<extension class="hudson.plugins.git.extensions.impl.PruneStaleBranch"/>
</jenkins.plugins.git.traits.PruneStaleBranchTrait>
<jenkins.plugins.git.traits.WipeWorkspaceTrait>
<extension class="hudson.plugins.git.extensions.impl.WipeWorkspace"/>
</jenkins.plugins.git.traits.WipeWorkspaceTrait>
<jenkins.plugins.git.traits.AuthorInChangelogTrait>
<extension class="hudson.plugins.git.extensions.impl.AuthorInChangelog"/>
</jenkins.plugins.git.traits.AuthorInChangelogTrait>
<jenkins.plugins.git.traits.GitLFSPullTrait>
<extension class="hudson.plugins.git.extensions.impl.GitLFSPull"/>
</jenkins.plugins.git.traits.GitLFSPullTrait>
<jenkins.plugins.git.traits.RefSpecsSCMSourceTrait plugin="git">
<templates>
<jenkins.plugins.git.traits.RefSpecsSCMSourceTrait_-RefSpecTemplate>
<value>+refs/heads/*:refs/remotes/@{remote}/*</value>
</jenkins.plugins.git.traits.RefSpecsSCMSourceTrait_-RefSpecTemplate>
</templates>
</jenkins.plugins.git.traits.RefSpecsSCMSourceTrait>
<com.adobe.jenkins.disable__github__multibranch__status.DisableStatusUpdateTrait plugin="disable-github-multibranch-status"/>
</traits>
</source>
<strategy class="jenkins.branch.DefaultBranchPropertyStrategy">
<properties class="java.util.Arrays$ArrayList">
<a class="jenkins.branch.BranchProperty-array">
<jenkins.branch.NoTriggerBranchProperty/>
<org.jenkinsci.plugins.workflow.multibranch.DurabilityHintBranchProperty plugin="workflow-multibranch">
<hint>MAX_SURVIVABILITY</hint>
</org.jenkinsci.plugins.workflow.multibranch.DurabilityHintBranchProperty>
<com.adobe.jenkins.github__pr__comment__build.TriggerPRCommentBranchProperty plugin="github-pr-comment-build">
<commentBody>Ci build!</commentBody>
</com.adobe.jenkins.github__pr__comment__build.TriggerPRCommentBranchProperty>
<com.adobe.jenkins.github__pr__comment__build.TriggerPRReviewBranchProperty plugin="github-pr-comment-build"/>
<com.adobe.jenkins.github__pr__comment__build.TriggerPRUpdateBranchProperty plugin="github-pr-comment-build"/>
</a>
</properties>
</strategy>
<buildStrategies>
<jenkins.branch.buildstrategies.basic.AllBranchBuildStrategyImpl plugin="basic-branch-build-strategies">
<strategies>
<jenkins.branch.buildstrategies.basic.BranchBuildStrategyImpl plugin="basic-branch-build-strategies"/>
<jenkins.branch.buildstrategies.basic.SkipInitialBuildOnFirstBranchIndexing plugin="basic-branch-build-strategies"/>
</strategies>
</jenkins.branch.buildstrategies.basic.AllBranchBuildStrategyImpl>
<jenkins.branch.buildstrategies.basic.AnyBranchBuildStrategyImpl plugin="basic-branch-build-strategies">
<strategies>
<jenkins.branch.buildstrategies.basic.ChangeRequestBuildStrategyImpl plugin="basic-branch-build-strategies">
<ignoreTargetOnlyChanges>false</ignoreTargetOnlyChanges>
</jenkins.branch.buildstrategies.basic.ChangeRequestBuildStrategyImpl>
<jenkins.branch.buildstrategies.basic.TagBuildStrategyImpl plugin="basic-branch-build-strategies">
<atMostMillis>-1</atMostMillis>
<atLeastMillis>-1</atLeastMillis>
</jenkins.branch.buildstrategies.basic.TagBuildStrategyImpl>
</strategies>
</jenkins.branch.buildstrategies.basic.AnyBranchBuildStrategyImpl>
<jenkins.branch.buildstrategies.basic.TagBuildStrategyImpl plugin="basic-branch-build-strategies">
<atMostMillis>86400000</atMostMillis>
<atLeastMillis>604800000</atLeastMillis>
</jenkins.branch.buildstrategies.basic.TagBuildStrategyImpl>
<jenkins.branch.buildstrategies.basic.TagBuildStrategyImpl plugin="basic-branch-build-strategies">
<atMostMillis>-1</atMostMillis>
<atLeastMillis>-1</atLeastMillis>
</jenkins.branch.buildstrategies.basic.TagBuildStrategyImpl>
<jenkins.branch.buildstrategies.basic.ChangeRequestBuildStrategyImpl plugin="basic-branch-build-strategies">
<ignoreTargetOnlyChanges>true</ignoreTargetOnlyChanges>
</jenkins.branch.buildstrategies.basic.ChangeRequestBuildStrategyImpl>
<jenkins.branch.buildstrategies.basic.ChangeRequestBuildStrategyImpl plugin="basic-branch-build-strategies">
<ignoreTargetOnlyChanges>false</ignoreTargetOnlyChanges>
</jenkins.branch.buildstrategies.basic.ChangeRequestBuildStrategyImpl>
<jenkins.branch.buildstrategies.basic.BranchBuildStrategyImpl plugin="basic-branch-build-strategies"/>
<jenkins.branch.buildstrategies.basic.SkipInitialBuildOnFirstBranchIndexing plugin="basic-branch-build-strategies"/>
<jenkins.branch.buildstrategies.basic.NamedBranchBuildStrategyImpl plugin="basic-branch-build-strategies">
<filters>
<jenkins.branch.buildstrategies.basic.NamedBranchBuildStrategyImpl_-ExactNameFilter>
<name>test</name>
<caseSensitive>true</caseSensitive>
</jenkins.branch.buildstrategies.basic.NamedBranchBuildStrategyImpl_-ExactNameFilter>
<jenkins.branch.buildstrategies.basic.NamedBranchBuildStrategyImpl_-RegexNameFilter>
<regex>test.*$</regex>
<caseSensitive>true</caseSensitive>
</jenkins.branch.buildstrategies.basic.NamedBranchBuildStrategyImpl_-RegexNameFilter>
<jenkins.branch.buildstrategies.basic.NamedBranchBuildStrategyImpl_-WildcardsNameFilter>
<includes>testinclude</includes>
<excludes>testexclude</excludes>
</jenkins.branch.buildstrategies.basic.NamedBranchBuildStrategyImpl_-WildcardsNameFilter>
</filters>
</jenkins.branch.buildstrategies.basic.NamedBranchBuildStrategyImpl>
<jenkins.branch.buildstrategies.basic.NamedBranchBuildStrategyImpl plugin="basic-branch-build-strategies">
<filters>
<jenkins.branch.buildstrategies.basic.NamedBranchBuildStrategyImpl_-ExactNameFilter>
<name/>
<caseSensitive>false</caseSensitive>
</jenkins.branch.buildstrategies.basic.NamedBranchBuildStrategyImpl_-ExactNameFilter>
<jenkins.branch.buildstrategies.basic.NamedBranchBuildStrategyImpl_-RegexNameFilter>
<regex>^.*$</regex>
<caseSensitive>false</caseSensitive>
</jenkins.branch.buildstrategies.basic.NamedBranchBuildStrategyImpl_-RegexNameFilter>
<jenkins.branch.buildstrategies.basic.NamedBranchBuildStrategyImpl_-WildcardsNameFilter>
<includes>*</includes>
<excludes/>
</jenkins.branch.buildstrategies.basic.NamedBranchBuildStrategyImpl_-WildcardsNameFilter>
</filters>
</jenkins.branch.buildstrategies.basic.NamedBranchBuildStrategyImpl>
</buildStrategies>
</jenkins.branch.BranchSource>
</data>
<owner class="org.jenkinsci.plugins.workflow.multibranch.WorkflowMultiBranchProject" reference="../.."/>
</sources>
<factory class="org.jenkinsci.plugins.workflow.multibranch.WorkflowBranchProjectFactory">
<owner class="org.jenkinsci.plugins.workflow.multibranch.WorkflowMultiBranchProject" reference="../.."/>
<scriptPath>some.Jenkinsfile</scriptPath>
</factory>
</org.jenkinsci.plugins.workflow.multibranch.WorkflowMultiBranchProject>

View File

@ -0,0 +1,104 @@
name: scm-github-legacy-nc
project-type: multibranch
script-path: some.Jenkinsfile
scm:
- github:
api-uri: http://example.org/github
ssh-checkout:
credentials: 'ssh_secret'
repo: example-repo
repo-owner: example-owner
credentials-id: example-credential
branch-discovery: all
head-filter-regex: "(.*/master|.*/release/.*)"
head-pr-filter-behaviors:
head-pr-destined-regex:
branch-regexp: "foo/.*"
tag-regexp: "20\\..*"
head-pr-destined-wildcard:
branch-includes: "foo*"
tag-includes: "qaz*"
branch-excludes: "bar*"
tag-excludes: "*baz"
head-pr-originated-regex:
branch-regexp: "(foo/.*|bar/.*)"
tag-regexp: "1\\..*"
head-pr-originated-wildcard:
branch-includes: "qaz*"
tag-includes: "bar*"
branch-excludes: "baz*"
tag-excludes: "*qaz"
discover-pr-forks-strategy: both
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
- pipeline-branch-durability-override: max-survivability
- trigger-build-on-pr-comment: "Ci build!"
- trigger-build-on-pr-review: true
- trigger-build-on-pr-update: true
build-strategies:
- all-strategies-match:
strategies:
- regular-branches: true
- skip-initial-build: true
- any-strategies-match:
strategies:
- change-request: {}
- tags: {}
- tags:
ignore-tags-newer-than: 1
ignore-tags-older-than: 7
- tags: {}
- change-request:
ignore-target-only-changes: true
- change-request: {}
- regular-branches: true
- skip-initial-build: true
- named-branches:
- exact-name:
name: 'test'
case-sensitive: true
- regex-name:
regex: 'test.*$'
case-sensitive: true
- wildcards-name:
excludes: 'testexclude'
includes: 'testinclude'
- named-branches:
- exact-name: {}
- regex-name: {}
- wildcards-name: {}
clean:
after: true
before: true
committer:
user: CI System
email: no-reply@ci.example.com
prune: true
local-branch: true
sparse-checkout:
paths:
- "path1"
- "path2"
- "path3"
shallow-clone: true
depth: 3
do-not-fetch-tags: true
disable-pr-notifications: true
refspecs:
- '+refs/heads/*:refs/remotes/@{remote}/*'
submodule:
disable: false
recursive: true
parent-credentials: true
timeout: 100
threads: 1
timeout: "100"
skip-notifications: true
use-author: true
wipe-workspace: true
lfs-pull: true