M. Bernd
M. Bernd

Reputation: 3

Jenkins - How to clone just the last changed files from GitLab

Is there a possibility to let Jenkins clone only the changed files from GitLab instead of the whole repository?

Upvotes: 0

Views: 515

Answers (1)

dewet
dewet

Reputation: 424

Short answer: Don't do it, even if you find a way.

Here is why:

git clone is used when you don't have the repository locally and want to get one whole working copy of it.

git pull is used when you already have the repository cloned, and you only want to pull the newest changes.

git pull could potentially create merge conflicts, and dealing with those would require human intervention, and Jenkins is all about Automation, so git clone is preferred.

Jenkins deleting the repository and doing a fresh git clone also gives you the peace of mind that if your build works, it is because you have working code in your repository on GitLab and not because of something that Jenkins have saved from a previous build.

Upvotes: 1

Related Questions