Skip to content

Commit 2da57d2

Browse files
author
Lachlan Donald
committed
Merge pull request #642 from buildkite/docker-builder-prune
Docker builder prune
1 parent 7ff3b93 commit 2da57d2

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

packer/conf/docker/cron.hourly/docker-low-disk-gc

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ mark_instance_unhealthy() {
1212
killall -QUIT buildkite-agent || true
1313

1414
# mark the instance for termination
15+
echo "Marking instance as unhealthy"
1516
aws autoscaling set-instance-health \
1617
--instance-id "$(curl http://169.254.169.254/latest/meta-data/instance-id)" \
1718
--health-status Unhealthy
@@ -20,11 +21,13 @@ mark_instance_unhealthy() {
2021
trap mark_instance_unhealthy ERR
2122

2223
## -----------------------------------------------------------------
23-
## Check disk, we only want to prune images/containers if we have to
24+
## Check disk, we only want to prune images/containers/build caches
25+
## if we really need to
2426

2527
if ! /usr/local/bin/bk-check-disk-space.sh ; then
2628
echo "Cleaning up docker resources older than ${DOCKER_PRUNE_UNTIL}"
2729
docker image prune --all --force --filter "until=${DOCKER_PRUNE_UNTIL}"
30+
docker builder prune --all --force --filter "until=${DOCKER_PRUNE_UNTIL}"
2831

2932
if ! /usr/local/bin/bk-check-disk-space.sh ; then
3033
echo "Disk health checks failed" >&2

0 commit comments

Comments
 (0)