diff --git a/api/server/router/system/system_routes.go b/api/server/router/system/system_routes.go index bb7897d229..01addc6754 100644 --- a/api/server/router/system/system_routes.go +++ b/api/server/router/system/system_routes.go @@ -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, diff --git a/api/swagger.yaml b/api/swagger.yaml index 215b309b7f..81197b6097 100644 --- a/api/swagger.yaml +++ b/api/swagger.yaml @@ -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 diff --git a/api/types/types.go b/api/types/types.go index 5f05fb232b..346d010cff 100644 --- a/api/types/types.go +++ b/api/types/types.go @@ -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. diff --git a/builder/builder-next/builder.go b/builder/builder-next/builder.go index 81688e2185..15fdb9fc40 100644 --- a/builder/builder-next/builder.go +++ b/builder/builder-next/builder.go @@ -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, diff --git a/docs/api/version-history.md b/docs/api/version-history.md index 4bc2cfc270..b8ec2a38da 100644 --- a/docs/api/version-history.md +++ b/docs/api/version-history.md @@ -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).