Skip to content

Commit 146aa60

Browse files
committed
Auto merge of #58549 - pietroalbini:fix-docker-ci-hash, r=Mark-Simulacrum
ci: fix docker cache hash collision #58416 uncovered a bug in our caching for docker images: if the image `foo` pulls files from the image `bar` and a file in `bar` changed, the hash of `foo` will be the same even though it should be different. In that PR's case, `dist-i686-linux` pulls scripts from `dist-x86_64-linux`, and the PR only changed those scripts, causing an hash collision for `dist-i686-linux`. We have to fix this, since the image will be rebuilt every time bors switches from testing master to testing beta/stable (and when it switches back), making CI way more painful than it currently is. The approach used by this PR is to just include all the files in `src/ci/docker` in the hash. It's a bit heavy-handed and it will cause a rebuild of all the images every time a single image changes, but it's the best I can think of. r? @Mark-Simulacrum cc @alexcrichton @kennytm
2 parents 684b09b + 2b2045d commit 146aa60

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/ci/docker/run.sh

+3-3
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,9 @@ travis_time_start
2020
if [ -f "$docker_dir/$image/Dockerfile" ]; then
2121
if [ "$CI" != "" ]; then
2222
hash_key=/tmp/.docker-hash-key.txt
23-
find $docker_dir/$image $docker_dir/scripts -type f | \
24-
sort | \
25-
xargs cat >> $hash_key
23+
rm -f "${hash_key}"
24+
echo $image >> $hash_key
25+
find $docker_dir -type f | sort | xargs cat >> $hash_key
2626
docker --version >> $hash_key
2727
cksum=$(sha512sum $hash_key | \
2828
awk '{print $1}')

0 commit comments

Comments
 (0)