Skip to content

Commit c81abef

Browse files
authored
Merge pull request #42607 from rvolosatovs/fix_build_cache_formatting
Ensure empty build cache is represented as empty JSON array
2 parents 5e4da6c + 83e3dd6 commit c81abef

2 files changed

Lines changed: 28 additions & 0 deletions

File tree

api/server/router/system/system_routes.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,11 @@ func (s *systemRouter) getDiskUsage(ctx context.Context, w http.ResponseWriter,
120120

121121
du.BuilderSize = builderSize
122122
du.BuildCache = buildCache
123+
if buildCache == nil {
124+
// Ensure empty `BuildCache` field is represented as empty JSON array(`[]`)
125+
// instead of `null` to be consistent with `Images`, `Containers` etc.
126+
du.BuildCache = []*types.BuildCache{}
127+
}
123128

124129
return httputils.WriteJSON(w, http.StatusOK, du)
125130
}

api/swagger.yaml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8339,6 +8339,29 @@ paths:
83398339
UsageData:
83408340
Size: 10920104
83418341
RefCount: 2
8342+
BuildCache:
8343+
-
8344+
ID: "hw53o5aio51xtltp5xjp8v7fx"
8345+
Parent: ""
8346+
Type: "regular"
8347+
Description: "pulled from docker.io/library/debian@sha256:234cb88d3020898631af0ccbbcca9a66ae7306ecd30c9720690858c1b007d2a0"
8348+
InUse: false
8349+
Shared: true
8350+
Size: 0
8351+
CreatedAt: "2021-06-28T13:31:01.474619385Z"
8352+
LastUsedAt: "2021-07-07T22:02:32.738075951Z"
8353+
UsageCount: 26
8354+
-
8355+
ID: "ndlpt0hhvkqcdfkputsk4cq9c"
8356+
Parent: "hw53o5aio51xtltp5xjp8v7fx"
8357+
Type: "regular"
8358+
Description: "mount / from exec /bin/sh -c echo 'Binary::apt::APT::Keep-Downloaded-Packages \"true\";' > /etc/apt/apt.conf.d/keep-cache"
8359+
InUse: false
8360+
Shared: true
8361+
Size: 51
8362+
CreatedAt: "2021-06-28T13:31:03.002625487Z"
8363+
LastUsedAt: "2021-07-07T22:02:32.773909517Z"
8364+
UsageCount: 26
83428365
500:
83438366
description: "server error"
83448367
schema:

0 commit comments

Comments
 (0)