From 5db3b753af8d17d670225c0e0aedef298996998d Mon Sep 17 00:00:00 2001 From: Aditya R Date: Mon, 16 Oct 2023 15:14:06 +0530 Subject: [PATCH] remote,build: wire unsetlabels Signed-off-by: Aditya R --- cmd/podman/common/build.go | 1 + pkg/api/handlers/compat/images_build.go | 2 ++ pkg/api/server/register_images.go | 6 ++++++ pkg/bindings/images/build.go | 4 ++++ 4 files changed, 13 insertions(+) diff --git a/cmd/podman/common/build.go b/cmd/podman/common/build.go index 100e6568d5..ca62f580c1 100644 --- a/cmd/podman/common/build.go +++ b/cmd/podman/common/build.go @@ -543,6 +543,7 @@ func buildFlagsWrapperToOptions(c *cobra.Command, contextDir string, flags *Buil Target: flags.Target, TransientMounts: flags.Volumes, UnsetEnvs: flags.UnsetEnvs, + UnsetLabels: flags.UnsetLabels, } if flags.IgnoreFile != "" { diff --git a/pkg/api/handlers/compat/images_build.go b/pkg/api/handlers/compat/images_build.go index b639000966..40741f56c6 100644 --- a/pkg/api/handlers/compat/images_build.go +++ b/pkg/api/handlers/compat/images_build.go @@ -140,6 +140,7 @@ func BuildImage(w http.ResponseWriter, r *http.Request) { Timestamp int64 `schema:"timestamp"` Ulimits string `schema:"ulimits"` UnsetEnvs []string `schema:"unsetenv"` + UnsetLabels []string `schema:"unsetlabel"` Volumes []string `schema:"volume"` }{ Dockerfile: "Dockerfile", @@ -711,6 +712,7 @@ func BuildImage(w http.ResponseWriter, r *http.Request) { SystemContext: systemContext, Target: query.Target, UnsetEnvs: query.UnsetEnvs, + UnsetLabels: query.UnsetLabels, } for _, platformSpec := range query.Platform { diff --git a/pkg/api/server/register_images.go b/pkg/api/server/register_images.go index 4c14f54140..0b9d0a500b 100644 --- a/pkg/api/server/register_images.go +++ b/pkg/api/server/register_images.go @@ -1617,6 +1617,12 @@ func (s *APIServer) registerImagesHandlers(r *mux.Router) error { // items: // type: string // - in: query + // name: unsetlabel + // description: Unset the image label, causing the label not to be inherited from the base image. + // type: array + // items: + // type: string + // - in: query // name: volume // description: Extra volumes that should be mounted in the build container. // type: array diff --git a/pkg/bindings/images/build.go b/pkg/bindings/images/build.go index 171c156bfa..3d21437b09 100644 --- a/pkg/bindings/images/build.go +++ b/pkg/bindings/images/build.go @@ -393,6 +393,10 @@ func Build(ctx context.Context, containerFiles []string, options entities.BuildO params.Add("unsetenv", uenv) } + for _, ulabel := range options.UnsetLabels { + params.Add("unsetlabel", ulabel) + } + var ( headers http.Header )