mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
api: add BuildCache.Parents for API >= v1.42
This field was added to replace the deprecated "Parent" field. Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
parent
ebf339628a
commit
e0db8207f3
5 changed files with 18 additions and 1 deletions
|
@ -174,6 +174,8 @@ func (s *systemRouter) getDiskUsage(ctx context.Context, w http.ResponseWriter,
|
||||||
if versions.LessThan(version, "1.42") {
|
if versions.LessThan(version, "1.42") {
|
||||||
for _, b := range buildCache {
|
for _, b := range buildCache {
|
||||||
builderSize += b.Size
|
builderSize += b.Size
|
||||||
|
// Parents field was added in API 1.42 to replace the Parent field.
|
||||||
|
b.Parents = nil
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if versions.GreaterThanOrEqualTo(version, "1.42") {
|
if versions.GreaterThanOrEqualTo(version, "1.42") {
|
||||||
|
|
|
@ -2263,6 +2263,14 @@ definitions:
|
||||||
type: "string"
|
type: "string"
|
||||||
x-nullable: true
|
x-nullable: true
|
||||||
example: ""
|
example: ""
|
||||||
|
Parents:
|
||||||
|
description: |
|
||||||
|
List of parent build cache record IDs.
|
||||||
|
type: "array"
|
||||||
|
items:
|
||||||
|
type: "string"
|
||||||
|
x-nullable: true
|
||||||
|
example: ["hw53o5aio51xtltp5xjp8v7fx"]
|
||||||
Type:
|
Type:
|
||||||
type: "string"
|
type: "string"
|
||||||
description: |
|
description: |
|
||||||
|
@ -9068,6 +9076,7 @@ paths:
|
||||||
BuildCache:
|
BuildCache:
|
||||||
-
|
-
|
||||||
ID: "hw53o5aio51xtltp5xjp8v7fx"
|
ID: "hw53o5aio51xtltp5xjp8v7fx"
|
||||||
|
Parents: []
|
||||||
Type: "regular"
|
Type: "regular"
|
||||||
Description: "pulled from docker.io/library/debian@sha256:234cb88d3020898631af0ccbbcca9a66ae7306ecd30c9720690858c1b007d2a0"
|
Description: "pulled from docker.io/library/debian@sha256:234cb88d3020898631af0ccbbcca9a66ae7306ecd30c9720690858c1b007d2a0"
|
||||||
InUse: false
|
InUse: false
|
||||||
|
@ -9078,6 +9087,7 @@ paths:
|
||||||
UsageCount: 26
|
UsageCount: 26
|
||||||
-
|
-
|
||||||
ID: "ndlpt0hhvkqcdfkputsk4cq9c"
|
ID: "ndlpt0hhvkqcdfkputsk4cq9c"
|
||||||
|
Parents: ["ndlpt0hhvkqcdfkputsk4cq9c"]
|
||||||
Type: "regular"
|
Type: "regular"
|
||||||
Description: "mount / from exec /bin/sh -c echo 'Binary::apt::APT::Keep-Downloaded-Packages \"true\";' > /etc/apt/apt.conf.d/keep-cache"
|
Description: "mount / from exec /bin/sh -c echo 'Binary::apt::APT::Keep-Downloaded-Packages \"true\";' > /etc/apt/apt.conf.d/keep-cache"
|
||||||
InUse: false
|
InUse: false
|
||||||
|
|
|
@ -778,8 +778,10 @@ type BuildCache struct {
|
||||||
ID string
|
ID string
|
||||||
// Parent is the ID of the parent build cache record.
|
// Parent is the ID of the parent build cache record.
|
||||||
//
|
//
|
||||||
// Deprecated: deprecated in API v1.42 and up, as it was deprecated in BuildKit.
|
// Deprecated: deprecated in API v1.42 and up, as it was deprecated in BuildKit; use Parents instead.
|
||||||
Parent string `json:"Parent,omitempty"`
|
Parent string `json:"Parent,omitempty"`
|
||||||
|
// Parents is the list of parent build cache record IDs.
|
||||||
|
Parents []string `json:" Parents,omitempty"`
|
||||||
// Type is the cache record type.
|
// Type is the cache record type.
|
||||||
Type string
|
Type string
|
||||||
// Description is a description of the build-step that produced the build cache.
|
// Description is a description of the build-step that produced the build cache.
|
||||||
|
|
|
@ -130,6 +130,7 @@ func (b *Builder) DiskUsage(ctx context.Context) ([]*types.BuildCache, error) {
|
||||||
items = append(items, &types.BuildCache{
|
items = append(items, &types.BuildCache{
|
||||||
ID: r.ID,
|
ID: r.ID,
|
||||||
Parent: r.Parent, //nolint:staticcheck // ignore SA1019 (Parent field is deprecated)
|
Parent: r.Parent, //nolint:staticcheck // ignore SA1019 (Parent field is deprecated)
|
||||||
|
Parents: r.Parents,
|
||||||
Type: r.RecordType,
|
Type: r.RecordType,
|
||||||
Description: r.Description,
|
Description: r.Description,
|
||||||
InUse: r.InUse,
|
InUse: r.InUse,
|
||||||
|
|
|
@ -89,6 +89,8 @@ keywords: "API, Docker, rcli, REST, documentation"
|
||||||
with information about the created volume.
|
with information about the created volume.
|
||||||
* The `BuildCache.Parent` field, as returned by `GET /system/df` is deprecated
|
* 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.
|
and is now omitted. API versions before v1.42 continue to include this field.
|
||||||
|
* `GET /system/df` now includes a new `Parents` field, for "build-cache" records,
|
||||||
|
which contains a list of parent IDs for the build-cache record.
|
||||||
* Volume information returned by `GET /volumes/{name}`, `GET /volumes` and
|
* Volume information returned by `GET /volumes/{name}`, `GET /volumes` and
|
||||||
`GET /system/df` can now contain a `ClusterVolume` if the volume is a cluster
|
`GET /system/df` can now contain a `ClusterVolume` if the volume is a cluster
|
||||||
volume (requires the daemon to be a Swarm manager).
|
volume (requires the daemon to be a Swarm manager).
|
||||||
|
|
Loading…
Reference in a new issue