mirror of
https://github.com/weaveworks/scope.git
synced 2026-03-03 02:00:43 +00:00
Rebuild images every 24hrs
This commit is contained in:
@@ -33,6 +33,11 @@ has_changes() {
|
||||
[ "$changes" -gt 0 ]
|
||||
}
|
||||
|
||||
commit_timestamp() {
|
||||
local rev=$1
|
||||
git show -s --format=%ct $rev
|
||||
}
|
||||
|
||||
cached_revision=$(cached_image_rev)
|
||||
if [ -z "$cached_revision" ]; then
|
||||
echo ">>> No cached image found; rebuilding"
|
||||
@@ -47,6 +52,12 @@ if has_changes $cached_revision $CIRCLE_SHA1 ; then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
if [ "$(commit_timestamp $cached_revision)" -lt "$(( $(date +%s) - 86400 ))" ]; then
|
||||
echo ">>> Image is more the 24hrs old; rebuilding"
|
||||
rebuild
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# we didn't rebuild; import cached version
|
||||
echo ">>> No changes found, importing cached image"
|
||||
docker load -i $CACHEDIR/$SAVEDNAME-$cached_revision
|
||||
|
||||
Reference in New Issue
Block a user