api: deprecate BuildCache.Parent in API >= v1.42

This field has been deprecated in BuildKit, so this follows the deprecation
in the Engine API.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
Sebastiaan van Stijn 2022-05-23 12:56:39 +02:00
parent e0286d7f4e
commit ebf339628a
No known key found for this signature in database
GPG key ID: 76698F39D527CE8C
5 changed files with 17 additions and 5 deletions

View file

@ -176,6 +176,13 @@ func (s *systemRouter) getDiskUsage(ctx context.Context, w http.ResponseWriter,
builderSize += b.Size
}
}
if versions.GreaterThanOrEqualTo(version, "1.42") {
for _, b := range buildCache {
// Parent field is deprecated in API v1.42 and up, as it is deprecated
// in BuildKit. Empty the field to omit it in the API response.
b.Parent = "" //nolint:staticcheck // ignore SA1019 (Parent field is deprecated)
}
}
du := types.DiskUsage{
BuildCache: buildCache,

View file

@ -2258,8 +2258,11 @@ definitions:
Parent:
description: |
ID of the parent build cache record.
> **Deprecated**: This field is deprecated, and omitted if empty.
type: "string"
example: "hw53o5aio51xtltp5xjp8v7fx"
x-nullable: true
example: ""
Type:
type: "string"
description: |
@ -9065,7 +9068,6 @@ paths:
BuildCache:
-
ID: "hw53o5aio51xtltp5xjp8v7fx"
Parent: ""
Type: "regular"
Description: "pulled from docker.io/library/debian@sha256:234cb88d3020898631af0ccbbcca9a66ae7306ecd30c9720690858c1b007d2a0"
InUse: false
@ -9076,7 +9078,6 @@ paths:
UsageCount: 26
-
ID: "ndlpt0hhvkqcdfkputsk4cq9c"
Parent: "hw53o5aio51xtltp5xjp8v7fx"
Type: "regular"
Description: "mount / from exec /bin/sh -c echo 'Binary::apt::APT::Keep-Downloaded-Packages \"true\";' > /etc/apt/apt.conf.d/keep-cache"
InUse: false

View file

@ -777,7 +777,9 @@ type BuildCache struct {
// ID is the unique ID of the build cache record.
ID string
// Parent is the ID of the parent build cache record.
Parent string
//
// Deprecated: deprecated in API v1.42 and up, as it was deprecated in BuildKit.
Parent string `json:"Parent,omitempty"`
// Type is the cache record type.
Type string
// Description is a description of the build-step that produced the build cache.

View file

@ -129,7 +129,7 @@ func (b *Builder) DiskUsage(ctx context.Context) ([]*types.BuildCache, error) {
for _, r := range duResp.Record {
items = append(items, &types.BuildCache{
ID: r.ID,
Parent: r.Parent,
Parent: r.Parent, //nolint:staticcheck // ignore SA1019 (Parent field is deprecated)
Type: r.RecordType,
Description: r.Description,
InUse: r.InUse,

View file

@ -87,6 +87,8 @@ keywords: "API, Docker, rcli, REST, documentation"
volume (CNI). This option can only be used if the daemon is a Swarm manager.
The Volume response on creation now also can contain a `ClusterVolume` field
with information about the created volume.
* The `BuildCache.Parent` field, as returned by `GET /system/df` is deprecated
and is now omitted. API versions before v1.42 continue to include this field.
* Volume information returned by `GET /volumes/{name}`, `GET /volumes` and
`GET /system/df` can now contain a `ClusterVolume` if the volume is a cluster
volume (requires the daemon to be a Swarm manager).