-
Notifications
You must be signed in to change notification settings - Fork 296
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow checkout with git worktrees #917
Conversation
Yes yes yes, I'm so excited! 🚀 |
I'm still not sure what worktrees offer us over a mirror+clone setup 🤷♂️ Concretely, my concerns are that worktrees:
To be clear, I'm super excited for any variant of this functionality... I just feel like worktrees are hard mode and I'm missing some reasoning. |
@matthewd I totally agree! I've been asking all the folks that use worktrees "why worktrees vs reference clones". It seems too magical to me as well, and I'm also concerned about how submodules playout. @sj26 do you have feels? 98% of the work in this PR is for the |
I'd love any feedback on the naming or mechanics of the |
I actually hadn't grasped the distinction between |
This feature sounds great! I’d have the phase match the configuration name “repository” perhaps? If people have been using the pre-checkout hook for security, with the idea “before any code can end up on the agent”, is that still true? If not, we could just make it all part of the same phase for now? Or something 🤔 |
I started there, but it's just very verbose, and we use
Nope, not true any more, was it ever? Isn't that an We could potentially just fold this stuff into the |
If it's behind the experimental flag, and destined to be v4 default behaviour, then it doesn't really matter if it changes assumptions behind https://buildkite.com/docs/agent/v3/hooks 👌🏼 |
Closing in favour of #936. |
Currently the agent keeps a copy of a git repository for each pipeline and agent installed on a host. This can lead to lots of copies of the repository, which can take up lots of space for large repositories and also means each copy must be cloned independently which can cause a lot of load on the upstream git provider.
This PR adds a new config flag
repos-path
, which is typically a directory at the same level asbuilds-path
. The repository gets checked out there with a name based on the BUILDKITE_REPO variable, so something like/usr/local/var/buildkite-agent/repos/https---github-com-buildkite-bash-example-git
. A new agent phase ofrepo
is run beforecheckout
that makes sure this repository is up to date, and then thecheckout
phase creates a lightweight git worktree for the job. This looks something like/usr/local/var/buildkite-agent/builds/85c4fd28-4e20-4993-9003-73cb49xxxxx
.Currently this feature is hidden behind an experiment flag of
worktree
, so should be able to run entirely in parallel.Based on work that @sj26 did in https://github.com/sj26/git-worktree-buildkite-hooks.