Skip to content

Commit 4b2a6b9

Browse files
committed
WIP
1 parent 39067f2 commit 4b2a6b9

File tree

3 files changed

+32
-18
lines changed

3 files changed

+32
-18
lines changed

.github/workflows/ci.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ name: CI
2828
- "**"
2929
permissions:
3030
contents: read
31+
packages: write
3132
defaults:
3233
run:
3334
shell: bash
@@ -42,6 +43,7 @@ jobs:
4243
CI_JOB_NAME: "${{ matrix.name }}"
4344
CARGO_REGISTRIES_CRATES_IO_PROTOCOL: sparse
4445
HEAD_SHA: "${{ github.event.pull_request.head.sha || github.sha }}"
46+
DOCKER_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
4547
SCCACHE_BUCKET: rust-lang-ci-sccache2
4648
TOOLSTATE_REPO: "https://github.com/rust-lang-nursery/rust-toolstate"
4749
CACHE_DOMAIN: ci-caches.rust-lang.org
@@ -162,6 +164,7 @@ jobs:
162164
CI_JOB_NAME: "${{ matrix.name }}"
163165
CARGO_REGISTRIES_CRATES_IO_PROTOCOL: sparse
164166
HEAD_SHA: "${{ github.event.pull_request.head.sha || github.sha }}"
167+
DOCKER_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
165168
SCCACHE_BUCKET: rust-lang-ci-sccache2
166169
DEPLOY_BUCKET: rust-lang-ci2
167170
TOOLSTATE_REPO: "https://github.com/rust-lang-nursery/rust-toolstate"
@@ -552,6 +555,7 @@ jobs:
552555
CI_JOB_NAME: "${{ matrix.name }}"
553556
CARGO_REGISTRIES_CRATES_IO_PROTOCOL: sparse
554557
HEAD_SHA: "${{ github.event.pull_request.head.sha || github.sha }}"
558+
DOCKER_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
555559
SCCACHE_BUCKET: rust-lang-ci-sccache2
556560
DEPLOY_BUCKET: rust-lang-ci2
557561
TOOLSTATE_REPO: "https://github.com/rust-lang-nursery/rust-toolstate"

src/ci/docker/run.sh

Lines changed: 26 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -70,24 +70,29 @@ if [ -f "$docker_dir/$image/Dockerfile" ]; then
7070
cksum=$(sha512sum $hash_key | \
7171
awk '{print $1}')
7272

73-
url="https://$CACHE_DOMAIN/docker/$cksum"
73+
# echo "Looking for ${cksum}"
74+
echo ${DOCKER_TOKEN} | docker login ghcr.io --username kobzol --password-stdin
75+
# docker manifest inspect tensorflow/tensorflow:latestx 2> /dev/null ; echo $?
76+
# docker pull ghcr.io/kobzol/rust-ci:${cksum}
7477

75-
echo "Attempting to download $url"
76-
rm -f /tmp/rustci_docker_cache
77-
set +e
78-
retry curl --max-time 600 -y 30 -Y 10 --connect-timeout 30 -f -L -C - \
79-
-o /tmp/rustci_docker_cache "$url"
78+
# url="https://$CACHE_DOMAIN/docker/$cksum"
8079

81-
docker_archive_hash=$(sha512sum /tmp/rustci_docker_cache | awk '{print $1}')
82-
echo "Downloaded archive hash: ${docker_archive_hash}"
80+
# echo "Attempting to download $url"
81+
# rm -f /tmp/rustci_docker_cache
82+
# set +e
83+
# retry curl --max-time 600 -y 30 -Y 10 --connect-timeout 30 -f -L -C - \
84+
# -o /tmp/rustci_docker_cache "$url"
8385

84-
echo "Loading images into docker"
86+
# docker_archive_hash=$(sha512sum /tmp/rustci_docker_cache | awk '{print $1}')
87+
# echo "Downloaded archive hash: ${docker_archive_hash}"
88+
89+
# echo "Loading images into docker"
8590
# docker load sometimes hangs in the CI, so time out after 10 minutes with TERM,
8691
# KILL after 12 minutes
87-
loaded_images=$(/usr/bin/timeout -k 720 600 docker load -i /tmp/rustci_docker_cache \
88-
| sed 's/.* sha/sha/')
89-
set -e
90-
printf "Downloaded containers:\n$loaded_images\n"
92+
# loaded_images=$(/usr/bin/timeout -k 720 600 docker load -i /tmp/rustci_docker_cache \
93+
# | sed 's/.* sha/sha/')
94+
# set -e
95+
# printf "Downloaded containers:\n$loaded_images\n"
9196
fi
9297

9398
dockerfile="$docker_dir/$image/Dockerfile"
@@ -100,19 +105,22 @@ if [ -f "$docker_dir/$image/Dockerfile" ]; then
100105
echo "::group::Building docker image for $image"
101106
echo ${cksum}
102107

103-
export DOCKER_BUILDKIT=0
108+
# export DOCKER_BUILDKIT=0
109+
docker buildx create --use --driver docker-container
104110
retry docker \
111+
buildx \
105112
build \
106113
--rm \
107114
-t rust-ci \
108115
-f "$dockerfile" \
116+
--cache-from type=registry,ref=ghcr.io/kobzol/rust-ci:${cksum} \
117+
--cache-to type=registry,ref=ghcr.io/kobzol/rust-ci:${cksum} \
118+
--output=type=docker \
109119
"$context"
110120
echo "::endgroup::"
111121
docker images
112-
docker tag rust-ci ghcr.io/kobzol/rust-ci:${cksum}
113-
114-
docker login --username kobzol --password ${GITHUB_TOKEN}
115-
docker push ghcr.io/kobzol/rust-ci:${cksum}
122+
# docker tag rust-ci ghcr.io/kobzol/rust-ci:${cksum}
123+
# docker push ghcr.io/kobzol/rust-ci:${cksum}
116124

117125
if [ "$CI" != "" ]; then
118126
# s3url="s3://$SCCACHE_BUCKET/docker/$cksum"

src/ci/github-actions/ci.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ x--expand-yaml-anchors--remove:
3434
CARGO_REGISTRIES_CRATES_IO_PROTOCOL: sparse
3535
# commit of PR sha or commit sha. `GITHUB_SHA` is not accurate for PRs.
3636
HEAD_SHA: ${{ github.event.pull_request.head.sha || github.sha }}
37+
DOCKER_TOKEN: ${{ secrets.GITHUB_TOKEN }}
3738

3839
- &public-variables
3940
SCCACHE_BUCKET: rust-lang-ci-sccache2
@@ -301,6 +302,7 @@ on:
301302

302303
permissions:
303304
contents: read
305+
packages: write
304306

305307
defaults:
306308
run:

0 commit comments

Comments
 (0)