Rollup merge of #72027 - Mark-Simulacrum:ci-caches, r=pietroalbini

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.

r? @pietroalbini
This commit is contained in:
Dylan DPC 2020-05-11 22:20:55 +02:00 committed by GitHub
commit 9c4c52fd77
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 12 additions and 4 deletions

View File

@ -34,6 +34,7 @@ jobs:
CI_JOB_NAME: "${{ matrix.name }}"
SCCACHE_BUCKET: rust-lang-gha-caches
TOOLSTATE_REPO: "https://github.com/pietroalbini/rust-toolstate"
CACHE_DOMAIN: ci-caches-gha.rust-lang.org
if: "github.event_name == 'pull_request'"
strategy:
matrix:
@ -146,6 +147,7 @@ jobs:
TOOLSTATE_PUBLISH: 1
CACHES_AWS_ACCESS_KEY_ID: AKIA46X5W6CZOMUQATD5
ARTIFACTS_AWS_ACCESS_KEY_ID: AKIA46X5W6CZH5AYXDVF
CACHE_DOMAIN: ci-caches-gha.rust-lang.org
if: "github.event_name == 'push' && github.ref == 'refs/heads/try' && github.repository == 'rust-lang-ci/rust'"
strategy:
matrix:
@ -255,6 +257,7 @@ jobs:
TOOLSTATE_PUBLISH: 1
CACHES_AWS_ACCESS_KEY_ID: AKIA46X5W6CZOMUQATD5
ARTIFACTS_AWS_ACCESS_KEY_ID: AKIA46X5W6CZH5AYXDVF
CACHE_DOMAIN: ci-caches-gha.rust-lang.org
if: "github.event_name == 'push' && github.ref == 'refs/heads/auto' && github.repository == 'rust-lang-ci/rust'"
strategy:
matrix:
@ -606,6 +609,7 @@ jobs:
TOOLSTATE_PUBLISH: 1
CACHES_AWS_ACCESS_KEY_ID: AKIA46X5W6CZOMUQATD5
ARTIFACTS_AWS_ACCESS_KEY_ID: AKIA46X5W6CZH5AYXDVF
CACHE_DOMAIN: ci-caches-gha.rust-lang.org
if: "github.event_name == 'push' && github.ref == 'refs/heads/master' && github.repository == 'rust-lang-ci/rust'"
steps:
- name: checkout the source code

View File

@ -17,6 +17,8 @@ dist=$objdir/build/dist
source "$ci_dir/shared.sh"
CACHE_DOMAIN="${CACHE_DOMAIN:-ci-caches.rust-lang.org}"
if [ -f "$docker_dir/$image/Dockerfile" ]; then
if [ "$CI" != "" ]; then
hash_key=/tmp/.docker-hash-key.txt
@ -38,9 +40,7 @@ if [ -f "$docker_dir/$image/Dockerfile" ]; then
cksum=$(sha512sum $hash_key | \
awk '{print $1}')
s3url="s3://$SCCACHE_BUCKET/docker/$cksum"
url="https://$SCCACHE_BUCKET.s3.amazonaws.com/docker/$cksum"
upload="aws s3 cp - $s3url"
url="https://$CACHE_DOMAIN/docker/$cksum"
echo "Attempting to download $url"
rm -f /tmp/rustci_docker_cache
@ -65,7 +65,9 @@ if [ -f "$docker_dir/$image/Dockerfile" ]; then
-f "$dockerfile" \
"$context"
if [ "$upload" != "" ]; then
if [ "$CI" != "" ]; then
s3url="s3://$SCCACHE_BUCKET/docker/$cksum"
upload="aws s3 cp - $s3url"
digest=$(docker inspect rust-ci --format '{{.Id}}')
echo "Built container $digest"
if ! grep -q "$digest" <(echo "$loaded_images"); then

View File

@ -37,6 +37,7 @@ x--expand-yaml-anchors--remove:
- &public-variables
SCCACHE_BUCKET: rust-lang-gha-caches
TOOLSTATE_REPO: https://github.com/pietroalbini/rust-toolstate
CACHE_DOMAIN: ci-caches-gha.rust-lang.org
- &prod-variables
SCCACHE_BUCKET: rust-lang-gha-caches
@ -51,6 +52,7 @@ x--expand-yaml-anchors--remove:
# (caches, artifacts...).
CACHES_AWS_ACCESS_KEY_ID: AKIA46X5W6CZOMUQATD5
ARTIFACTS_AWS_ACCESS_KEY_ID: AKIA46X5W6CZH5AYXDVF
CACHE_DOMAIN: ci-caches-gha.rust-lang.org
- &base-job
env: {}