0

I have a git hub repository ABC.git it has the following directories src ,config,env, test. I just want to checkout the src and config folder into my Jenkins workspace.

I am able to checkout the complete repository into my jenkins workspace using the SCM plugin.

command used for checking out complete branch :

checkout([ $class: 'GitSCM', branches: [[name: '*/master']], doGenerateSubmoduleConfigurations: false, extensions: [[$class: 'CleanCheckout']], submoduleCfg: [], userRemoteConfigs: [[credentialsId: '<gitCredentials>', url: '<gitRepoURL>']] ]) 

1 Answer 1

0

Use this to checkout specific directory/subdirectory: extensions: [[$class: 'SparseCheckoutPaths', sparseCheckoutPaths: [[path: '/directory/path/here']]]]

So your script will look like this:

checkout([ $class: 'GitSCM', branches: [[name: '*/master']], doGenerateSubmoduleConfigurations: false, extensions: [[$class: 'CleanCheckout'], [$class: 'SparseCheckoutPaths', sparseCheckoutPaths: [[path: '/directory/path/here']]]], submoduleCfg: [], userRemoteConfigs: [[credentialsId: '<gitCredentials>', url: '<gitRepoURL>']] ]) 
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.