Git resource - new commit induces fresh clone?


#1

Hello,

I noticed that whenever there is a new commit available in the repository, concourse git resource makes a fresh clone of the entire repository. Is this the intended behavior of the git resource?

The reason I’m asking is that our repository is quite large, and performing a fresh clone takes time and incurs bandwidth costs from Google Source Repositories.

Kind regards,
Jukka


#2

You can control the depth of the clone with the depth parameter (look at the documentation https://github.com/concourse/git-resource for caveats!) and you could also augment the poll interval (default 1 minute) with check_every (https://concourse-ci.org/resources.html#resource-check-every)


#3

Thanks for your advice on depth and check_every parameters, but the question of why a clone occurs every time still remains.

The page https://concourse-ci.org/implementing-resources.html#resource-check says that the example git resource “can efficiently pull rather than cloning every time” so I’m starting to think I’m encountering a bug.

Kind regards,
Jukka


#4

Hi,

I have similar doubts.

My understanding is that the resource checking is indeed able to pull regularly after a first clone, for concourse to know if there are new revs (and trigger builds accordingly if trigger: true). Check regularity can be tweaked, for example with check_every.

However, a job plan that get a git/hg resource will eventually clone the repo for each single build. There is no way to pass the repo that is being watched out to the job, so that only a checkout to the new rev is necessary. It has to be a full clone.

Is that right ?

thanks,

Sebastien


#5

These two tickets give a lot of background information. TIL: a check container is recreated each hour (and so cloned if a git repo).