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.
diff --git a/src/ci/docker/run.sh b/src/ci/docker/run.sh
index ad61885..25d4d73 100755
--- a/src/ci/docker/run.sh
+++ b/src/ci/docker/run.sh
@@ -20,9 +20,9 @@
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}')