mirror of
https://github.com/containers/podman.git
synced 2025-05-17 06:59:07 +08:00
Add inherit-labels option to Build API
Add the inherit-labels option to the build API and tweak the go.mod after some unhappiness in my sandbox. Signed-off-by: tomsweeneyredhat <tsweeney@redhat.com>
This commit is contained in:
@ -580,6 +580,10 @@ func buildFlagsWrapperToOptions(c *cobra.Command, contextDir string, flags *Buil
|
||||
UnsetLabels: flags.UnsetLabels,
|
||||
}
|
||||
|
||||
if c.Flag("inherit-labels").Changed {
|
||||
opts.InheritLabels = types.NewOptionalBool(flags.InheritLabels)
|
||||
}
|
||||
|
||||
if flags.IgnoreFile != "" {
|
||||
excludes, err := parseDockerignore(flags.IgnoreFile)
|
||||
if err != nil {
|
||||
|
1
go.mod
1
go.mod
@ -155,7 +155,6 @@ require (
|
||||
github.com/moby/docker-image-spec v1.3.1 // indirect
|
||||
github.com/moby/go-archive v0.1.0 // indirect
|
||||
github.com/moby/patternmatcher v0.6.0 // indirect
|
||||
github.com/moby/sys/atomicwriter v0.1.0 // indirect
|
||||
github.com/moby/sys/mountinfo v0.7.2 // indirect
|
||||
github.com/moby/sys/sequential v0.6.0 // indirect
|
||||
github.com/moby/sys/userns v0.1.0 // indirect
|
||||
|
@ -130,6 +130,7 @@ func BuildImage(w http.ResponseWriter, r *http.Request) {
|
||||
IDMappingOptions string `schema:"idmappingoptions"`
|
||||
IdentityLabel bool `schema:"identitylabel"`
|
||||
Ignore bool `schema:"ignore"`
|
||||
InheritLabels bool `schema:"inheritlabels"`
|
||||
Isolation string `schema:"isolation"`
|
||||
Jobs int `schema:"jobs"`
|
||||
LabelOpts string `schema:"labelopts"`
|
||||
@ -744,6 +745,7 @@ func BuildImage(w http.ResponseWriter, r *http.Request) {
|
||||
IDMappingOptions: &idMappingOptions,
|
||||
IgnoreUnrecognizedInstructions: query.Ignore,
|
||||
IgnoreFile: ignoreFile,
|
||||
InheritLabels: types.NewOptionalBool(query.InheritLabels),
|
||||
Isolation: isolation,
|
||||
Jobs: &jobs,
|
||||
Labels: labels,
|
||||
|
@ -567,6 +567,13 @@ func (s *APIServer) registerImagesHandlers(r *mux.Router) error {
|
||||
// Contents of base images to be modified on ADD or COPY only
|
||||
// (As of Podman version v5.2)
|
||||
// - in: query
|
||||
// name: inheritlabels
|
||||
// type: boolean
|
||||
// default: true
|
||||
// description: |
|
||||
// Inherit the labels from the base image or base stages
|
||||
// (As of Podman version v5.5)
|
||||
// - in: query
|
||||
// name: nocache
|
||||
// type: boolean
|
||||
// default: false
|
||||
@ -1540,6 +1547,13 @@ func (s *APIServer) registerImagesHandlers(r *mux.Router) error {
|
||||
// Contents of base images to be modified on ADD or COPY only
|
||||
// (As of Podman version v5.2)
|
||||
// - in: query
|
||||
// name: inheritlabels
|
||||
// type: boolean
|
||||
// default: true
|
||||
// description: |
|
||||
// Inherit the labels from the base image or base stages
|
||||
// (As of Podman version v5.5)
|
||||
// - in: query
|
||||
// name: nocache
|
||||
// type: boolean
|
||||
// default: false
|
||||
|
@ -237,6 +237,12 @@ func Build(ctx context.Context, containerFiles []string, options types.BuildOpti
|
||||
if options.IgnoreUnrecognizedInstructions {
|
||||
params.Set("ignore", "1")
|
||||
}
|
||||
if options.InheritLabels == imageTypes.OptionalBoolFalse {
|
||||
params.Set("inheritlabels", "0")
|
||||
} else {
|
||||
params.Set("inheritlabels", "1")
|
||||
}
|
||||
|
||||
params.Set("isolation", strconv.Itoa(int(options.Isolation)))
|
||||
if options.CommonBuildOpts.HTTPProxy {
|
||||
params.Set("httpproxy", "1")
|
||||
|
2
vendor/modules.txt
vendored
2
vendor/modules.txt
vendored
@ -723,8 +723,6 @@ github.com/moby/go-archive/tarheader
|
||||
# github.com/moby/patternmatcher v0.6.0
|
||||
## explicit; go 1.19
|
||||
github.com/moby/patternmatcher
|
||||
# github.com/moby/sys/atomicwriter v0.1.0
|
||||
## explicit; go 1.18
|
||||
# github.com/moby/sys/capability v0.4.0
|
||||
## explicit; go 1.21
|
||||
github.com/moby/sys/capability
|
||||
|
Reference in New Issue
Block a user