From 022273c1978609f36d35f9b81405d560f678c11a Mon Sep 17 00:00:00 2001 From: Aditya Rajan Date: Mon, 22 Nov 2021 16:35:21 +0530 Subject: compat: add layer caching compatiblity for non podman clients Non-podman clients do not set `layers` while making request. This is supposed to be `true` bydefault but `non-podman-clients i.e Docker` dont know about this field as a result they end up setting this values to `false`. Causing builds to never use cache for layers. Adds compatiblity for `docker SDK`. [NO NEW TESTS NEEDED] Signed-off-by: Aditya Rajan --- pkg/api/handlers/compat/images_build.go | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'pkg') diff --git a/pkg/api/handlers/compat/images_build.go b/pkg/api/handlers/compat/images_build.go index 6152f1c02..7bbc4b99c 100644 --- a/pkg/api/handlers/compat/images_build.go +++ b/pkg/api/handlers/compat/images_build.go @@ -134,6 +134,15 @@ func BuildImage(w http.ResponseWriter, r *http.Request) { return } + // if layers field not set assume its not from a valid podman-client + // could be a docker client, set `layers=true` since that is the default + // expected behviour + if !utils.IsLibpodRequest(r) { + if _, found := r.URL.Query()["layers"]; !found { + query.Layers = true + } + } + // convert addcaps formats var addCaps = []string{} if _, found := r.URL.Query()["addcaps"]; found { -- cgit v1.2.3-54-g00ecf From 13ee1788f9524319c01fdd019060cca5790f2f76 Mon Sep 17 00:00:00 2001 From: Aditya Rajan Date: Mon, 22 Nov 2021 21:14:10 +0530 Subject: swagger: add layers to build api docs Add missing `layer` entry to swagger docs for `/build`. Signed-off-by: Aditya Rajan --- pkg/api/server/register_images.go | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'pkg') diff --git a/pkg/api/server/register_images.go b/pkg/api/server/register_images.go index 38ceea271..bf8eeef40 100644 --- a/pkg/api/server/register_images.go +++ b/pkg/api/server/register_images.go @@ -1523,6 +1523,13 @@ func (s *APIServer) registerImagesHandlers(r *mux.Router) error { // JSON map of key, value pairs to set as labels on the new image // (As of version 1.xx) // - in: query + // name: layers + // type: boolean + // default: true + // description: | + // Cache intermediate layers during build. + // (As of version 1.xx) + // - in: query // name: networkmode // type: string // default: bridge -- cgit v1.2.3-54-g00ecf