From 2b2045d16173b3db25c74680b25cae67d41248df Mon Sep 17 00:00:00 2001 From: Pietro Albini Date: Sun, 17 Feb 2019 22:24:13 +0100 Subject: [PATCH] ci: fix docker cache hash collision Before this commit the hash used to cache docker images was calculated from the image's files and the files in the scripts/ directory. This worked fine when all the files used by an image were in those directories, but some images pull files from other images, causing hash collisions in some cases. This commit changes the hash to include the files of all the docker images, causing a rebuild of all the images when a single one changes. That's a bit heavy-handed, but we have no way to track which files an image pulls in and hash collisions are really painful to deal with. --- src/ci/docker/run.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/ci/docker/run.sh b/src/ci/docker/run.sh index ad6188568cff2..25d4d73c7fe03 100755 --- a/src/ci/docker/run.sh +++ b/src/ci/docker/run.sh @@ -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}')