We use a monorepo that needs to compare the latest origin for the main branch, however Buildkite only grabs the origin for the branch that triggered the build. If the machine is fresh this is fine because the clone will have fetched the latest for main, but with on demand machines they have stale main branches.
Is there something I am missing that would make this work? Or since this flag is experimental, could something be added that says if --all is added to the flags then don’t try and fetch only the current branch?
Just wanted to confirm if you are setting the -all flag as part of an agent configuration? The BUILDKITE_GIT_FETCH_FLAGS as you’ve most likely seen in the docs is agent level configuration, so loading it with a Agent level hook/config export would suffice (by default the flags are -v --prune
If you wanted to fetch everything from upstream, a git fetch -v --prune origin should do the trick.
I’ve just tried using -v --prune origin but when the actual git fetch is performed -- origin be41afea5b706817ffb1b828deea74fffcd34dc9 gets added to it resulting in
From what I can tell in agent/git.go at main · buildkite/agent · GitHub on line 118, the git fetch always appends the -- origin hash part of the command and so through this I don’t think it’d currently be possible to fetch both the current branch and master through these means.
We believe the reason you are seeing -- origin be41afea5b706817ffb1b828deea74fffcd34dc9 gets added is because your build is for a commit push event. Is that correct ? Please can you send your build url to support@buildkite.com as that would help us check this further.