user3625015
user3625015

Reputation: 111

Full clone in a Jenkins pipeline script

I want to do some analysis on my Git repository for each build using a custom bash script. This requires that Jenkins checks out the full Git repository and do not perform a sparse checkout. How can I do this? I am using a pipeline script. I can do another checkout during the build but then I need to inject Jenkins credentials (which is not what I want).

My Jenkins console log always shows that a sparse checkout has been done:

> git config core.sparsecheckout # timeout=10
> git checkout -f 1d94145c47cf93a9561b59ed3ba37b936ce15d38

Upvotes: 3

Views: 3210

Answers (1)

OK999
OK999

Reputation: 1399

Why don't you add shell script steps to fetch the branches and checkout the branch you like after the sparse checkout? Something like:

git fetch --all
git checkout master or git checkout <your_desired_branch>

Upvotes: 1

Related Questions