Skip to content

Commit

Permalink
remote,build: wire unsetlabels
Browse files Browse the repository at this point in the history
Signed-off-by: Aditya R <[email protected]>
  • Loading branch information
flouthoc committed Oct 16, 2023
1 parent 331e47a commit 5db3b75
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 0 deletions.
1 change: 1 addition & 0 deletions cmd/podman/common/build.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 != "" {
Expand Down
2 changes: 2 additions & 0 deletions pkg/api/handlers/compat/images_build.go
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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 {
Expand Down
6 changes: 6 additions & 0 deletions pkg/api/server/register_images.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 4 additions & 0 deletions pkg/bindings/images/build.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
)
Expand Down

0 comments on commit 5db3b75

Please sign in to comment.