multibranch: Add lfs pull trait to bitbucket scm

Change-Id: Ibf89cdfbfb6fc791f92a21d07442475325f46a3c
This commit is contained in:
Matt Kucia 2020-09-02 12:56:57 +08:00 committed by Thanh Ha (zxiiro)
parent 5a98ebb8bb
commit 6367f04fcf
3 changed files with 17 additions and 0 deletions

View File

@ -367,6 +367,8 @@ def bitbucket_scm(xml_parent, data):
:arg bool discover-tags: Discovers tags on the repository.
(default false)
:arg bool lfs: Git LFS pull after checkout.
(default false)
:arg str server-url: The address of the bitbucket server. (optional)
:arg str head-filter-regex: A regular expression for filtering
discovered source branches. Requires the :jenkins-plugins:`SCM API
@ -484,6 +486,17 @@ def bitbucket_scm(xml_parent, data):
XML.SubElement(
traits, "com.cloudbees.jenkins.plugins.bitbucket.TagDiscoveryTrait"
)
if data.get("lfs", False):
gitlfspull = XML.SubElement(
traits, "jenkins.plugins.git.traits.GitLFSPullTrait", {"plugin": "git"}
)
XML.SubElement(
gitlfspull,
"extension",
{"class": "hudson.plugins.git.extensions.impl.GitLFSPull"},
)
if data.get("head-filter-regex", None):
rshf = XML.SubElement(traits, "jenkins.scm.impl.trait.RegexSCMHeadFilterTrait")
XML.SubElement(rshf, "regex").text = data.get("head-filter-regex")

View File

@ -39,6 +39,9 @@
<serverUrl>https://bitbucket.example.com:8080</serverUrl>
<traits>
<com.cloudbees.jenkins.plugins.bitbucket.TagDiscoveryTrait/>
<jenkins.plugins.git.traits.GitLFSPullTrait plugin="git">
<extension class="hudson.plugins.git.extensions.impl.GitLFSPull"/>
</jenkins.plugins.git.traits.GitLFSPullTrait>
<jenkins.scm.impl.trait.RegexSCMHeadFilterTrait>
<regex>master|\d+\.\d+</regex>
</jenkins.scm.impl.trait.RegexSCMHeadFilterTrait>

View File

@ -8,6 +8,7 @@ scm:
repo: 'test'
server-url: https://bitbucket.example.com:8080
discover-tags: true
lfs: true
head-filter-regex: 'master|\d+\.\d+'
discover-pr-origin: headOnly
discover-branch: all