mirror of https://github.com/containers/podman.git
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:
parent
76b07dd48d
commit
10d768baaf
|
|
@ -580,6 +580,10 @@ func buildFlagsWrapperToOptions(c *cobra.Command, contextDir string, flags *Buil
|
||||||
UnsetLabels: flags.UnsetLabels,
|
UnsetLabels: flags.UnsetLabels,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if c.Flag("inherit-labels").Changed {
|
||||||
|
opts.InheritLabels = types.NewOptionalBool(flags.InheritLabels)
|
||||||
|
}
|
||||||
|
|
||||||
if flags.IgnoreFile != "" {
|
if flags.IgnoreFile != "" {
|
||||||
excludes, err := parseDockerignore(flags.IgnoreFile)
|
excludes, err := parseDockerignore(flags.IgnoreFile)
|
||||||
if err != nil {
|
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/docker-image-spec v1.3.1 // indirect
|
||||||
github.com/moby/go-archive v0.1.0 // indirect
|
github.com/moby/go-archive v0.1.0 // indirect
|
||||||
github.com/moby/patternmatcher v0.6.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/mountinfo v0.7.2 // indirect
|
||||||
github.com/moby/sys/sequential v0.6.0 // indirect
|
github.com/moby/sys/sequential v0.6.0 // indirect
|
||||||
github.com/moby/sys/userns v0.1.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"`
|
IDMappingOptions string `schema:"idmappingoptions"`
|
||||||
IdentityLabel bool `schema:"identitylabel"`
|
IdentityLabel bool `schema:"identitylabel"`
|
||||||
Ignore bool `schema:"ignore"`
|
Ignore bool `schema:"ignore"`
|
||||||
|
InheritLabels bool `schema:"inheritlabels"`
|
||||||
Isolation string `schema:"isolation"`
|
Isolation string `schema:"isolation"`
|
||||||
Jobs int `schema:"jobs"`
|
Jobs int `schema:"jobs"`
|
||||||
LabelOpts string `schema:"labelopts"`
|
LabelOpts string `schema:"labelopts"`
|
||||||
|
|
@ -744,6 +745,7 @@ func BuildImage(w http.ResponseWriter, r *http.Request) {
|
||||||
IDMappingOptions: &idMappingOptions,
|
IDMappingOptions: &idMappingOptions,
|
||||||
IgnoreUnrecognizedInstructions: query.Ignore,
|
IgnoreUnrecognizedInstructions: query.Ignore,
|
||||||
IgnoreFile: ignoreFile,
|
IgnoreFile: ignoreFile,
|
||||||
|
InheritLabels: types.NewOptionalBool(query.InheritLabels),
|
||||||
Isolation: isolation,
|
Isolation: isolation,
|
||||||
Jobs: &jobs,
|
Jobs: &jobs,
|
||||||
Labels: labels,
|
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
|
// Contents of base images to be modified on ADD or COPY only
|
||||||
// (As of Podman version v5.2)
|
// (As of Podman version v5.2)
|
||||||
// - in: query
|
// - 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
|
// name: nocache
|
||||||
// type: boolean
|
// type: boolean
|
||||||
// default: false
|
// 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
|
// Contents of base images to be modified on ADD or COPY only
|
||||||
// (As of Podman version v5.2)
|
// (As of Podman version v5.2)
|
||||||
// - in: query
|
// - 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
|
// name: nocache
|
||||||
// type: boolean
|
// type: boolean
|
||||||
// default: false
|
// default: false
|
||||||
|
|
|
||||||
|
|
@ -237,6 +237,12 @@ func Build(ctx context.Context, containerFiles []string, options types.BuildOpti
|
||||||
if options.IgnoreUnrecognizedInstructions {
|
if options.IgnoreUnrecognizedInstructions {
|
||||||
params.Set("ignore", "1")
|
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)))
|
params.Set("isolation", strconv.Itoa(int(options.Isolation)))
|
||||||
if options.CommonBuildOpts.HTTPProxy {
|
if options.CommonBuildOpts.HTTPProxy {
|
||||||
params.Set("httpproxy", "1")
|
params.Set("httpproxy", "1")
|
||||||
|
|
|
||||||
|
|
@ -723,8 +723,6 @@ github.com/moby/go-archive/tarheader
|
||||||
# github.com/moby/patternmatcher v0.6.0
|
# github.com/moby/patternmatcher v0.6.0
|
||||||
## explicit; go 1.19
|
## explicit; go 1.19
|
||||||
github.com/moby/patternmatcher
|
github.com/moby/patternmatcher
|
||||||
# github.com/moby/sys/atomicwriter v0.1.0
|
|
||||||
## explicit; go 1.18
|
|
||||||
# github.com/moby/sys/capability v0.4.0
|
# github.com/moby/sys/capability v0.4.0
|
||||||
## explicit; go 1.21
|
## explicit; go 1.21
|
||||||
github.com/moby/sys/capability
|
github.com/moby/sys/capability
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue