From 8de06cacb9ab261dd191c3ec820588f727ffcec6 Mon Sep 17 00:00:00 2001 From: AutomatedTester Date: Wed, 9 Sep 2026 09:48:01 +0100 Subject: [PATCH] [build] add Launchpad fallback for the rules_rs zlib .deb fetch rules_rs downloads a version-pinned zlib1g .deb from a single snapshot.ubuntu.com URL while setting up the Linux Rust toolchain. When that host returns 502/503/timeouts the failure happens during repository setup and aborts Bazel analysis, red-lining every Rust-touching job at once. Add a downloader config that keeps snapshot.ubuntu.com primary and falls back to Launchpad, which serves the identical, sha256-matching .deb by filename. The sha256 check is unchanged, and the rewrite is version-independent so it survives future rules_rs bumps. --- .bazelrc | 5 +++++ third_party/bazel/downloader.cfg | 19 +++++++++++++++++++ 2 files changed, 24 insertions(+) create mode 100644 third_party/bazel/downloader.cfg diff --git a/.bazelrc b/.bazelrc index 84f29bc931986..640db41b4c6e9 100644 --- a/.bazelrc +++ b/.bazelrc @@ -73,6 +73,11 @@ build --incompatible_strict_action_env # Creates a harmless empty repo instead of failing on missing API platforms. common --repo_env=ANDROID_HOME= +# Add a Launchpad fallback for the pinned zlib .deb that rules_rs fetches from +# snapshot.ubuntu.com, so an intermittent snapshot.ubuntu.com outage no longer +# aborts every Rust-touching build. See third_party/bazel/downloader.cfg. +common --downloader_config=third_party/bazel/downloader.cfg + # Required for prebuilt protoc to be used common --@protobuf//bazel/toolchains:prefer_prebuilt_protoc=true diff --git a/third_party/bazel/downloader.cfg b/third_party/bazel/downloader.cfg new file mode 100644 index 0000000000000..dc86dace4feca --- /dev/null +++ b/third_party/bazel/downloader.cfg @@ -0,0 +1,19 @@ +# Mirror fallback for Ubuntu "snapshot.ubuntu.com" .deb downloads. +# +# While setting up the Linux Rust toolchain, rules_rs fetches a version-pinned +# zlib1g .deb from snapshot.ubuntu.com. That host intermittently returns +# 502/503/timeouts, and because the fetch happens during repository setup a +# failure aborts Bazel analysis outright -- red-lining every Rust-touching job +# (Rust, Format, Ruby, Python Selenium Manager, ...). Launchpad serves the +# identical, sha256-matching .deb by filename, so we add it as a fallback. +# +# Bazel drops the original URL as soon as any rewrite matches, so the first +# rule re-emits the snapshot.ubuntu.com URL unchanged (keeping it the primary +# attempt) and the second appends the Launchpad URL. Bazel tries the resulting +# candidates in order; the download's sha256 still guards integrity, so a +# mirror can only ever serve the exact expected bytes. +# +# Replacements intentionally omit the scheme: Bazel reuses the original URL's +# (https) protocol. +rewrite (snapshot\.ubuntu\.com/.*) $1 +rewrite snapshot\.ubuntu\.com/.*/([^/]+\.deb) launchpad.net/ubuntu/+archive/primary/+files/$1