feat: enable age-bounded NC01 BuildKit GC
This commit is contained in:
@@ -1192,7 +1192,7 @@ def collect_candidates(observed_at):
|
||||
if system_df["exitCode"] == 0:
|
||||
cache = parse_docker_build_cache(system_df["stdout"])
|
||||
if cache is not None and cache["reclaimableBytes"] > 0:
|
||||
until = str(OPTIONS.get("buildCacheUntil") or "24h")
|
||||
until = str(OPTIONS.get("buildCacheUntil") or host_docker_gc_section("buildCachePrune").get("until") or "24h")
|
||||
candidates.append({
|
||||
"id": "docker-builder:prune",
|
||||
"kind": "docker-build-cache-prune",
|
||||
@@ -1588,7 +1588,7 @@ def execute(candidate):
|
||||
if kind == "docker-build-cache-prune":
|
||||
if not host_docker_gc_enabled("buildCachePrune"):
|
||||
raise RuntimeError(host_docker_gc_reason("buildCachePrune", "refusing Docker builder prune on this provider"))
|
||||
until = str(OPTIONS.get("buildCacheUntil") or "24h")
|
||||
until = str(OPTIONS.get("buildCacheUntil") or host_docker_gc_section("buildCachePrune").get("until") or "24h")
|
||||
result = command(["docker", "builder", "prune", "--all", "--force", "--filter", "until=%s" % until], 45)
|
||||
if result["exitCode"] != 0:
|
||||
raise RuntimeError((result["stderr"] or "docker builder prune failed").strip())
|
||||
|
||||
@@ -47,7 +47,7 @@ const DEFAULT_REMOTE_OPTIONS: RemoteGcOptions = {
|
||||
dockerLogs: true,
|
||||
dockerLogMaxBytes: 50 * 1024 * 1024,
|
||||
buildCache: true,
|
||||
buildCacheUntil: "24h",
|
||||
buildCacheUntil: "",
|
||||
tmp: true,
|
||||
tmpMinAgeHours: 24,
|
||||
toolCaches: false,
|
||||
|
||||
Reference in New Issue
Block a user