Pulizia: dopo ogni esecuzione la cache se ne va solo se nessuno la usa da 24 ore
Alla fine di ogni lavoro «immagine», cioè a ogni push di ogni ramo, «docker builder prune -f» senza filtro toglieva dal builder del demone tutta la cache che nessuna immagine condivide, di qualunque età e di tutti i progetti: gli strati intermedi e le cache montate che Encelado o Mimante avevano usato mezz'ora prima. Alla cache di Febe non serviva (stava nel builder dell'esecuzione, già tolto) e annullava la finestra di 24 ore della pulizia del lunedì (rilievo della revisione). Ora anche dopo ogni esecuzione «--filter until=24h», che BuildKit confronta con l'ultimo uso: una costruzione che si ripete almeno una volta al giorno ritrova la sua cache. Il compito chiedeva il comando senza filtro; la scelta resta di Alberto, e per tornarci basta togliere il filtro. Le immagini senza nome restano senza filtro, come prima. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
086b603801
commit
483d57b89a
10 files changed
+29
-22
No files matched your search
@@ -44,13 +44,14 @@ public sealed partial class PipelineTests
|
||||
}
|
||||
|
||||
// Only these prunes: what nothing uses after every run, the narrow weekly of before, and in the complete
|
||||
// cleanup every unused image and all the cache, but only with the filter of 24 hours.
|
||||
// cleanup every unused image and all the cache. The cache always with the filter of 24 hours, after every run
|
||||
// too: other projects build with the daemon's builder, and what they used today stays.
|
||||
string[] allowed =
|
||||
[
|
||||
"image prune -f",
|
||||
"image prune -f --filter \"until=72h\"",
|
||||
"image prune -a -f --filter \"until=24h\"",
|
||||
"builder prune -f",
|
||||
"builder prune -f --filter \"until=24h\"",
|
||||
"builder prune -a -f --filter \"until=24h\"",
|
||||
];
|
||||
CollectionAssert.AreEquivalent(allowed, Prune().Matches(cleanup).Select(m => $"{m.Groups["what"].Value} prune{m.Groups["args"].Value.TrimEnd()}").Distinct().ToList());
|
||||
@@ -253,7 +254,7 @@ public sealed partial class PipelineTests
|
||||
CollectionAssert.AreEquivalent(SharedDaemon.VolumeNames, run.Volumes, run.Report);
|
||||
CollectionAssert.AreEquivalent(SharedDaemon.NetworkNames, run.Networks, run.Report);
|
||||
CollectionAssert.Contains(run.Calls, "BUILDX_BUILDER=default docker image prune -f");
|
||||
CollectionAssert.Contains(run.Calls, "BUILDX_BUILDER=default docker builder prune -f", "the dangling cache of the daemon's builder, without -a");
|
||||
CollectionAssert.Contains(run.Calls, "BUILDX_BUILDER=default docker builder prune -f --filter until=24h", "the dangling cache of the daemon's builder, without -a, unused for a day");
|
||||
|
||||
// A daemon that refuses: two warnings, and the job of the run stays green.
|
||||
var refused = await RunCleanupAsync(bash, SharedDaemon.World with { Broken = ["image prune", "builder prune"] }, "penzolanti");
|
||||
|
||||
Reference in new issue
Block a user