Fix update-git-mirror-tar-ball pipeline and schedule weekly update (#3008) When gitbundle.sh was switched from `git clone --mirror` to `git clone --bare` (to avoid downloading refs/pull/* refs), the bare repositories no longer had a remote.origin.fetch rule in their Git config. Without that rule, running `git fetch --prune` on an existing bare repository only updates FETCH_HEAD and never advances branch pointers (HEAD), causing the freshness verification check to fail on subsequent runs. In addition, the `update-git-mirror-tar-ball` pipeline had no schedule and had not succeeded since January 2026, leaving the Git mirror archive in GCS over 9 months behind—so even freshly built VM images were baking in a 9-month-old mirror, forcing every CI job to download months of missing Git history from GitHub during checkout. This change: - Configures remote.origin.fetch to `+refs/heads/*:refs/heads/*` and passes --tags to `git fetch --prune` so branch heads and tags are properly updated without pulling PR refs. - Adds a weekly schedule (Mondays at 03:00 UTC) for `update-git-mirror-tar-ball` so the Git mirror archive in GCS is refreshed before the weekly VM image builds, so new VM images always bake in a fresh Git mirror. Tested [here](https://buildkite.com/bazel-trusted/update-git-mirror-tar-ball/builds/9)
diff --git a/buildkite/terraform/bazel-trusted/pipelines_misc.tf b/buildkite/terraform/bazel-trusted/pipelines_misc.tf index dc964bb..9f9f6a1 100644 --- a/buildkite/terraform/bazel-trusted/pipelines_misc.tf +++ b/buildkite/terraform/bazel-trusted/pipelines_misc.tf
@@ -52,6 +52,13 @@ } } +resource "buildkite_pipeline_schedule" "update-git-mirror-tar-ball" { + pipeline_id = buildkite_pipeline.update-git-mirror-tar-ball.id + label = "Update git mirror tar ball weekly" + branch = "master" + cronline = "0 3 * * 1" # Every Monday at 3 AM UTC +} + resource "buildkite_pipeline" "mirror-bazel-external-deps" { name = "Mirror Bazel External Deps" repository = "https://github.com/bazelbuild/bazel.git"
diff --git a/gitbundle/gitbundle.sh b/gitbundle/gitbundle.sh index 8262d1b..2834819 100755 --- a/gitbundle/gitbundle.sh +++ b/gitbundle/gitbundle.sh
@@ -18,10 +18,13 @@ remote_name="$(echo -n $repo | tr -C '[[:alnum:]]' '-')" if [[ -d $remote_name ]]; then echo "--- Updating $repo in $remote_name" - git -C "${remote_name}" fetch --prune + git -C "${remote_name}" config remote.origin.url "${repo}" + git -C "${remote_name}" config remote.origin.fetch "+refs/heads/*:refs/heads/*" + git -C "${remote_name}" fetch --prune --tags else echo "+++ Cloning $repo into $remote_name" git clone --bare "${repo}" "${remote_name}" + git -C "${remote_name}" config remote.origin.fetch "+refs/heads/*:refs/heads/*" git -C "${remote_name}" config pack.compression 9 fi echo "--- Repacking $remote_name"