Skip to content

Commit 2b2045d

Browse files
committed
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.
1 parent 8af675a commit 2b2045d

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)