Fail the build if the rustup install download fails#764
Merged
Conversation
The rustup install used `curl https://sh.rustup.rs -sSf | sh -s -- ...`. A pipeline's exit status is that of the last command, so if curl failed (e.g. a transient `Could not resolve host: sh.rustup.rs`), it produced no output, the downstream `sh` read empty stdin and exited 0, and the Docker layer "succeeded" — pushing an image with no Rust toolchain installed. That broke pyca/cryptography wheel/test jobs using the freshly-built image: with no `cargo` on PATH, maturin's `get_requires_for_build_wheel` hook requests `puccinialin` to bootstrap rustup, which is unpinned, so `uv --require-hashes` aborts. Download the script first and run it as a separate `&&`-chained step so a failed download fails the layer. Kept as POSIX sh (no `pipefail`/bash dependency) so it works on all base images. fedora/alpine are unaffected (they install rust via the distro `rustup` package, no pipe). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
reaperhulk
approved these changes
May 22, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
All the
curl https://sh.rustup.rs -sSf | sh -s -- ...rustup installs share a footgun: a shell pipeline's exit status is that of the last command, notcurl. So whencurlfails — e.g. the transientcurl: (6) Could not resolve host: sh.rustup.rsseen in the 2026-05-22 scheduled Docker Image Builder run — it writes nothing to stdout, the downstreamshreads empty stdin and exits0, and the Docker layer "succeeds." The result is an image with no Rust toolchain, pushed to the mutable:ppc64letag.Downstream blast radius
That Rust-less
cryptography-manylinux_2_28:ppc64leimage then broke pyca/cryptography wheel/test jobs. With nocargoonPATH, maturin's PEP 517get_requires_for_build_wheelhook does:puccinialinisn't pinned in cryptography's hashedbuild-requirements.txt, souv build --require-hashesaborts withIn --require-hashes mode, all requirements must be pinned upfront with ==, but found: puccinialin. Everything in cryptography was correctly pinned — the unpinned, half-built container image was the culprit.Fix
Download the script first, then run it as a separate
&&-chained step, so a failed download fails the layer loudly:RUN curl -sSf https://sh.rustup.rs -o /tmp/rustup-init.sh && \ sh /tmp/rustup-init.sh -y <args> && \ rm /tmp/rustup-init.shApplied to all four affected Dockerfiles (
cryptography-linux,runners/{ubuntu,debian,rhel}). Kept as POSIXsh(nopipefail/bash dependency) so it works on every base image and doesn't alter the shell for otherRUNs.runners/fedoraandrunners/alpineare unaffected — they install rust via the distrorustuppackage and callrustup-initdirectly, no pipe.After merge, re-running the image builder will rebuild a correct image and unstick cryptography CI.
🤖 Generated with Claude Code