Skip to content

Commit

Permalink
Download rust CI Docker images from a registry
Browse files Browse the repository at this point in the history
  • Loading branch information
Kobzol committed Jan 21, 2024
1 parent c6f81da commit fb7b525
Showing 1 changed file with 5 additions and 10 deletions.
15 changes: 5 additions & 10 deletions ci/fetch-rust-docker.bash
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ RUST_REPO="https://github.com/rust-lang/rust"
ARTIFACTS_BASE_URL="https://ci-artifacts.rust-lang.org/rustc-builds"

# A `Dockerfile` under `rustup`'s `ci/docker` directory may start with `FROM rust-$TARGET`.
# This means it is using an S3-cached Docker image provided by `rustc`'s CI.
# This means it is using a Docker image fetched from a container registry provided by `rustc`'s CI.
LOCAL_DOCKER_TAG="rust-$TARGET"
# The following is a mapping from `$TARGET`s to cached Docker images built from `Dockerfile`s under
# <https://github.com/rust-lang/rust/blob/master/src/ci/docker/host-x86_64/>,
Expand Down Expand Up @@ -51,16 +51,11 @@ info="/tmp/image-$image.txt"

rm -f "$info"
curl -o "$info" "$image_url"
digest=$(grep -m1 ^sha "$info")

if [ -z "$(docker images -q "${LOCAL_DOCKER_TAG}")" ]; then
url=$(grep -m1 ^https "$info")
cache=/tmp/rustci_docker_cache
echo "Attempting to download $url"
rm -f "$cache"
set +e
command_retry curl -y 30 -Y 10 --connect-timeout 30 -f -L -C - -o "$cache" "$url"
set -e
docker load --quiet -i "$cache"
docker tag "$digest" "${LOCAL_DOCKER_TAG}"
image_tag=$(cat $info)
echo "Attempting to pull image ${image_tag}"
docker pull "${image_tag}"
docker tag "${image_tag}" "${LOCAL_DOCKER_TAG}"
fi

0 comments on commit fb7b525

Please sign in to comment.