Prevent spuriously needing to rebuild the docker image when the network
was down.
Also, adjusted the retry function to insert a sleep between retries,
because retrying immediately will often just hit the same issue.
s3url="s3://$SCCACHE_BUCKET/docker/$cksum"
url="https://s3-us-west-1.amazonaws.com/$SCCACHE_BUCKET/docker/$cksum"
echo "Attempting to download $s3url"
s3url="s3://$SCCACHE_BUCKET/docker/$cksum"
url="https://s3-us-west-1.amazonaws.com/$SCCACHE_BUCKET/docker/$cksum"
echo "Attempting to download $s3url"
+ rm -f /tmp/rustci_docker_cache
- loaded_images=$(curl $url | docker load | sed 's/.* sha/sha/')
+ retry curl -f -L -C - -o /tmp/rustci_docker_cache "$url"
+ loaded_images=$(docker load -i /tmp/rustci_docker_cache | sed 's/.* sha/sha/')
set -e
echo "Downloaded containers:\n$loaded_images"
fi
set -e
echo "Downloaded containers:\n$loaded_images"
fi
while true; do
"$@" && break || {
if [[ $n -lt $max ]]; then
while true; do
"$@" && break || {
if [[ $n -lt $max ]]; then
+ sleep $n # don't retry immediately
((n++))
echo "Command failed. Attempt $n/$max:"
else
echo "The command has failed after $n attempts."
((n++))
echo "Command failed. Attempt $n/$max:"
else
echo "The command has failed after $n attempts."