Skip to content
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

Git Mirroring doesn't respect BUILDKITE_REFSPEC #2555

Open
jkmassel opened this issue Dec 13, 2023 · 1 comment
Open

Git Mirroring doesn't respect BUILDKITE_REFSPEC #2555

jkmassel opened this issue Dec 13, 2023 · 1 comment

Comments

@jkmassel
Copy link

jkmassel commented Dec 13, 2023

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.

@DrJosh9000
Copy link
Contributor

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants