diff options
Diffstat (limited to 'jenkins_jobs/modules/project_multibranch.py')
-rw-r--r-- | jenkins_jobs/modules/project_multibranch.py | 25 |
1 files changed, 13 insertions, 12 deletions
diff --git a/jenkins_jobs/modules/project_multibranch.py b/jenkins_jobs/modules/project_multibranch.py index 4a2923e5..49b5f8e3 100644 --- a/jenkins_jobs/modules/project_multibranch.py +++ b/jenkins_jobs/modules/project_multibranch.py @@ -865,7 +865,7 @@ def github_scm(xml_parent, data): (default 'contributors') :arg str discover-pr-origin: Discovers pull requests where the origin repository is the same as the target repository. - Valid options: merge-current, current, both. (default 'merge-current') + Valid options: merge-current, current, both, false. (default 'merge-current') :arg bool discover-tags: Discovers tags on the repository. (default false) :arg list build-strategies: Provides control over whether to build a branch @@ -1007,18 +1007,19 @@ def github_scm(xml_parent, data): XML.SubElement(dprf, "trust").attrib["class"] = trust_map[trust] dpro_strategy = data.get("discover-pr-origin", "merge-current") - dpro = XML.SubElement( - traits, "".join([github_path_dscore, ".OriginPullRequestDiscoveryTrait"]) - ) - dpro_strategy_map = {"merge-current": "1", "current": "2", "both": "3"} - if dpro_strategy not in dpro_strategy_map: - raise InvalidAttributeError( - "discover-pr-origin", dpro_strategy, dpro_strategy_map.keys() + if dpro_strategy: + dpro = XML.SubElement( + traits, "".join([github_path_dscore, ".OriginPullRequestDiscoveryTrait"]) ) - dpro_mapping = [ - ("discover-pr-origin", "strategyId", "merge-current", dpro_strategy_map) - ] - helpers.convert_mapping_to_xml(dpro, data, dpro_mapping, fail_required=True) + dpro_strategy_map = {"merge-current": "1", "current": "2", "both": "3"} + if dpro_strategy not in dpro_strategy_map: + raise InvalidAttributeError( + "discover-pr-origin", dpro_strategy, dpro_strategy_map.keys() + ) + dpro_mapping = [ + ("discover-pr-origin", "strategyId", "merge-current", dpro_strategy_map) + ] + helpers.convert_mapping_to_xml(dpro, data, dpro_mapping, fail_required=True) if data.get("head-filter-regex", None): rshf = XML.SubElement(traits, "jenkins.scm.impl.trait.RegexSCMHeadFilterTrait") |