在 Jenkins 上使用 git 时检查特定文件夹
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/17942539/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Checking specific folders when git on Jenkins
提问by Breako Breako
I am using Jenkins / Git to check out a Grails project. The Grails project is in a sub directory for the Git project I check out.
我正在使用 Jenkins/Git 来检查 Grails 项目。Grails 项目位于我签出的 Git 项目的子目录中。
So that when Git does the checkout, I end up with
所以当 Git 进行结账时,我最终得到
.jenkins/jobs/my_jenkins_job/workspace/git_base_dir/grails_project_dir/grails_files
on my filesystem
在我的文件系统上
I want:
我想要:
.jenkins/jobs/my_jenkins_job/workspace/grails_files
Now I could run a shell to move files around but I prefer a cleaner way.
现在我可以运行 shell 来移动文件,但我更喜欢更简洁的方式。
In the branch specifier on Jenkins I have tried:
在 Jenkins 的分支说明符中,我尝试过:
develop/grails_project_dir/grails_files
But this just gives:
但这只是给出:
ERROR: Couldn't find any revision to build. Verify the repository and branch configuration for this job.
Is there any way I can get the git plugin to just check out specific folders in a git project?
有什么办法可以让 git 插件只检查 git 项目中的特定文件夹吗?
Thanks
谢谢
采纳答案by Udy
git doesnt support that nor jenkins plugin.
git 不支持那个也不支持 jenkins 插件。
you can see the link below for more info:
您可以查看以下链接了解更多信息:
回答by Dave
The accepted answer is outdated...
接受的答案已过时...
As of version 2.1.0 of Jenkins-Git plugin this is supported: https://issues.jenkins-ci.org/browse/JENKINS-21809
从 Jenkins-Git 插件的 2.1.0 版开始,支持:https: //issues.jenkins-ci.org/browse/JENKINS-21809
You will need Git version 1.7.0+ which added the sparse checkout functionality.
您将需要 Git 版本 1.7.0+,它添加了稀疏结帐功能。
If you want to do a sparse-checkout yourself you can have a look at https://gist.github.com/sumardi/5559896
如果您想自己进行稀疏结帐,可以查看https://gist.github.com/sumardi/5559896