builder: wire up new gc types for buildkit prune functionality#48720
builder: wire up new gc types for buildkit prune functionality#48720vvoland merged 1 commit intomoby:masterfrom
Conversation
| const defaultCap int64 = 2e9 // 2GB | ||
| const ( | ||
| defaultReservedSpaceBytes int64 = 2e9 // 2GB | ||
| defaultMaxUsedSpaceBytes int64 = 10e9 // 10GB |
There was a problem hiding this comment.
If for some reason the disk size can not be detected then maxused and minfree should be left empty.
| return defaultCap | ||
| import "github.com/containerd/errdefs" | ||
|
|
||
| func detectDiskSize(_ string) (int64, error) { |
There was a problem hiding this comment.
In buildkit we do have windows implementation and it seems to be in a reusable function.
There was a problem hiding this comment.
Switched to using this implementation. It also means I can just delete both of these files.
8423932 to
78356dd
Compare
|
Updated the swagger API and found a few additional places I missed by grepping for |
acd6af2 to
4e3c41c
Compare
4e3c41c to
d6b6b79
Compare
|
Updated the default gc policy code after some offline feedback from @tonistiigi. |
| bs, err := strconv.Atoi(fv) | ||
| if err != nil { | ||
| return invalidParam{errors.Wrapf(err, "keep-storage is in bytes and expects an integer, got %v", fv)} | ||
| } |
There was a problem hiding this comment.
As this is a new API-level feature - we should either:
- Not backport this to 27.x
- Ship API v1.48 in 27.4 and move the current 1.48 API features to 1.49
There was a problem hiding this comment.
Looks like this one dropped of my radar 🙈
Yes, I'm considering to skip this one for 27.4; IIUC, without this patch, things continue to work "as before", just the new options not being exposed (?).
For these changes above though, possibly we need some API-version gates? (need to look closer)
|
Since we're only targeting v28 are we ok to merge this? @jsternberg can we get this to a green/merge state? |
d6b6b79 to
c3646c4
Compare
|
This is rebased now. The failing test doesn't seem to be related. |
54b8050 to
998dca6
Compare
|
@vvoland @thaJeztah - API version check? |
vvoland
left a comment
There was a problem hiding this comment.
New options should be API version gated.
docs/api/version-history.md also needs an entry for the newly supported options
|
@vvoland done. I've never done it before so please double check that I did it correctly. If this is API version-gated, do we need the fallback code for |
vvoland
left a comment
There was a problem hiding this comment.
Thanks, looks good but spotted some minor issues.
Could you also update the description for the release notes to be more human-facing?
Mostly thinking about showing the user how to use it. Something along the lines of "docker buildx prune now supports X, Y and Y",
7e90232 to
f818f19
Compare
|
Done. |
f818f19 to
68e1fca
Compare
| Filters filters.Args | ||
|
|
||
| // FIXME(thaJeztah): add new options; see https://github.com/moby/moby/issues/48639 | ||
| KeepStorage int64 // Deprecated: deprecated in API 1.48. |
There was a problem hiding this comment.
for a follow up, should also update: https://github.com/docker/cli/blob/master/docs/deprecated.md
| if opts.All { | ||
| query.Set("all", "1") | ||
| } | ||
| query.Set("keep-storage", strconv.Itoa(int(opts.KeepStorage))) |
There was a problem hiding this comment.
We're still keeping KeepStorage as deprecated, so we should still set it.
There was a problem hiding this comment.
Restored this code.
This wires up the new gc types that buildkit exposes in version 0.17. The previous flag, `KeepBytes`, was renamed to `ReservedBytes` and two new options, `MaxUsed` and `MinFree` were added. `MaxUsed` corresponds to the maximum amount of space that buildkit will use for the build cache and `MinFree` amount of free disk space for the system to prevent the cache from using that space. This allows greater configuration of the cache storage usage when used in situations where docker is not the only service on the system using disk space. Signed-off-by: Jonathan A. Sternberg <[email protected]>
68e1fca to
8e52968
Compare
- What I did
This wires up the new gc types that buildkit exposes in version 0.17. The previous flag,
KeepBytes, was renamed toReservedBytesand two new options,MaxUsedandMinFreewere added.MaxUsedcorresponds to the maximum amount of space that buildkit willuse for the build cache and
MinFreeamount of free disk space for thesystem to prevent the cache from using that space. This allows greater
configuration of the cache storage usage when used in situations where
docker is not the only service on the system using disk space.
Fixes #48639.
- How I did it
Modified the areas marked by @thaJeztah in #48639.
- How to verify it
Added some test cases to check that the old and new config options work.
- Description for the changelog
- A picture of a cute animal (not mandatory but encouraged)