Skip to content

Commit 54b7d45

Browse files
Use CDN for ci-caches on download
This will reduce costs, as well as lays the groundwork for developers to be able to locally pull the published docker images without needing AWS credentials.
1 parent 7b80539 commit 54b7d45

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

src/ci/docker/run.sh

+6-4
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ dist=$objdir/build/dist
1717

1818
source "$ci_dir/shared.sh"
1919

20+
CACHE_DOMAIN="${CACHE_DOMAIN:-ci-caches.rust-lang.org}"
21+
2022
if [ -f "$docker_dir/$image/Dockerfile" ]; then
2123
if [ "$CI" != "" ]; then
2224
hash_key=/tmp/.docker-hash-key.txt
@@ -38,9 +40,7 @@ if [ -f "$docker_dir/$image/Dockerfile" ]; then
3840
cksum=$(sha512sum $hash_key | \
3941
awk '{print $1}')
4042

41-
s3url="s3://$SCCACHE_BUCKET/docker/$cksum"
42-
url="https://$SCCACHE_BUCKET.s3.amazonaws.com/docker/$cksum"
43-
upload="aws s3 cp - $s3url"
43+
url="https://$CACHE_DOMAIN/docker/$cksum"
4444

4545
echo "Attempting to download $url"
4646
rm -f /tmp/rustci_docker_cache
@@ -65,7 +65,9 @@ if [ -f "$docker_dir/$image/Dockerfile" ]; then
6565
-f "$dockerfile" \
6666
"$context"
6767

68-
if [ "$upload" != "" ]; then
68+
if [ "$CI" != "" ]; then
69+
s3url="s3://$SCCACHE_BUCKET/docker/$cksum"
70+
upload="aws s3 cp - $s3url"
6971
digest=$(docker inspect rust-ci --format '{{.Id}}')
7072
echo "Built container $digest"
7173
if ! grep -q "$digest" <(echo "$loaded_images"); then

0 commit comments

Comments
 (0)