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:
parent
8af675a075
commit
2b2045d161
1 changed files with 3 additions and 3 deletions
|
@ -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}')
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue