Bump to Buildah v1.40.0

Bumps to Buildah v1.40.0 and adds the `--inherits-labels` option to
build and farm build man pages.

Also turn off the inherit-labels option test for now as it seems to be
rathr unhappy.

Issue for inherit-labels test failure: https://github.com/containers/podman/issues/25938

Signed-off-by: tomsweeneyredhat <tsweeney@redhat.com>
This commit is contained in:
tomsweeneyredhat
2025-04-21 15:45:26 -04:00
parent a3e132055d
commit 76b07dd48d
54 changed files with 661 additions and 305 deletions

View File

@@ -1,6 +1,7 @@
package config
import (
"maps"
"slices"
"github.com/containers/image/v5/manifest"
@@ -25,9 +26,7 @@ func Schema2ConfigFromGoDockerclientConfig(config *dockerclient.Config) *manifes
}
}
labels := make(map[string]string)
for k, v := range config.Labels {
labels[k] = v
}
maps.Copy(labels, config.Labels)
volumes := make(map[string]struct{})
for v := range config.Volumes {
volumes[v] = struct{}{}
@@ -82,9 +81,7 @@ func GoDockerclientConfigFromSchema2Config(s2config *manifest.Schema2Config) *do
}
}
labels := make(map[string]string)
for k, v := range s2config.Labels {
labels[k] = v
}
maps.Copy(labels, s2config.Labels)
volumes := make(map[string]struct{})
for v := range s2config.Volumes {
volumes[v] = struct{}{}
@@ -101,17 +98,17 @@ func GoDockerclientConfigFromSchema2Config(s2config *manifest.Schema2Config) *do
Tty: s2config.Tty,
OpenStdin: s2config.OpenStdin,
StdinOnce: s2config.StdinOnce,
Env: append([]string{}, s2config.Env...),
Cmd: append([]string{}, s2config.Cmd...),
Env: slices.Clone(s2config.Env),
Cmd: slices.Clone(s2config.Cmd),
Healthcheck: healthCheck,
ArgsEscaped: s2config.ArgsEscaped,
Image: s2config.Image,
Volumes: volumes,
WorkingDir: s2config.WorkingDir,
Entrypoint: append([]string{}, s2config.Entrypoint...),
Entrypoint: slices.Clone(s2config.Entrypoint),
NetworkDisabled: s2config.NetworkDisabled,
MacAddress: s2config.MacAddress,
OnBuild: append([]string{}, s2config.OnBuild...),
OnBuild: slices.Clone(s2config.OnBuild),
Labels: labels,
StopSignal: s2config.StopSignal,
Shell: s2config.Shell,

View File

@@ -3,6 +3,7 @@ package config
import (
"fmt"
"os"
"slices"
"strings"
"github.com/containers/buildah/docker"
@@ -24,9 +25,9 @@ func firstStringElseSecondString(first, second string) string {
// slice of strings if it has contents, else the second slice
func firstSliceElseSecondSlice(first, second []string) []string {
if len(first) > 0 {
return append([]string{}, first...)
return slices.Clone(first)
}
return append([]string{}, second...)
return slices.Clone(second)
}
// firstSlicePairElseSecondSlicePair takes two pairs of string slices, and
@@ -34,9 +35,9 @@ func firstSliceElseSecondSlice(first, second []string) []string {
// pair
func firstSlicePairElseSecondSlicePair(firstA, firstB, secondA, secondB []string) ([]string, []string) {
if len(firstA) > 0 || len(firstB) > 0 {
return append([]string{}, firstA...), append([]string{}, firstB...)
return slices.Clone(firstA), slices.Clone(firstB)
}
return append([]string{}, secondA...), append([]string{}, secondB...)
return slices.Clone(secondA), slices.Clone(secondB)
}
// mergeEnv combines variables from a and b into a single environment slice. if
@@ -45,7 +46,7 @@ func firstSlicePairElseSecondSlicePair(firstA, firstB, secondA, secondB []string
func mergeEnv(a, b []string) []string {
index := make(map[string]int)
results := make([]string, 0, len(a)+len(b))
for _, kv := range append(append([]string{}, a...), b...) {
for _, kv := range slices.Concat(a, b) {
k, _, specifiesValue := strings.Cut(kv, "=")
if !specifiesValue {
if value, ok := os.LookupEnv(kv); ok {
@@ -134,7 +135,7 @@ func Override(dconfig *docker.Config, oconfig *v1.ImageConfig, overrideChanges [
oconfig.Entrypoint, oconfig.Cmd = firstSlicePairElseSecondSlicePair(overrideConfig.Entrypoint, overrideConfig.Cmd, oconfig.Entrypoint, oconfig.Cmd)
if overrideConfig.Healthcheck != nil {
dconfig.Healthcheck = &docker.HealthConfig{
Test: append([]string{}, overrideConfig.Healthcheck.Test...),
Test: slices.Clone(overrideConfig.Healthcheck.Test),
Interval: overrideConfig.Healthcheck.Interval,
Timeout: overrideConfig.Healthcheck.Timeout,
StartPeriod: overrideConfig.Healthcheck.StartPeriod,