In my case it’s probably not much of a speed difference (full clone is only about 15 MiB). In terms of how easy it is, i think nothing beats the checkout step, so I went with it.
However for some projects it would make a difference to no longer have a full clone in the CI, e.g. if they need the git-history to calculate their version number.
Note, this bug report is not really about caching the .git directory, that’s just what caused the bug for me.
It’s about the checkout step failing as soon as (a) the .git directory exists and (b) the build was triggered by a git tag. The line in the checkout step I referred to doesn’t do what it should do (i.e. create the remote tag locally). It only fetches the commit that is tagged.
I also noticed the checkout step fails on jobs triggered by tags. I made the following change to my circle config file for the job I was having this issue for and this worked:
Yes, while this works as a workaround, it is much more verbose. Fixing this in the checkout step itself would be much better. Then not every developer would need to create such a custom checkout step!
Ah, I like your solution because it keeps the checkout step as-is (though I agree, in the long run I hope the checkout step itself is fixed). I’ve implemented something like your solution now. Thanks for the help!
I searched for where the code is, but wasn’t successful, so probably the code doesn’t want to be found . The source code of the checkout.sh script is printed in my build log, but I couldn’t find a repo for it.
I described the bug here, suggested a oneliner that fixes the issue, and won’t go to further lengths to see this fixed. If CircleCI employees want the fix, they can find it here, otherwise I’ll assume they are not interested and I’ll either work around it or use something else.
For future projects I’m probably #movingtogitlab anyway, so that won’t be a problem anymore…
I like GitLab (I use them for my image registry) but I’ve heard of sporadic reports that they’re struggling to cope with the new demand caused by GitHub users fleeing the Redmondster, and the service is slow as a result. That may just affect the free tier though, so YMMV, as with all things.
Of course, if you have the budget/time, you can self-host with GitLab.
@CircleCI team: Do you have any opinion on the error in checkout.sh reported here and the proposed fix?
The line git fetch --force origin "refs/tags/${CIRCLE_TAG}" clearly does not do what the author of that line intended.
I offered a simple change to git fetch --force origin "refs/tags/${CIRCLE_TAG}:refs/tags/${CIRCLE_TAG}", which would fix this issue.
Yes, we have a workaround (actually two of them). Yes, we could do a shallow clone instead. But nevertheless the default checkout job is broken in some cases and should be fixed to work out of the box.