-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Description
I did this pull request,
And I realized that my example wasn't actually working. The error messages out of the docker daemon seem to imply that maybe the code is adding ='s to the config before passing it on. It also seems like I am not allowed to break up these "type" filters into a list.
So this appears to be working:
"filter": [
"unused-for=48h","type=source.local,type==exec.cachemount,type==source.git.checkout"
],
Note that is type=, type==, type==
# docker buildx inspect
Name: default
Driver: docker
Nodes:
Name: default
Endpoint: default
Status: running
BuildKit version: v0.16.0
Platforms: linux/amd64, linux/amd64/v2, linux/amd64/v3, linux/386
Labels:
org.mobyproject.buildkit.worker.moby.host-gateway-ip: 172.16.0.1
GC Policy rule#0:
All: false
Filters: type==source.local,type==exec.cachemount,type==source.git.checkout
Keep Duration: 48h0m0.212245572s
Keep Bytes: 8GiB
But this doesn't (daemon starts, but gc errors):
"filter": [
"unused-for=48h","type=source.local,type=exec.cachemount,type=source.git.checkout"
],
Note that is type=, type=, type=
level=error msg="gc error: filters: parse error: [type==source.local,type >|=|< exec.cachemount,type=source.git.checkout]: unsupported operator "=": invalid argument\nfailed to parse prune filters [type==source.local,type=exec.cachemount,type=source.git.checkout]\ngithub.com/moby/buildkit/cache.(*cacheManager).pruneOnce\n\t/root/rpmbuild/BUILD/src/engine/vendor/github.com/moby/buildkit/cache/manager.go:1030\ngithub.com/moby/buildkit/cache.(*cacheManager).Prune\n\t/root/rpmbuild/BUILD/src/engine/vendor/github.com/moby/buildkit/cache/manager.go:1010\ngithub.com/docker/docker/builder/builder-next/worker.(*Worker).Prune\n\t/root/rpmbuild/BUILD/src/engine/builder/builder-next/worker/worker.go:295\ngithub.com/moby/buildkit/control.(*Controller).gc.(*Controller).gc.func2.func3\n\t/root/rpmbuild/BUILD/src/engine/vendor/github.com/moby/buildkit/control/control.go:594\ngolang.org/x/sync/errgroup.(*Group).Go.func1\n\t/root/rpmbuild/BUILD/src/engine/vendor/golang.org/x/sync/errgroup/errgroup.go:78\nruntime.goexit\n\t/usr/local/go/src/runtime/asm_amd64.s:1695"
This also doesn't work (daemon won't even start):
"unused-for=48h","type=source.local","type=exec.cachemount","type=source.git.checkout"
I am guessing that the type=, type=, type= is expected to normally work, and that the internal parser code adds a '=' to the first =, but ignores the later ones in the strings.