3

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.

So that when Git does the checkout, I end up with

.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.

In the branch specifier on Jenkins I have tried:

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?

Thanks

Breako Breako
  • 6,353
  • 14
  • 40
  • 59

2 Answers2

16

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

You will need Git version 1.7.0+ which added the sparse checkout functionality.

If you want to do a sparse-checkout yourself you can have a look at https://gist.github.com/sumardi/5559896

Dave
  • 1,417
  • 14
  • 23
  • Thanks @030, I removed the failing link and added another post with more hands-on information about sparse-checkout. – Dave Oct 23 '17 at 06:44
0

git doesnt support that nor jenkins plugin.

you can see the link below for more info:

How do I clone a subdirectory only of a Git repository?

Community
  • 1
  • 1
Udy
  • 2,492
  • 4
  • 23
  • 33