Skip to content

Bazel: harden third-party archive fetches against transient download failures#108

Merged
aviator-app[bot] merged 2 commits into
mainfrom
rjh.bazel-mirror-third-party-archives
Jul 23, 2026
Merged

Bazel: harden third-party archive fetches against transient download failures#108
aviator-app[bot] merged 2 commits into
mainfrom
rjh.bazel-mirror-third-party-archives

Conversation

@rjhuijsman

@rjhuijsman rjhuijsman commented Jul 23, 2026

Copy link
Copy Markdown
Contributor

Three CI runs failed today, all in the same way: a Bazel repository rule tried to download a third-party archive, the download timed out, and the whole invocation died.

Nothing about these is a real failure — the archives exist and their contents never changed. While CI has --remote_cache (Bazel's action cache), that does not cover http_archive downloads at all, so every CI run re-downloads these straight from github.com.

This PR adds two robustness fixes:

  • buildifier_prebuilt is fetched over https://. It was the only archive in the repository declared with a plain http:// URL; that bought an extra redirect hop and a little bit of insecurity.

  • Repository downloads are retried. See the caveat below — that'll address the failures I experienced today no matter what package causes them.

@aviator-app

aviator-app Bot commented Jul 23, 2026

Copy link
Copy Markdown

Current Aviator status

Aviator will automatically update this comment as the status of the PR changes.
Comment /aviator refresh to force Aviator to re-examine your PR (or learn about other /aviator commands).

This PR was merged using Aviator (commit 8b1f237).


See the real-time status of this PR on the Aviator webapp.
Use the Aviator Chrome Extension to see the status of your PR within GitHub.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR hardens Bazel third-party repository fetches against transient network failures in CI by improving URL resiliency and enabling retry behavior for repository downloads.

Changes:

  • Switch buildifier_prebuilt archive fetch from http:// to https:// to avoid redirects and reduce failure surface.
  • Add mirror.bazel.build as a first-priority fallback URL for the rules_proto archive while keeping the same pinned sha256.
  • Enable Bazel repository download retries globally via .bazelrc (--experimental_repository_downloader_retries=5).

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
bazel/repos.bzl Moves one archive to HTTPS and adds a verified mirror fallback URL for rules_proto.
.bazelrc Enables retries for repository downloads to mitigate transient timeout/connectivity failures.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

rjhuijsman and others added 2 commits July 23, 2026 15:34
`buildifier_prebuilt` was the only third-party archive declared here
with a plain `http://` URL, and `bazel/deps.bzl` loads it at the top
level, so every Bazel invocation fetches it. GitHub redirects the
plain scheme to HTTPS anyway, which bought an extra round trip on a
fetch that is already on the critical path of every build.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Most of the archives we pin have no mirror to fall back to, so a
second entry in `urls` was not available as a fix for the download
timeouts that broke three CI runs today. Bazel has a first-class
knob for exactly this, and it was off: on Bazel 6.5
`--experimental_repository_downloader_retries` defaults to `0`,
meaning a repository rule such as `http_archive` gets exactly one
attempt per URL, and one slow response from a third-party host
fails the whole invocation.

Repository downloads now get five attempts with the exponential
backoff Bazel applies between them -- the same budget our
`Dockerfile`s already give their `curl` and `wget` fetches.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@rjhuijsman
rjhuijsman force-pushed the rjh.bazel-mirror-third-party-archives branch from 66c732d to 26c622e Compare July 23, 2026 15:34
@rjhuijsman
rjhuijsman requested review from Copilot and onelxj July 23, 2026 16:21
@rjhuijsman rjhuijsman self-assigned this Jul 23, 2026
@aviator-app

aviator-app Bot commented Jul 23, 2026

Copy link
Copy Markdown

This pull request can't be queued because it's currently a draft.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated no new comments.

@aviator-app
aviator-app Bot merged commit 8b1f237 into main Jul 23, 2026
23 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants