Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

buildah manifest: add artifact-related options #5301

Merged
merged 11 commits into from
Feb 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
2 changes: 1 addition & 1 deletion .cirrus.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
DEBIAN_NAME: "debian-13"

# Image identifiers
IMAGE_SUFFIX: "c20240102t212217z-f39f38d13"
IMAGE_SUFFIX: "c20240201t143038z-f39f38d13"
FEDORA_CACHE_IMAGE_NAME: "fedora-${IMAGE_SUFFIX}"
PRIOR_FEDORA_CACHE_IMAGE_NAME: "prior-fedora-${IMAGE_SUFFIX}"
DEBIAN_CACHE_IMAGE_NAME: "debian-${IMAGE_SUFFIX}"
Expand Down Expand Up @@ -153,7 +153,7 @@
path: ./bin/*


unit_task:

Check warning on line 156 in .cirrus.yml

View check run for this annotation

Cirrus CI / Build Parsing Results

.cirrus.yml#L156

task "Unit tests w/ vfs" depends on task "Smoke Test", but their only_if conditions are different

Check warning on line 156 in .cirrus.yml

View check run for this annotation

Cirrus CI / Build Parsing Results

.cirrus.yml#L156

task "Unit tests w/ vfs" depends on task "Cross Compile", but their only_if conditions are different

Check warning on line 156 in .cirrus.yml

View check run for this annotation

Cirrus CI / Build Parsing Results

.cirrus.yml#L156

task "Unit tests w/ overlay" depends on task "Smoke Test", but their only_if conditions are different

Check warning on line 156 in .cirrus.yml

View check run for this annotation

Cirrus CI / Build Parsing Results

.cirrus.yml#L156

task "Unit tests w/ overlay" depends on task "Cross Compile", but their only_if conditions are different

Check warning on line 156 in .cirrus.yml

View check run for this annotation

Cirrus CI / Build Parsing Results

.cirrus.yml#L156

task "Unit tests w/ vfs" depends on task "Smoke Test", but their only_if conditions are different

Check warning on line 156 in .cirrus.yml

View check run for this annotation

Cirrus CI / Build Parsing Results

.cirrus.yml#L156

task "Unit tests w/ vfs" depends on task "Cross Compile", but their only_if conditions are different

Check warning on line 156 in .cirrus.yml

View check run for this annotation

Cirrus CI / Build Parsing Results

.cirrus.yml#L156

task "Unit tests w/ overlay" depends on task "Smoke Test", but their only_if conditions are different

Check warning on line 156 in .cirrus.yml

View check run for this annotation

Cirrus CI / Build Parsing Results

.cirrus.yml#L156

task "Unit tests w/ overlay" depends on task "Cross Compile", but their only_if conditions are different
name: 'Unit tests w/ $STORAGE_DRIVER'
alias: unit
only_if: &not_build_docs >-
Expand All @@ -180,7 +180,7 @@
path: ./bin/*


conformance_task:

Check warning on line 183 in .cirrus.yml

View check run for this annotation

Cirrus CI / Build Parsing Results

.cirrus.yml#L183

task "Build Conformance w/ vfs" depends on task "Smoke Test", but their only_if conditions are different

Check warning on line 183 in .cirrus.yml

View check run for this annotation

Cirrus CI / Build Parsing Results

.cirrus.yml#L183

task "Build Conformance w/ vfs" depends on task "Cross Compile", but their only_if conditions are different

Check warning on line 183 in .cirrus.yml

View check run for this annotation

Cirrus CI / Build Parsing Results

.cirrus.yml#L183

task "Build Conformance w/ overlay" depends on task "Smoke Test", but their only_if conditions are different

Check warning on line 183 in .cirrus.yml

View check run for this annotation

Cirrus CI / Build Parsing Results

.cirrus.yml#L183

task "Build Conformance w/ overlay" depends on task "Cross Compile", but their only_if conditions are different

Check warning on line 183 in .cirrus.yml

View check run for this annotation

Cirrus CI / Build Parsing Results

.cirrus.yml#L183

task "Build Conformance w/ vfs" depends on task "Smoke Test", but their only_if conditions are different

Check warning on line 183 in .cirrus.yml

View check run for this annotation

Cirrus CI / Build Parsing Results

.cirrus.yml#L183

task "Build Conformance w/ vfs" depends on task "Cross Compile", but their only_if conditions are different

Check warning on line 183 in .cirrus.yml

View check run for this annotation

Cirrus CI / Build Parsing Results

.cirrus.yml#L183

task "Build Conformance w/ overlay" depends on task "Smoke Test", but their only_if conditions are different

Check warning on line 183 in .cirrus.yml

View check run for this annotation

Cirrus CI / Build Parsing Results

.cirrus.yml#L183

task "Build Conformance w/ overlay" depends on task "Cross Compile", but their only_if conditions are different
name: 'Build Conformance w/ $STORAGE_DRIVER'
alias: conformance
only_if: *not_build_docs
Expand All @@ -201,7 +201,7 @@
conformance_test_script: '${SCRIPT_BASE}/test.sh conformance |& ${_TIMESTAMP}'


integration_task:

Check warning on line 204 in .cirrus.yml

View check run for this annotation

Cirrus CI / Build Parsing Results

.cirrus.yml#L204

task "Integration fedora-39 w/ vfs" depends on task "Smoke Test", but their only_if conditions are different

Check warning on line 204 in .cirrus.yml

View check run for this annotation

Cirrus CI / Build Parsing Results

.cirrus.yml#L204

task "Integration fedora-39 w/ vfs" depends on task "Cross Compile", but their only_if conditions are different

Check warning on line 204 in .cirrus.yml

View check run for this annotation

Cirrus CI / Build Parsing Results

.cirrus.yml#L204

task "Integration fedora-38 w/ vfs" depends on task "Smoke Test", but their only_if conditions are different

Check warning on line 204 in .cirrus.yml

View check run for this annotation

Cirrus CI / Build Parsing Results

.cirrus.yml#L204

task "Integration fedora-38 w/ vfs" depends on task "Cross Compile", but their only_if conditions are different

Check warning on line 204 in .cirrus.yml

View check run for this annotation

Cirrus CI / Build Parsing Results

.cirrus.yml#L204

task "Integration debian-13 w/ vfs" depends on task "Smoke Test", but their only_if conditions are different

Check warning on line 204 in .cirrus.yml

View check run for this annotation

Cirrus CI / Build Parsing Results

.cirrus.yml#L204

task "Integration debian-13 w/ vfs" depends on task "Cross Compile", but their only_if conditions are different

Check warning on line 204 in .cirrus.yml

View check run for this annotation

Cirrus CI / Build Parsing Results

.cirrus.yml#L204

task "Integration fedora-39 w/ overlay" depends on task "Smoke Test", but their only_if conditions are different

Check warning on line 204 in .cirrus.yml

View check run for this annotation

Cirrus CI / Build Parsing Results

.cirrus.yml#L204

task "Integration fedora-39 w/ overlay" depends on task "Cross Compile", but their only_if conditions are different

Check warning on line 204 in .cirrus.yml

View check run for this annotation

Cirrus CI / Build Parsing Results

.cirrus.yml#L204

task "Integration fedora-38 w/ overlay" depends on task "Smoke Test", but their only_if conditions are different

Check warning on line 204 in .cirrus.yml

View check run for this annotation

Cirrus CI / Build Parsing Results

.cirrus.yml#L204

task "Integration fedora-38 w/ overlay" depends on task "Cross Compile", but their only_if conditions are different

Check warning on line 204 in .cirrus.yml

View check run for this annotation

Cirrus CI / Build Parsing Results

.cirrus.yml#L204

task "Integration debian-13 w/ overlay" depends on task "Smoke Test", but their only_if conditions are different

Check warning on line 204 in .cirrus.yml

View check run for this annotation

Cirrus CI / Build Parsing Results

.cirrus.yml#L204

task "Integration debian-13 w/ overlay" depends on task "Cross Compile", but their only_if conditions are different

Check warning on line 204 in .cirrus.yml

View check run for this annotation

Cirrus CI / Build Parsing Results

.cirrus.yml#L204

task "Integration fedora-39 w/ vfs" depends on task "Smoke Test", but their only_if conditions are different

Check warning on line 204 in .cirrus.yml

View check run for this annotation

Cirrus CI / Build Parsing Results

.cirrus.yml#L204

task "Integration fedora-39 w/ vfs" depends on task "Cross Compile", but their only_if conditions are different

Check warning on line 204 in .cirrus.yml

View check run for this annotation

Cirrus CI / Build Parsing Results

.cirrus.yml#L204

task "Integration fedora-38 w/ vfs" depends on task "Smoke Test", but their only_if conditions are different

Check warning on line 204 in .cirrus.yml

View check run for this annotation

Cirrus CI / Build Parsing Results

.cirrus.yml#L204

task "Integration fedora-38 w/ vfs" depends on task "Cross Compile", but their only_if conditions are different

Check warning on line 204 in .cirrus.yml

View check run for this annotation

Cirrus CI / Build Parsing Results

.cirrus.yml#L204

task "Integration debian-13 w/ vfs" depends on task "Smoke Test", but their only_if conditions are different

Check warning on line 204 in .cirrus.yml

View check run for this annotation

Cirrus CI / Build Parsing Results

.cirrus.yml#L204

task "Integration debian-13 w/ vfs" depends on task "Cross Compile", but their only_if conditions are different

Check warning on line 204 in .cirrus.yml

View check run for this annotation

Cirrus CI / Build Parsing Results

.cirrus.yml#L204

task "Integration fedora-39 w/ overlay" depends on task "Smoke Test", but their only_if conditions are different

Check warning on line 204 in .cirrus.yml

View check run for this annotation

Cirrus CI / Build Parsing Results

.cirrus.yml#L204

task "Integration fedora-39 w/ overlay" depends on task "Cross Compile", but their only_if conditions are different

Check warning on line 204 in .cirrus.yml

View check run for this annotation

Cirrus CI / Build Parsing Results

.cirrus.yml#L204

task "Integration fedora-38 w/ overlay" depends on task "Smoke Test", but their only_if conditions are different

Check warning on line 204 in .cirrus.yml

View check run for this annotation

Cirrus CI / Build Parsing Results

.cirrus.yml#L204

task "Integration fedora-38 w/ overlay" depends on task "Cross Compile", but their only_if conditions are different

Check warning on line 204 in .cirrus.yml

View check run for this annotation

Cirrus CI / Build Parsing Results

.cirrus.yml#L204

task "Integration debian-13 w/ overlay" depends on task "Smoke Test", but their only_if conditions are different

Check warning on line 204 in .cirrus.yml

View check run for this annotation

Cirrus CI / Build Parsing Results

.cirrus.yml#L204

task "Integration debian-13 w/ overlay" depends on task "Cross Compile", but their only_if conditions are different
name: "Integration $DISTRO_NV w/ $STORAGE_DRIVER"
alias: integration
only_if: *not_build_docs
Expand Down Expand Up @@ -256,7 +256,7 @@
package_versions_script: '$GOSRC/$SCRIPT_BASE/logcollector.sh packages'
golang_version_script: '$GOSRC/$SCRIPT_BASE/logcollector.sh golang'

integration_rootless_task:

Check warning on line 259 in .cirrus.yml

View check run for this annotation

Cirrus CI / Build Parsing Results

.cirrus.yml#L259

task "Integration rootless fedora-39 w/ overlay" depends on task "Smoke Test", but their only_if conditions are different

Check warning on line 259 in .cirrus.yml

View check run for this annotation

Cirrus CI / Build Parsing Results

.cirrus.yml#L259

task "Integration rootless fedora-39 w/ overlay" depends on task "Cross Compile", but their only_if conditions are different

Check warning on line 259 in .cirrus.yml

View check run for this annotation

Cirrus CI / Build Parsing Results

.cirrus.yml#L259

task "Integration rootless fedora-38 w/ overlay" depends on task "Smoke Test", but their only_if conditions are different

Check warning on line 259 in .cirrus.yml

View check run for this annotation

Cirrus CI / Build Parsing Results

.cirrus.yml#L259

task "Integration rootless fedora-38 w/ overlay" depends on task "Cross Compile", but their only_if conditions are different

Check warning on line 259 in .cirrus.yml

View check run for this annotation

Cirrus CI / Build Parsing Results

.cirrus.yml#L259

task "Integration rootless debian-13 w/ overlay" depends on task "Smoke Test", but their only_if conditions are different

Check warning on line 259 in .cirrus.yml

View check run for this annotation

Cirrus CI / Build Parsing Results

.cirrus.yml#L259

task "Integration rootless debian-13 w/ overlay" depends on task "Cross Compile", but their only_if conditions are different

Check warning on line 259 in .cirrus.yml

View check run for this annotation

Cirrus CI / Build Parsing Results

.cirrus.yml#L259

task "Integration rootless fedora-39 w/ overlay" depends on task "Smoke Test", but their only_if conditions are different

Check warning on line 259 in .cirrus.yml

View check run for this annotation

Cirrus CI / Build Parsing Results

.cirrus.yml#L259

task "Integration rootless fedora-39 w/ overlay" depends on task "Cross Compile", but their only_if conditions are different

Check warning on line 259 in .cirrus.yml

View check run for this annotation

Cirrus CI / Build Parsing Results

.cirrus.yml#L259

task "Integration rootless fedora-38 w/ overlay" depends on task "Smoke Test", but their only_if conditions are different

Check warning on line 259 in .cirrus.yml

View check run for this annotation

Cirrus CI / Build Parsing Results

.cirrus.yml#L259

task "Integration rootless fedora-38 w/ overlay" depends on task "Cross Compile", but their only_if conditions are different

Check warning on line 259 in .cirrus.yml

View check run for this annotation

Cirrus CI / Build Parsing Results

.cirrus.yml#L259

task "Integration rootless debian-13 w/ overlay" depends on task "Smoke Test", but their only_if conditions are different

Check warning on line 259 in .cirrus.yml

View check run for this annotation

Cirrus CI / Build Parsing Results

.cirrus.yml#L259

task "Integration rootless debian-13 w/ overlay" depends on task "Cross Compile", but their only_if conditions are different
name: "Integration rootless $DISTRO_NV w/ $STORAGE_DRIVER"
alias: integration_rootless
only_if: *not_build_docs
Expand Down Expand Up @@ -295,7 +295,7 @@
always:
<<: *standardlogs

in_podman_task:

Check warning on line 298 in .cirrus.yml

View check run for this annotation

Cirrus CI / Build Parsing Results

.cirrus.yml#L298

task "Containerized Integration" depends on task "Smoke Test", but their only_if conditions are different

Check warning on line 298 in .cirrus.yml

View check run for this annotation

Cirrus CI / Build Parsing Results

.cirrus.yml#L298

task "Containerized Integration" depends on task "Cross Compile", but their only_if conditions are different

Check warning on line 298 in .cirrus.yml

View check run for this annotation

Cirrus CI / Build Parsing Results

.cirrus.yml#L298

task "Containerized Integration" depends on task "Smoke Test", but their only_if conditions are different

Check warning on line 298 in .cirrus.yml

View check run for this annotation

Cirrus CI / Build Parsing Results

.cirrus.yml#L298

task "Containerized Integration" depends on task "Cross Compile", but their only_if conditions are different
name: "Containerized Integration"
alias: in_podman
only_if: *not_build_docs
Expand All @@ -322,7 +322,7 @@
# Status aggregator for all tests. This task simply ensures a defined
# set of tasks all passed, and allows confirming that based on the status
# of this task.
success_task:

Check warning on line 325 in .cirrus.yml

View check run for this annotation

Cirrus CI / Build Parsing Results

.cirrus.yml#L325

task "Total Success" depends on task "Smoke Test", but their only_if conditions are different

Check warning on line 325 in .cirrus.yml

View check run for this annotation

Cirrus CI / Build Parsing Results

.cirrus.yml#L325

task "Total Success" depends on task "Cross Compile", but their only_if conditions are different

Check warning on line 325 in .cirrus.yml

View check run for this annotation

Cirrus CI / Build Parsing Results

.cirrus.yml#L325

task "Total Success" depends on task "Unit tests w/ vfs", but their only_if conditions are different

Check warning on line 325 in .cirrus.yml

View check run for this annotation

Cirrus CI / Build Parsing Results

.cirrus.yml#L325

task "Total Success" depends on task "Unit tests w/ overlay", but their only_if conditions are different

Check warning on line 325 in .cirrus.yml

View check run for this annotation

Cirrus CI / Build Parsing Results

.cirrus.yml#L325

task "Total Success" depends on task "Build Conformance w/ vfs", but their only_if conditions are different

Check warning on line 325 in .cirrus.yml

View check run for this annotation

Cirrus CI / Build Parsing Results

.cirrus.yml#L325

task "Total Success" depends on task "Build Conformance w/ overlay", but their only_if conditions are different

Check warning on line 325 in .cirrus.yml

View check run for this annotation

Cirrus CI / Build Parsing Results

.cirrus.yml#L325

task "Total Success" depends on task "Integration fedora-39 w/ vfs", but their only_if conditions are different

Check warning on line 325 in .cirrus.yml

View check run for this annotation

Cirrus CI / Build Parsing Results

.cirrus.yml#L325

task "Total Success" depends on task "Integration fedora-38 w/ vfs", but their only_if conditions are different

Check warning on line 325 in .cirrus.yml

View check run for this annotation

Cirrus CI / Build Parsing Results

.cirrus.yml#L325

task "Total Success" depends on task "Integration debian-13 w/ vfs", but their only_if conditions are different

Check warning on line 325 in .cirrus.yml

View check run for this annotation

Cirrus CI / Build Parsing Results

.cirrus.yml#L325

task "Total Success" depends on task "Integration fedora-39 w/ overlay", but their only_if conditions are different

Check warning on line 325 in .cirrus.yml

View check run for this annotation

Cirrus CI / Build Parsing Results

.cirrus.yml#L325

task "Total Success" depends on task "Integration fedora-38 w/ overlay", but their only_if conditions are different

Check warning on line 325 in .cirrus.yml

View check run for this annotation

Cirrus CI / Build Parsing Results

.cirrus.yml#L325

task "Total Success" depends on task "Integration debian-13 w/ overlay", but their only_if conditions are different

Check warning on line 325 in .cirrus.yml

View check run for this annotation

Cirrus CI / Build Parsing Results

.cirrus.yml#L325

task "Total Success" depends on task "Containerized Integration", but their only_if conditions are different

Check warning on line 325 in .cirrus.yml

View check run for this annotation

Cirrus CI / Build Parsing Results

.cirrus.yml#L325

task "Total Success" depends on task "Smoke Test", but their only_if conditions are different

Check warning on line 325 in .cirrus.yml

View check run for this annotation

Cirrus CI / Build Parsing Results

.cirrus.yml#L325

task "Total Success" depends on task "Cross Compile", but their only_if conditions are different

Check warning on line 325 in .cirrus.yml

View check run for this annotation

Cirrus CI / Build Parsing Results

.cirrus.yml#L325

task "Total Success" depends on task "Unit tests w/ vfs", but their only_if conditions are different

Check warning on line 325 in .cirrus.yml

View check run for this annotation

Cirrus CI / Build Parsing Results

.cirrus.yml#L325

task "Total Success" depends on task "Unit tests w/ overlay", but their only_if conditions are different

Check warning on line 325 in .cirrus.yml

View check run for this annotation

Cirrus CI / Build Parsing Results

.cirrus.yml#L325

task "Total Success" depends on task "Build Conformance w/ vfs", but their only_if conditions are different

Check warning on line 325 in .cirrus.yml

View check run for this annotation

Cirrus CI / Build Parsing Results

.cirrus.yml#L325

task "Total Success" depends on task "Build Conformance w/ overlay", but their only_if conditions are different

Check warning on line 325 in .cirrus.yml

View check run for this annotation

Cirrus CI / Build Parsing Results

.cirrus.yml#L325

task "Total Success" depends on task "Integration fedora-39 w/ vfs", but their only_if conditions are different

Check warning on line 325 in .cirrus.yml

View check run for this annotation

Cirrus CI / Build Parsing Results

.cirrus.yml#L325

task "Total Success" depends on task "Integration fedora-38 w/ vfs", but their only_if conditions are different

Check warning on line 325 in .cirrus.yml

View check run for this annotation

Cirrus CI / Build Parsing Results

.cirrus.yml#L325

task "Total Success" depends on task "Integration debian-13 w/ vfs", but their only_if conditions are different

Check warning on line 325 in .cirrus.yml

View check run for this annotation

Cirrus CI / Build Parsing Results

.cirrus.yml#L325

task "Total Success" depends on task "Integration fedora-39 w/ overlay", but their only_if conditions are different

Check warning on line 325 in .cirrus.yml

View check run for this annotation

Cirrus CI / Build Parsing Results

.cirrus.yml#L325

task "Total Success" depends on task "Integration fedora-38 w/ overlay", but their only_if conditions are different

Check warning on line 325 in .cirrus.yml

View check run for this annotation

Cirrus CI / Build Parsing Results

.cirrus.yml#L325

task "Total Success" depends on task "Integration debian-13 w/ overlay", but their only_if conditions are different

Check warning on line 325 in .cirrus.yml

View check run for this annotation

Cirrus CI / Build Parsing Results

.cirrus.yml#L325

task "Total Success" depends on task "Containerized Integration", but their only_if conditions are different
name: "Total Success"
alias: success

Expand Down
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ endif
buildah: bin/buildah

ALL_CROSS_TARGETS := $(addprefix bin/buildah.,$(subst /,.,$(shell $(GO) tool dist list)))
LINUX_CROSS_TARGETS := $(filter bin/buildah.linux.%,$(ALL_CROSS_TARGETS))
LINUX_CROSS_TARGETS := $(filter-out %.loong64,$(filter bin/buildah.linux.%,$(ALL_CROSS_TARGETS)))
DARWIN_CROSS_TARGETS := $(filter bin/buildah.darwin.%,$(ALL_CROSS_TARGETS))
WINDOWS_CROSS_TARGETS := $(addsuffix .exe,$(filter bin/buildah.windows.%,$(ALL_CROSS_TARGETS)))
FREEBSD_CROSS_TARGETS := $(filter bin/buildah.freebsd.%,$(ALL_CROSS_TARGETS))
Expand Down Expand Up @@ -196,7 +196,7 @@ test-unit: tests/testreport/testreport
$(GO_TEST) -v -tags "$(STORAGETAGS) $(SECURITYTAGS)" -cover $(RACEFLAGS) ./cmd/buildah -args --root $$tmp/root --runroot $$tmp/runroot --storage-driver vfs --signature-policy $(shell pwd)/tests/policy.json --registries-conf $(shell pwd)/tests/registries.conf

vendor-in-container:
podman run --privileged --rm --env HOME=/root -v `pwd`:/src -w /src docker.io/library/golang:1.20 make vendor
podman run --privileged --rm --env HOME=/root -v `pwd`:/src -w /src docker.io/library/golang:1.21 make vendor

.PHONY: vendor
vendor:
Expand Down
8 changes: 4 additions & 4 deletions bind/mount.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@ import (
"syscall"

"github.com/containers/buildah/util"
cutil "github.com/containers/common/pkg/util"
"github.com/containers/storage/pkg/idtools"
"github.com/containers/storage/pkg/mount"
"github.com/opencontainers/runtime-spec/specs-go"
"github.com/sirupsen/logrus"
"golang.org/x/exp/slices"
"golang.org/x/sys/unix"
)

Expand Down Expand Up @@ -192,11 +192,11 @@ func SetupIntermediateMountNamespace(spec *specs.Spec, bundlePath string) (unmou
// Decide if the mount should not be redirected to an intermediate location first.
func leaveBindMountAlone(mount specs.Mount) bool {
// If we know we shouldn't do a redirection for this mount, skip it.
if cutil.StringInSlice(NoBindOption, mount.Options) {
if slices.Contains(mount.Options, NoBindOption) {
return true
}
// If we're not bind mounting it in, we don't need to do anything for it.
if mount.Type != "bind" && !cutil.StringInSlice("bind", mount.Options) && !cutil.StringInSlice("rbind", mount.Options) {
if mount.Type != "bind" && !slices.Contains(mount.Options, "bind") && !slices.Contains(mount.Options, "rbind") {
return true
}
return false
Expand Down Expand Up @@ -294,7 +294,7 @@ func UnmountMountpoints(mountpoint string, mountpointsToRemove []string) error {
}
}
// if we're also supposed to remove this thing, do that, too
if cutil.StringInSlice(mount.Mountpoint, mountpointsToRemove) {
if slices.Contains(mountpointsToRemove, mount.Mountpoint) {
if err := os.Remove(mount.Mountpoint); err != nil {
return fmt.Errorf("removing %q: %w", mount.Mountpoint, err)
}
Expand Down
4 changes: 2 additions & 2 deletions bind/util.go
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package bind

import (
"github.com/containers/common/pkg/util"
"github.com/opencontainers/runtime-spec/specs-go"
"golang.org/x/exp/slices"
)

const (
Expand All @@ -14,7 +14,7 @@ const (

func stripNoBindOption(spec *specs.Spec) {
for i := range spec.Mounts {
if util.StringInSlice(NoBindOption, spec.Mounts[i].Options) {
if slices.Contains(spec.Mounts[i].Options, NoBindOption) {
prunedOptions := make([]string, 0, len(spec.Mounts[i].Options))
for _, option := range spec.Mounts[i].Options {
if option != NoBindOption {
Expand Down
8 changes: 8 additions & 0 deletions chroot/run_common.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ const (
runUsingChrootCommand = "buildah-chroot-runtime"
// runUsingChrootExec is a command we use as a key for reexec
runUsingChrootExecCommand = "buildah-chroot-exec"
// containersConfEnv is an environment variable that we need to pass down except for the command itself
containersConfEnv = "CONTAINERS_CONF"
)

func init() {
Expand Down Expand Up @@ -128,6 +130,9 @@ func RunUsingChroot(spec *specs.Spec, bundlePath, homeDir string, stdin io.Reade
cmd.Stdin, cmd.Stdout, cmd.Stderr = stdin, stdout, stderr
cmd.Dir = "/"
cmd.Env = []string{fmt.Sprintf("LOGLEVEL=%d", logrus.GetLevel())}
if _, ok := os.LookupEnv(containersConfEnv); ok {
cmd.Env = append(cmd.Env, containersConfEnv+"="+os.Getenv(containersConfEnv))
}

interrupted := make(chan os.Signal, 100)
cmd.Hook = func(int) error {
Expand Down Expand Up @@ -511,6 +516,9 @@ func runUsingChroot(spec *specs.Spec, bundlePath string, ctty *os.File, stdin io
cmd.Stdin, cmd.Stdout, cmd.Stderr = stdin, stdout, stderr
cmd.Dir = "/"
cmd.Env = []string{fmt.Sprintf("LOGLEVEL=%d", logrus.GetLevel())}
if _, ok := os.LookupEnv(containersConfEnv); ok {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: Why not use the val passed back rather then calling os.Getenv() again.if

val, ok := os.LookupEnv(containersConfEnv); ok {
	cmd.Env = append(cmd.Env, containersConfEnv+"="+val))
}

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, that would have been better.

cmd.Env = append(cmd.Env, containersConfEnv+"="+os.Getenv(containersConfEnv))
}
if ctty != nil {
cmd.Setsid = true
cmd.Ctty = ctty
Expand Down
5 changes: 3 additions & 2 deletions chroot/run_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import (
"github.com/opencontainers/runtime-tools/generate"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"golang.org/x/exp/slices"
"golang.org/x/sys/unix"
)

Expand Down Expand Up @@ -506,13 +507,13 @@ func TestMounts(t *testing.T) {
requiredFlags = bind.options
}
for _, required := range requiredFlags {
if !util.StringInSlice(required, mount.Options) {
if !slices.Contains(mount.Options, required) {
allRequired = false
}
}
anyRejected := false
for _, rejected := range bind.reject {
if util.StringInSlice(rejected, mount.Options) {
if slices.Contains(mount.Options, rejected) {
anyRejected = true
}
}
Expand Down
Loading
Loading