Allow configuration of ChangeDiscoveryTrait for Gerrit multibranch pipelines
Multibranch pipelines that use a checker with a query may want to specify a custom queryString in ChangeDiscovery to cut down on indexing time. This is especially useful for repos with a large number of open changes. Change-Id: Ia9cfd8b637deeb23ac88f7fe9c4ddbd54a5ad17b
This commit is contained in:
parent
7b621cf626
commit
f020cf5296
@ -669,6 +669,11 @@ def gerrit_scm(xml_parent, data):
|
|||||||
query-operator: Name of the query operator, supported values are:
|
query-operator: Name of the query operator, supported values are:
|
||||||
'SCHEME' or 'ID'.
|
'SCHEME' or 'ID'.
|
||||||
query-string: Value of the query operator.
|
query-string: Value of the query operator.
|
||||||
|
:arg dict change-discovery: Configure the query string in 'Discover open changes'.
|
||||||
|
The default 'p:<project> status:open -age:24w' will be added prior to the
|
||||||
|
query-string specified here.
|
||||||
|
(optional)
|
||||||
|
query-string: Value of the query operator.
|
||||||
|
|
||||||
:extensions:
|
:extensions:
|
||||||
|
|
||||||
@ -740,7 +745,18 @@ def gerrit_scm(xml_parent, data):
|
|||||||
|
|
||||||
# Traits
|
# Traits
|
||||||
traits = XML.SubElement(source, "traits")
|
traits = XML.SubElement(source, "traits")
|
||||||
XML.SubElement(traits, "jenkins.plugins.gerrit.traits.ChangeDiscoveryTrait")
|
change_discovery_trait = XML.SubElement(
|
||||||
|
traits, "jenkins.plugins.gerrit.traits.ChangeDiscoveryTrait"
|
||||||
|
)
|
||||||
|
change_discovery = data.get("change-discovery", None)
|
||||||
|
if change_discovery:
|
||||||
|
change_discovery_mapping = [("query-string", "queryString", None)]
|
||||||
|
helpers.convert_mapping_to_xml(
|
||||||
|
change_discovery_trait,
|
||||||
|
change_discovery,
|
||||||
|
change_discovery_mapping,
|
||||||
|
fail_required=True,
|
||||||
|
)
|
||||||
|
|
||||||
# Refspec Trait
|
# Refspec Trait
|
||||||
refspec_trait = XML.SubElement(
|
refspec_trait = XML.SubElement(
|
||||||
|
Loading…
x
Reference in New Issue
Block a user