Restore IMAGE_FILTER_FLAGS default to label filter (closes #39621)
Summary
Fixes regression introduced by !6912 (merged).
Root cause
MR !6912 (merged) added per-type filter flags (CONTAINER_FILTER_FLAGS, IMAGE_FILTER_FLAGS, VOLUME_FILTER_FLAGS) to clear-docker-cache. However, IMAGE_FILTER_FLAGS was given an empty default:
IMAGE_FILTER_FLAGS="${IMAGE_FILTER_FLAGS:-}"This causes docker image prune -af to run without any --filter, deleting all unused images on the host — including images not managed by GitLab Runner.
Before !6912 (merged), the equivalent command was:
docker system prune -af --filter "label=com.gitlab.gitlab-runner.managed=true"Only runner-managed images were pruned.
Fix
Restore the default to match pre-!6912 behavior:
# Before (regression)
IMAGE_FILTER_FLAGS="${IMAGE_FILTER_FLAGS:-}"
# After
IMAGE_FILTER_FLAGS="${IMAGE_FILTER_FLAGS:-label=com.gitlab.gitlab-runner.managed=true}"Users who want to prune all unused images can still opt in by explicitly setting IMAGE_FILTER_FLAGS="".
Files changed
packaging/root/usr/share/gitlab-runner/clear-docker-cache— 1 line