Skip to content

Commit

Permalink
removes default disk min duplication. bk-check-disk-space will have t…
Browse files Browse the repository at this point in the history
…he default
  • Loading branch information
Arturo Pie committed Oct 6, 2019
1 parent 0ae78f3 commit dfa2eb3
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
4 changes: 2 additions & 2 deletions packer/linux/conf/buildkite-agent/hooks/environment
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,13 @@ if ! docker ps ; then
fi

echo "Checking disk space"
if ! /usr/local/bin/bk-check-disk-space.sh "${DISK_MIN_AVAILABLE:-5G}" ; then
if ! /usr/local/bin/bk-check-disk-space.sh "${DISK_MIN_AVAILABLE:-}" ; then

echo "Cleaning up docker resources older than ${DOCKER_PRUNE_UNTIL:-4h}"
docker image prune --all --force --filter "until=${DOCKER_PRUNE_UNTIL:-4h}"

echo "Checking disk space again"
if ! /usr/local/bin/bk-check-disk-space.sh "${DISK_MIN_AVAILABLE:-5G}"; then
if ! /usr/local/bin/bk-check-disk-space.sh "${DISK_MIN_AVAILABLE:-}"; then
echo "Disk health checks failed" >&2
exit 1
fi
Expand Down
6 changes: 2 additions & 4 deletions packer/linux/conf/docker/cron.hourly/docker-low-disk-gc
Original file line number Diff line number Diff line change
Expand Up @@ -21,18 +21,16 @@ trap mark_instance_unhealthy ERR
if [[ -f /var/lib/buildkite-agent/cron-env ]] ; then
# shellcheck source=/dev/null
source /var/lib/buildkite-agent/cron-env
else
DISK_MIN_AVAILABLE=5G
fi

## -----------------------------------------------------------------
## Check disk, we only want to prune images/containers if we have to

if ! /usr/local/bin/bk-check-disk-space.sh "$DISK_MIN_AVAILABLE" ; then
if ! /usr/local/bin/bk-check-disk-space.sh "${DISK_MIN_AVAILABLE:-}" ; then
echo "Cleaning up docker resources older than 1h"
docker image prune --all --force --filter "until=1h"

if ! /usr/local/bin/bk-check-disk-space.sh "$DISK_MIN_AVAILABLE" ; then
if ! /usr/local/bin/bk-check-disk-space.sh "${DISK_MIN_AVAILABLE:-}" ; then
echo "Disk health checks failed" >&2
exit 1
fi
Expand Down

0 comments on commit dfa2eb3

Please sign in to comment.