[英]Git LFS setup in jenkins
我在 Jenkins 中使用 git LFS 有問題。 我現在正在做的是
我們在 Jenkins 中分別使用了 3.3.0 和 2.4.2 版本的 git 插件和 git-client 插件。
怎么了:
A.war -> a.jar(原來的大小是 1234 kb,但現在變成了 3 kb(這是指針文件的大小)
所以我的問題是:
這可以使用Jenkins的常規Git +插件 (版本3.1.0以后)完成。
如果您正在使用Jenkins管道(即在您的倉庫的根目錄中使用Jenkins文件),關鍵是在checkout()
調用中包含擴展名[$class: 'GitLFSPull']
。 這是一個(編輯過的)示例,取自我們的一個回購:
checkout([ $class: 'GitSCM',
branches: [[name: 'refs/heads/'+env.BRANCH_NAME]],
doGenerateSubmoduleConfigurations: false,
extensions: [
[$class: 'GitLFSPull'],
[$class: 'CheckoutOption', timeout: 20],
[$class: 'CloneOption',
depth: 0,
noTags: false,
reference: '/other/optional/local/reference/clone',
shallow: false,
timeout: 120]
],
submoduleCfg: [],
userRemoteConfigs: [
[credentialsId: 'foobar',
url: 'https://github.com/foo/bar.git']
]
])
使用Snippet Generator,可以通過從“Additional Behaviors”菜單中選擇“結賬后的Git LFS拉取”來生成此代碼。 在此處查看截圖
這可以使用“Pre SCM BuildStep”插件完成。
這部分的文檔不清楚。 我自己努力了,終於讓它工作了。 我專門寫了一篇博客,希望對某人有所幫助: https : //mydeveloperplanet.com/2021/12/07/jenkins-multibranch-pipeline-and-git-lfs/
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.