prune: allow negative and prefix filters

Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
This commit is contained in:
Tonis Tiigi 2024-05-24 16:57:25 -07:00
parent 37c4ff0944
commit 781dcbd196
No known key found for this signature in database
GPG Key ID: AFA9DE5F8AB7AF39
1 changed files with 2 additions and 0 deletions

View File

@ -195,6 +195,8 @@ func toBuildkitPruneInfo(f filters.Args) (*client.PruneInfo, error) {
case 1:
if filterKey == "id" {
filters = append(filters, filterKey+"~="+values[0])
} else if strings.HasSuffix(filterKey, "!") || strings.HasSuffix(filterKey, "~") {
filters = append(filters, filterKey+"="+values[0])
} else {
filters = append(filters, filterKey+"=="+values[0])
}