1
Fork 0

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.
This commit is contained in:
Pietro Albini 2019-02-17 22:24:13 +01:00
parent 8af675a075
commit 2b2045d161
No known key found for this signature in database
GPG key ID: 3E06ABE80BAAF19C

View file

@ -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}')