agent
agent copied to clipboard
Git Mirroring doesn't respect `BUILDKITE_REFSPEC`
One of our projects uses a rather tricky Git mirroring approach that allows agents external to our network to gain access to our code via a GitHub.com mirror.
For this to work, we set BUILDKITE_REFSPEC
in the environment
hook – this ensures that subsequent steps don't try to pull from the "magic" PR branches used by GitHub, and it works quite well. Unfortunately, the Git Mirroring logic breaks this by trying to checkout the PR branch (which doesn't exist on the mirror).
The only workaround we've found is to add the following to our environment
hook:
export BUILDKITE_GIT_MIRRORS_SKIP_UPDATE="true"
if [ -d "${GIT_MIRROR_DIR_THAT_WE_MAINTAIN_MANUALLY}" ]; then
git --git-dir ${GIT_MIRROR_DIR_THAT_WE_MAINTAIN_MANUALLY} fetch origin
fi
It'd be really great if we didn't need to maintain this ourselves, but for that to happen we'd need to ensure that the mirroring system respects the BUILDKITE_REFSPEC
setting – IINM, the line linked above should evaluate to false
if BUILDKITE_REFSPEC
is present – I suspect that would resolve the problem.
Thanks for raising this issue @jkmassel. I agree that BUILDKITE_REFSPEC
should probably be overriding the git mirror logic there. We'll look into fixing it.