feat(scm): add git extension for lfs-pull

Add a missing extension to git scm which enables the option to do
"Git LFS pull after checkout"

Add lfs-pull fixtures

Change-Id: Ie8b98877f3f282ac0b32dbeb089e6d0d9ccc25c8
This commit is contained in:
sp-ricard-valverde 2021-03-16 17:34:38 +01:00
parent 4393f8ba1a
commit c1d8a41666
16 changed files with 42 additions and 1 deletions

View File

@ -456,6 +456,8 @@ def bitbucket_scm(xml_parent, data):
build changeset (default false)
* **wipe-workspace** (`bool`) - Wipe out workspace before build
(default true)
* **lfs-pull** (`bool`) - Call git lfs pull after checkout
(default false)
Minimal Example:
@ -645,6 +647,7 @@ def bitbucket_scm(xml_parent, data):
# - prune
# - wipe-workspace
# - use-author
# - lfs-pull
git_extensions(traits, data)
@ -826,6 +829,8 @@ def git_scm(xml_parent, data):
build changeset (default false)
* **wipe-workspace** (`bool`) - Wipe out workspace before build
(default true)
* **lfs-pull** (`bool`) - Call git lfs pull after checkout
(default false)
Minimal Example:
@ -885,6 +890,7 @@ def git_scm(xml_parent, data):
# - prune
# - wipe-workspace
# - use-author
# - lfs-pull
git_extensions(traits, data)
@ -975,6 +981,8 @@ def github_scm(xml_parent, data):
build changeset (default false)
* **wipe-workspace** (`bool`) - Wipe out workspace before build
(default true)
* **lfs-pull** (`bool`) - Call git lfs pull after checkout
(default false)
Minimal Example:
@ -1111,6 +1119,7 @@ def github_scm(xml_parent, data):
# - prune
# - wipe-workspace
# - use-author
# - lfs-pull
git_extensions(traits, data)
if data.get("refspecs"):

View File

@ -327,6 +327,8 @@ def git(registry, xml_parent, data):
build changeset (default false)
* **wipe-workspace** (`bool`) - Wipe out workspace before build
(default true)
* **lfs-pull** (`bool`) - Call git lfs pull after checkout
(default false)
Example:
@ -733,6 +735,16 @@ def git_extensions(xml_parent, data):
else:
ext = XML.SubElement(xml_parent, ext_name)
lfs_pull = str(data.get("lfs-pull", False)).lower()
if lfs_pull == "true":
ext_name = impl_prefix + "GitLFSPull"
if trait:
trait_name = "GitLFSPullTrait"
tr = XML.SubElement(xml_parent, trait_prefix + trait_name)
XML.SubElement(tr, "extension", {"class": ext_name})
else:
XML.SubElement(xml_parent, ext_name)
def cvs(registry, xml_parent, data):
"""yaml: cvs

View File

@ -121,7 +121,8 @@
"clean": true,
"browser": "gitweb",
"browser-url": "http://review.openstack.org/gitweb?p={project_pattern}.git",
"choosing-strategy": "gerrit"
"choosing-strategy": "gerrit",
"lfs-pull": true
}
}
]

View File

@ -38,6 +38,7 @@
<hudson.plugins.git.extensions.impl.CleanCheckout/>
<hudson.plugins.git.extensions.impl.PruneStaleBranch/>
<hudson.plugins.git.extensions.impl.WipeWorkspace/>
<hudson.plugins.git.extensions.impl.GitLFSPull/>
</extensions>
<browser class="hudson.plugins.git.browser.GitWeb">
<url>http://review.openstack.org/gitweb?p=openstack-infra/jenkins-job-builder.git</url>

View File

@ -156,6 +156,9 @@
<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>
</traits>
</source>
<strategy class="jenkins.branch.DefaultBranchPropertyStrategy">

View File

@ -100,3 +100,4 @@ scm:
skip-notifications: true
use-author: true
wipe-workspace: true
lfs-pull: true

View File

@ -114,6 +114,9 @@
<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>
</traits>
</source>
<strategy class="jenkins.branch.DefaultBranchPropertyStrategy">

View File

@ -88,3 +88,4 @@ scm:
timeout: "100"
use-author: true
wipe-workspace: true
lfs-pull: true

View File

@ -138,6 +138,9 @@
<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>

View File

@ -100,3 +100,4 @@ scm:
skip-notifications: true
use-author: true
wipe-workspace: true
lfs-pull: true

View File

@ -37,6 +37,7 @@ bob@example.com</excludedUsers>
<hudson.plugins.git.extensions.impl.PerBuildTag/>
<hudson.plugins.git.extensions.impl.PruneStaleBranch/>
<hudson.plugins.git.extensions.impl.AuthorInChangelog/>
<hudson.plugins.git.extensions.impl.GitLFSPull/>
</extensions>
<browser class="hudson.plugins.git.browser.GithubWeb">
<url>http://github.com/foo/example.git</url>

View File

@ -14,3 +14,4 @@ scm:
scm-name: something_special
use-author: true
wipe-workspace: false
lfs-pull: true

View File

@ -37,6 +37,7 @@ bob@example.com</excludedUsers>
<hudson.plugins.git.extensions.impl.PerBuildTag/>
<hudson.plugins.git.extensions.impl.PruneStaleBranch/>
<hudson.plugins.git.extensions.impl.AuthorInChangelog/>
<hudson.plugins.git.extensions.impl.GitLFSPull/>
</extensions>
<browser class="hudson.plugins.git.browser.GithubWeb">
<url>http://github.com/foo/example.git</url>

View File

@ -14,3 +14,4 @@ scm:
scm-name: something_special
use-author: true
wipe-workspace: false
lfs-pull: true

View File

@ -39,6 +39,7 @@
<hudson.plugins.git.extensions.impl.CleanCheckout/>
<hudson.plugins.git.extensions.impl.PruneStaleBranch/>
<hudson.plugins.git.extensions.impl.WipeWorkspace/>
<hudson.plugins.git.extensions.impl.GitLFSPull/>
</extensions>
<browser class="hudson.plugins.git.browser.GitWeb">
<url>http://review.openstack.org/gitweb?p=openstack-infra/jenkins-job-builder.git</url>

View File

@ -84,6 +84,7 @@
browser: gitweb
browser-url: http://review.openstack.org/gitweb?p={project_pattern}.git
choosing-strategy: gerrit
lfs-pull: true
- project:
name: complete001