builder: add prune options to the API#37651
Conversation
api/types/types.go
Outdated
There was a problem hiding this comment.
@AkihiroSuda @vdemeester I'm not sure if I want KeepStorage here or KeepBytes like in Buildkit API, though on the CLIs it's --keep-storage. Let me know what you think.
There was a problem hiding this comment.
either is fine, but I think the type should be int64 in bytes
There was a problem hiding this comment.
@tiborvass same as @AkihiroSuda 😝, KeepStorage is fine 😉
There was a problem hiding this comment.
or errors.Wrap(err, "keep-duration expects an integer number in milliseconds")
api/types/types.go
Outdated
There was a problem hiding this comment.
Gonna summarize a conversation that @tiborvass and I had offline. If we've understood the criteria for pruning correctly a given cache layer will be kept if it meets the KeepDuration criterion and meets the KeepStorage criterion. In other words keep rules are conjunctive and by De Morgan's law, purge rules are disjunctive 😜
If that's the case I would rename KeepDuration to KeepMaxAge. Duration implies that the cached item will be kept around for that amount of time, whereas max age implies it will be kept for a maximum of that amount of time given all other criteria are also met.
ac354f6 to
dc9b62f
Compare
|
@tiborvass Hmm...janky no likey: |
There was a problem hiding this comment.
For my clarification:
Isnt all mutually exclusive with the Keep* options?
Also, what happens when KeepDuration is met but KeepStorage isnt or vice versa?
a39e158 to
88f575d
Compare
|
Only one failure on z known to be flakey: |
|
SGTM wrt getting apis for pruning things that are built |
@anusha-ragunathan There are different type of caches in buildkit: for regular cache, frontend images, internal images. By default only regular cache is pruned, but if you specify |
|
Talked with @tiborvass about this. The conclusion was to move the maxage to a filter, leave everything else as is as other fields are not really filters. For the gc, it is a list of these same options that just apply automatically and if the user wants to override they can do it with the config file initially. |
88f575d to
a60ee5d
Compare
a60ee5d to
16f3ae0
Compare
3af5dbc to
5340314
Compare
|
@tonistiigi @AkihiroSuda @vdemeester So this round of changes include:
|
|
Failures are unrelated. |
| } | ||
| ks, err := strconv.Atoi(r.FormValue("keep-storage")) | ||
| if err != nil { | ||
| return errors.Wrap(err, "keep-storage is in bytes and expects an integer") |
There was a problem hiding this comment.
nit: print values on parse errors
Signed-off-by: Tibor Vass <[email protected]>
Signed-off-by: Tibor Vass <[email protected]>
5340314 to
efdaf61
Compare
Signed-off-by: Tonis Tiigi <[email protected]> Signed-off-by: Tibor Vass <[email protected]>
efdaf61 to
354c241
Compare
|
@tonistiigi I pushed your fix for |
|
Looks like we forgot to update the API changelog document in this PR |
Signed-off-by: Tibor Vass [email protected]