Skip to content

Commit

Permalink
Auto merge of #58549 - pietroalbini:fix-docker-ci-hash, r=Mark-Simula…
Browse files Browse the repository at this point in the history
…crum

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
  • Loading branch information
bors committed Feb 18, 2019
2 parents 684b09b + 2b2045d commit 146aa60
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/ci/docker/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ travis_time_start
if [ -f "$docker_dir/$image/Dockerfile" ]; then
if [ "$CI" != "" ]; then
hash_key=/tmp/.docker-hash-key.txt
find $docker_dir/$image $docker_dir/scripts -type f | \
sort | \
xargs cat >> $hash_key
rm -f "${hash_key}"
echo $image >> $hash_key
find $docker_dir -type f | sort | xargs cat >> $hash_key
docker --version >> $hash_key
cksum=$(sha512sum $hash_key | \
awk '{print $1}')
Expand Down

0 comments on commit 146aa60

Please sign in to comment.