aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.cirrus.yml199
-rw-r--r--cmd/podman/containers/restore.go28
-rw-r--r--cmd/podman/containers/run.go29
-rw-r--r--cmd/podman/utils/utils.go40
-rw-r--r--contrib/cirrus/CIModes.md14
-rwxr-xr-xcontrib/cirrus/check_go_changes.sh2
-rwxr-xr-xcontrib/cirrus/ext_svc_check.sh47
-rwxr-xr-xcontrib/cirrus/postbuild.sh30
-rwxr-xr-xcontrib/cirrus/prebuild.sh77
-rwxr-xr-xcontrib/cirrus/runner.sh27
-rwxr-xr-xcontrib/cirrus/setup_environment.sh6
-rwxr-xr-xcontrib/cirrus/shellcheck.sh16
-rw-r--r--contrib/podmanimage/README.md13
-rw-r--r--docs/source/markdown/options/network.md32
-rw-r--r--docs/source/markdown/podman-create.1.md.in37
-rw-r--r--docs/source/markdown/podman-kube-play.1.md.in33
-rw-r--r--docs/source/markdown/podman-pod-create.1.md.in35
-rw-r--r--docs/source/markdown/podman-run.1.md.in37
-rw-r--r--go.mod6
-rw-r--r--go.sum10
-rw-r--r--pkg/api/handlers/libpod/containers.go2
-rw-r--r--pkg/api/server/register_containers.go4
-rw-r--r--pkg/domain/infra/abi/play.go4
-rw-r--r--test/e2e/checkpoint_image_test.go48
-rw-r--r--test/e2e/checkpoint_test.go4
-rw-r--r--test/e2e/kill_test.go2
-rw-r--r--test/e2e/network_test.go4
-rw-r--r--test/e2e/prune_test.go6
-rw-r--r--test/e2e/restart_test.go2
-rw-r--r--test/system/700-play.bats10
-rw-r--r--vendor/github.com/containers/common/libimage/platform.go16
-rw-r--r--vendor/github.com/containers/common/pkg/util/util_supported.go6
-rw-r--r--vendor/github.com/containers/storage/VERSION2
-rw-r--r--vendor/github.com/containers/storage/drivers/driver_linux.go8
-rw-r--r--vendor/github.com/containers/storage/layers.go4
-rw-r--r--vendor/github.com/containers/storage/pkg/archive/archive.go3
-rw-r--r--vendor/github.com/containers/storage/pkg/archive/archive_freebsd.go23
-rw-r--r--vendor/github.com/containers/storage/pkg/archive/archive_unix.go13
-rw-r--r--vendor/github.com/containers/storage/pkg/archive/archive_windows.go5
-rw-r--r--vendor/github.com/containers/storage/pkg/homedir/homedir_unix.go3
-rw-r--r--vendor/github.com/containers/storage/pkg/system/mknod.go5
-rw-r--r--vendor/github.com/containers/storage/pkg/system/mknod_freebsd.go5
-rw-r--r--vendor/github.com/containers/storage/pkg/system/rm.go3
-rw-r--r--vendor/github.com/containers/storage/pkg/system/rm_common.go10
-rw-r--r--vendor/github.com/containers/storage/pkg/system/rm_freebsd.go32
-rw-r--r--vendor/github.com/containers/storage/types/options.go55
-rw-r--r--vendor/github.com/opencontainers/selinux/go-selinux/doc.go1
-rw-r--r--vendor/github.com/opencontainers/selinux/go-selinux/label/label_linux.go46
-rw-r--r--vendor/github.com/opencontainers/selinux/go-selinux/label/label_stub.go1
-rw-r--r--vendor/github.com/opencontainers/selinux/go-selinux/rchcon.go12
-rw-r--r--vendor/github.com/opencontainers/selinux/go-selinux/rchcon_go115.go1
-rw-r--r--vendor/github.com/opencontainers/selinux/go-selinux/selinux_linux.go80
-rw-r--r--vendor/github.com/opencontainers/selinux/go-selinux/selinux_stub.go1
-rw-r--r--vendor/modules.txt6
54 files changed, 618 insertions, 527 deletions
diff --git a/.cirrus.yml b/.cirrus.yml
index d7b763f6d..2badd7b5a 100644
--- a/.cirrus.yml
+++ b/.cirrus.yml
@@ -77,79 +77,11 @@ gcp_credentials: ENCRYPTED[a28959877b2c9c36f151781b0a05407218cda646c7d047fc556e4
aws_credentials: ENCRYPTED[4ca070bffe28eb9b27d63c568b52970dd46f119c3a83b8e443241e895dbf1737580b4d84eed27a311a2b74287ef9f79f]
-# Attempt to prevent flakes by confirming all required external/3rd-party
-# services are available and functional.
-ext_svc_check_task:
- alias: 'ext_svc_check' # int. ref. name - required for depends_on reference
- name: "Ext. services" # Displayed Title - has no other significance
- # Don't create this task for new tags so release process is more reliable
- # Docs: ./contrib/cirrus/CIModes.md
- only_if: $CIRRUS_TAG == ''
- # Default/small container image to execute tasks with
- container: &smallcontainer
- image: ${CTR_FQIN}
- # Resources are limited across ALL currently executing tasks
- # ref: https://cirrus-ci.org/guide/linux/#linux-containers
- cpu: 2
- memory: 2
- env:
- TEST_FLAVOR: ext_svc
- CTR_FQIN: ${FEDORA_CONTAINER_FQIN}
- # NOTE: The default way Cirrus-CI clones is *NOT* compatible with
- # environment expectations in contrib/cirrus/lib.sh. Specifically
- # the 'origin' remote must be defined, and all remote branches/tags
- # must be available for reference from CI scripts.
- clone_script: &full_clone |
- cd /
- rm -rf $CIRRUS_WORKING_DIR
- mkdir -p $CIRRUS_WORKING_DIR
- git clone --recursive --branch=$DEST_BRANCH https://x-access-token:${CIRRUS_REPO_CLONE_TOKEN}@github.com/${CIRRUS_REPO_FULL_NAME}.git $CIRRUS_WORKING_DIR
- cd $CIRRUS_WORKING_DIR
- git remote update origin
- if [[ -n "$CIRRUS_PR" ]]; then # running for a PR
- git fetch origin pull/$CIRRUS_PR/head:pull/$CIRRUS_PR
- git checkout pull/$CIRRUS_PR
- else
- git reset --hard $CIRRUS_CHANGE_IN_REPO
- fi
- # Some test operations & checks require a git "identity"
- _gc='git config --file /root/.gitconfig'
- $_gc user.email "TMcTestFace@example.com"
- $_gc user.name "Testy McTestface"
-
- setup_script: &setup '$GOSRC/$SCRIPT_BASE/setup_environment.sh'
- main_script: &main '/usr/bin/time --verbose --output="$STATS_LOGFILE" $GOSRC/$SCRIPT_BASE/runner.sh'
- always: &runner_stats
- runner_stats_artifacts:
- path: ./*-${STATS_LOGFILE_SFX}
- type: text/plain
-
-
-# Execute some quick checks to confirm this YAML file and all
-# automation-related shell scripts are sane.
-automation_task:
- alias: 'automation'
- name: "Check Automation"
- # This task is not needed for branches, tags, or cron runs.
- # Docs: ./contrib/cirrus/CIModes.md
- only_if: &is_pr "$CIRRUS_PR != ''"
- container: *smallcontainer
- env:
- TEST_FLAVOR: automation
- CTR_FQIN: ${FEDORA_CONTAINER_FQIN}
- TEST_ENVIRON: container
- clone_script: *full_clone
- setup_script: *setup
- main_script: *main
- always: *runner_stats
-
-
-# N/B: The two following tasks are critical. They build all binaries for all supported
-# OS platforms and versions on x86_64 and aarch64. On success, the contents of the repository
-# are preserved as an artifact. This saves most subsequent tasks about
-# 3 minutes of otherwise duplicative effort. It also ensures that the
-# exact same binaries used throughout CI testing, are available for
-# future consumption|inspection by the final 'artifacts' task.
+# N/B: This matrix of build tasks are critical to CI, along with the following
+# aarch64 task. They build binaries for all CI platforms, and versions. On
+# success, the contents of the repository are preserved as an artifact for
+# consumption by most subsequent CI tasks. This saves about 3-5 minutes of
+# otherwise duplicative effort in most tasks.
build_task:
alias: 'build'
name: 'Build for $DISTRO_NV'
@@ -175,10 +107,10 @@ build_task:
# ID for re-use of build output
CI_DESIRED_RUNTIME: crun
#- env: &priorfedora_envvars
- #DISTRO_NV: ${PRIOR_FEDORA_NAME}
- #VM_IMAGE_NAME: ${PRIOR_FEDORA_CACHE_IMAGE_NAME}
- #CTR_FQIN: ${PRIOR_FEDORA_CONTAINER_FQIN}
- #CI_DESIRED_RUNTIME: crun
+ # DISTRO_NV: ${PRIOR_FEDORA_NAME}
+ # VM_IMAGE_NAME: ${PRIOR_FEDORA_CACHE_IMAGE_NAME}
+ # CTR_FQIN: ${PRIOR_FEDORA_CONTAINER_FQIN}
+ # CI_DESIRED_RUNTIME: crun
- env: &ubuntu_envvars
DISTRO_NV: ${UBUNTU_NAME}
VM_IMAGE_NAME: ${UBUNTU_CACHE_IMAGE_NAME}
@@ -186,9 +118,38 @@ build_task:
CI_DESIRED_RUNTIME: runc
env:
TEST_FLAVOR: build
- clone_script: *full_clone
- setup_script: *setup
- main_script: *main
+ # NOTE: The default way Cirrus-CI clones is *NOT* compatible with
+ # environment expectations in contrib/cirrus/lib.sh. Specifically
+ # the 'origin' remote must be defined, and all remote branches/tags
+ # must be available for reference from CI scripts.
+ clone_script: &full_clone |
+ cd /
+ rm -rf $CIRRUS_WORKING_DIR
+ mkdir -p $CIRRUS_WORKING_DIR
+ git clone --recursive --branch=$DEST_BRANCH https://x-access-token:${CIRRUS_REPO_CLONE_TOKEN}@github.com/${CIRRUS_REPO_FULL_NAME}.git $CIRRUS_WORKING_DIR
+ cd $CIRRUS_WORKING_DIR
+ git remote update origin
+ if [[ -n "$CIRRUS_PR" ]]; then # running for a PR
+ git fetch origin pull/$CIRRUS_PR/head:pull/$CIRRUS_PR
+ git checkout pull/$CIRRUS_PR
+ else
+ git reset --hard $CIRRUS_CHANGE_IN_REPO
+ fi
+ # Some test operations & checks require a git "identity"
+ _gc='git config --file /root/.gitconfig'
+ $_gc user.email "TMcTestFace@example.com"
+ $_gc user.name "Testy McTestface"
+ # Attempt to prevent flakes by confirming basic environment expectations,
+ # network service connectivity and essential container image availability.
+ prebuild_script: &prebuild $SCRIPT_BASE/prebuild.sh
+ # Standard setup stage call, used by nearly every task in CI.
+ setup_script: &setup '$GOSRC/$SCRIPT_BASE/setup_environment.sh'
+ # Attempt to prevent flakes by confirming automation environment and
+ # all required external/3rd-party services are available and functional.
+ # Standard main execution stage call, used by nearly every task in CI.
+ main_script: &main '/usr/bin/time --verbose --output="$STATS_LOGFILE" $GOSRC/$SCRIPT_BASE/runner.sh'
+ # Attempt to catch code-quality and vendoring problems early.
+ postbuild_script: &postbuild $SCRIPT_BASE/postbuild.sh
# Cirrus-CI is very slow uploading one file at time, and the repo contains
# thousands of files. Speed this up by archiving into tarball first.
repo_prep_script: &repo_prep >-
@@ -196,8 +157,10 @@ build_task:
repo_artifacts: &repo_artifacts
path: ./repo.tbz
type: application/octet-stream
- always: *runner_stats
-
+ always: &runner_stats
+ runner_stats_artifacts:
+ path: ./*-${STATS_LOGFILE_SFX}
+ type: text/plain
build_aarch64_task:
alias: 'build_aarch64'
@@ -218,7 +181,9 @@ build_aarch64_task:
CI_DESIRED_RUNTIME: crun
TEST_FLAVOR: build
clone_script: *full_clone
+ prebuild_script: *prebuild
setup_script: *setup
+ postbuild_script: *postbuild
main_script: *main
# Cirrus-CI is very slow uploading one file at time, and the repo contains
# thousands of files. Speed this up by archiving into tarball first.
@@ -242,10 +207,8 @@ validate_task:
# to nonsequential PR merging practices, will be caught on a future PR,
# build or test task failures.
# Docs: ./contrib/cirrus/CIModes.md
- only_if: *is_pr
+ only_if: &is_pr "$CIRRUS_PR != ''"
depends_on:
- - ext_svc_check
- - automation
- build
# golangci-lint is a very, very hungry beast.
gce_instance: &bigvm
@@ -281,8 +244,6 @@ validate_aarch64_task:
# Docs: ./contrib/cirrus/CIModes.md
only_if: *is_pr
depends_on:
- - ext_svc_check
- - automation
- build_aarch64
# golangci-lint is a very, very hungry beast.
ec2_instance: *standard_build_ec2_aarch64
@@ -366,51 +327,6 @@ swagger_task:
type: text/plain
-# Check that all included go modules from other sources match
-# what is expected in `vendor/modules.txt` vs `go.mod`. Also
-# make sure that the generated bindings in pkg/bindings/...
-# are in sync with the code.
-consistency_task:
- name: "Test Code Consistency"
- alias: consistency
- # Docs: ./contrib/cirrus/CIModes.md
- only_if: *is_pr
- depends_on:
- - build
- container: *smallcontainer
- env:
- <<: *stdenvars
- TEST_FLAVOR: consistency
- TEST_ENVIRON: container
- CTR_FQIN: ${FEDORA_CONTAINER_FQIN}
- clone_script: *get_gosrc
- setup_script: *setup
- main_script: *main
- always: *runner_stats
-
-
-# Check that all included go modules from other sources match
-# what is expected in `vendor/modules.txt` vs `go.mod`. Also
-# make sure that the generated bindings in pkg/bindings/...
-# are in sync with the code.
-consistency_aarch64_task:
- name: "Test Code Consistency (aarch64)"
- alias: consistency_aarch64
- # Docs: ./contrib/cirrus/CIModes.md
- only_if: *is_pr
- depends_on:
- - build_aarch64
- ec2_instance: *standard_build_ec2_aarch64
- env:
- <<: *stdenvars_aarch64
- TEST_FLAVOR: consistency
- TEST_ENVIRON: container
- clone_script: *get_gosrc_aarch64
- setup_script: *setup
- main_script: *main
- always: *runner_stats
-
-
# There are several other important variations of podman which
# must always build successfully. Most of them are handled in
# this task, though a few need dedicated tasks which follow.
@@ -643,9 +559,9 @@ container_integration_test_task:
CTR_FQIN: ${FEDORA_CONTAINER_FQIN}
CI_DESIRED_RUNTIME: crun
#- env:
- #DISTRO_NV: ${PRIOR_FEDORA_NAME}
- #VM_IMAGE_NAME: ${PRIOR_FEDORA_CACHE_IMAGE_NAME}
- #CTR_FQIN: ${PRIOR_FEDORA_CONTAINER_FQIN}
+ # DISTRO_NV: ${PRIOR_FEDORA_NAME}
+ # VM_IMAGE_NAME: ${PRIOR_FEDORA_CACHE_IMAGE_NAME}
+ # CTR_FQIN: ${PRIOR_FEDORA_CONTAINER_FQIN}
gce_instance: *standardvm
timeout_in: 90m
env:
@@ -929,8 +845,6 @@ image_build_task: &image-build
# this task to a specific Cirrus-Cron entry with this name.
# Docs: ./contrib/cirrus/CIModes.md
only_if: $CIRRUS_CRON == 'multiarch'
- depends_on:
- - ext_svc_check
timeout_in: 120m # emulation is sssllllooooowwww
gce_instance:
<<: *standardvm
@@ -1010,16 +924,12 @@ success_task:
alias: success
# N/B: ALL tasks must be listed here, minus their '_task' suffix.
depends_on:
- - ext_svc_check
- - automation
- build
- build_aarch64
- validate
- validate_aarch64
- bindings
- swagger
- - consistency
- - consistency_aarch64
- alt_build
- osx_alt_build
- win_installer
@@ -1044,7 +954,12 @@ success_task:
- upgrade_test
- image_build
- meta
- container: *smallcontainer
+ container: &smallcontainer
+ image: ${CTR_FQIN}
+ # Resources are limited across ALL currently executing tasks
+ # ref: https://cirrus-ci.org/guide/linux/#linux-containers
+ cpu: 2
+ memory: 2
env:
CTR_FQIN: ${FEDORA_CONTAINER_FQIN}
TEST_ENVIRON: container
diff --git a/cmd/podman/containers/restore.go b/cmd/podman/containers/restore.go
index ee01e19b8..144925a54 100644
--- a/cmd/podman/containers/restore.go
+++ b/cmd/podman/containers/restore.go
@@ -10,7 +10,6 @@ import (
"github.com/containers/podman/v4/cmd/podman/registry"
"github.com/containers/podman/v4/cmd/podman/utils"
"github.com/containers/podman/v4/cmd/podman/validate"
- "github.com/containers/podman/v4/libpod/define"
"github.com/containers/podman/v4/pkg/domain/entities"
"github.com/containers/podman/v4/pkg/rootless"
"github.com/spf13/cobra"
@@ -94,7 +93,7 @@ func init() {
func restore(cmd *cobra.Command, args []string) error {
var (
- e error
+ err error
errs utils.OutputErrors
)
podmanStart := time.Now()
@@ -105,9 +104,9 @@ func restore(cmd *cobra.Command, args []string) error {
// Check if the container exists (#15055)
exists := &entities.BoolReport{Value: false}
for _, ctr := range args {
- exists, e = registry.ContainerEngine().ContainerExists(registry.GetContext(), ctr, entities.ContainerExistsOptions{})
- if e != nil {
- return e
+ exists, err = registry.ContainerEngine().ContainerExists(registry.GetContext(), ctr, entities.ContainerExistsOptions{})
+ if err != nil {
+ return err
}
if exists.Value {
break
@@ -116,27 +115,10 @@ func restore(cmd *cobra.Command, args []string) error {
if !exists.Value {
// Find out if this is an image
- inspectOpts := entities.InspectOptions{}
- imgData, _, err := registry.ImageEngine().Inspect(context.Background(), args, inspectOpts)
- if err != nil {
- return err
- }
-
- hostInfo, err := registry.ContainerEngine().Info(context.Background())
+ restoreOptions.CheckpointImage, err = utils.IsCheckpointImage(context.Background(), args)
if err != nil {
return err
}
-
- for i := range imgData {
- restoreOptions.CheckpointImage = true
- checkpointRuntimeName, found := imgData[i].Annotations[define.CheckpointAnnotationRuntimeName]
- if !found {
- return fmt.Errorf("image is not a checkpoint: %s", imgData[i].ID)
- }
- if hostInfo.Host.OCIRuntime.Name != checkpointRuntimeName {
- return fmt.Errorf("container image \"%s\" requires runtime: \"%s\"", imgData[i].ID, checkpointRuntimeName)
- }
- }
}
notImport := (!restoreOptions.CheckpointImage && restoreOptions.Import == "")
diff --git a/cmd/podman/containers/run.go b/cmd/podman/containers/run.go
index f66d4d4d3..d8d020c63 100644
--- a/cmd/podman/containers/run.go
+++ b/cmd/podman/containers/run.go
@@ -148,6 +148,35 @@ func run(cmd *cobra.Command, args []string) error {
imageName = name
}
+ // If this is a checkpoint image, invoke container restore.
+ // We do not return `err` when checkpointImage is false, because the value
+ // of `err` could be "image is not a checkpoint". In this case, the run
+ // command should continue as usual, preserving backwards compatibility.
+ checkpointImage, err := utils.IsCheckpointImage(registry.GetContext(), []string{imageName})
+ if checkpointImage {
+ if err != nil {
+ return err
+ }
+ var restoreOptions entities.RestoreOptions
+ responses, err := registry.ContainerEngine().ContainerRestore(registry.GetContext(), []string{imageName}, restoreOptions)
+ if err != nil {
+ return err
+ }
+
+ var errs utils.OutputErrors
+ for _, r := range responses {
+ switch {
+ case r.Err != nil:
+ errs = append(errs, r.Err)
+ case r.RawInput != "":
+ fmt.Println(r.RawInput)
+ default:
+ fmt.Println(r.Id)
+ }
+ }
+ return errs.PrintErrors()
+ }
+
if cliVals.Replace {
if err := replaceContainer(cliVals.Name); err != nil {
return err
diff --git a/cmd/podman/utils/utils.go b/cmd/podman/utils/utils.go
index a265faf51..8063f4309 100644
--- a/cmd/podman/utils/utils.go
+++ b/cmd/podman/utils/utils.go
@@ -1,9 +1,12 @@
package utils
import (
+ "context"
"fmt"
"os"
+ "github.com/containers/podman/v4/cmd/podman/registry"
+ "github.com/containers/podman/v4/libpod/define"
"github.com/containers/podman/v4/pkg/domain/entities"
"github.com/containers/podman/v4/pkg/domain/entities/reports"
)
@@ -99,3 +102,40 @@ func PrintNetworkPruneResults(networkPruneReport []*entities.NetworkPruneReport,
}
return errs.PrintErrors()
}
+
+// IsCheckpointImage returns true with no error only if all values in
+// namesOrIDs correspond to checkpoint images AND these images are
+// compatible with the container runtime that is currently in use,
+// e.g., crun or runc.
+//
+// IsCheckpointImage returns false with no error when none of the values
+// in namesOrIDs corresponds to an ID or name of an image.
+//
+// Otherwise, IsCheckpointImage returns false with appropriate error.
+func IsCheckpointImage(ctx context.Context, namesOrIDs []string) (bool, error) {
+ inspectOpts := entities.InspectOptions{}
+ imgData, _, err := registry.ImageEngine().Inspect(ctx, namesOrIDs, inspectOpts)
+ if err != nil {
+ return false, err
+ }
+ if len(imgData) == 0 {
+ return false, nil
+ }
+ imgID := imgData[0].ID
+
+ hostInfo, err := registry.ContainerEngine().Info(ctx)
+ if err != nil {
+ return false, err
+ }
+
+ for i := range imgData {
+ checkpointRuntimeName, found := imgData[i].Annotations[define.CheckpointAnnotationRuntimeName]
+ if !found {
+ return false, fmt.Errorf("image is not a checkpoint: %s", imgID)
+ }
+ if hostInfo.Host.OCIRuntime.Name != checkpointRuntimeName {
+ return false, fmt.Errorf("container image \"%s\" requires runtime: \"%s\"", imgID, checkpointRuntimeName)
+ }
+ }
+ return true, nil
+}
diff --git a/contrib/cirrus/CIModes.md b/contrib/cirrus/CIModes.md
index 0b5a189a6..7d6a36cf3 100644
--- a/contrib/cirrus/CIModes.md
+++ b/contrib/cirrus/CIModes.md
@@ -43,13 +43,10 @@ of this document, it's not possible to override the behavior of `$CIRRUS_PR`.
## Cirrus Task contexts and runtime modes
### Intended general PR Tasks (*italic*: matrix)
-+ ext_svc_check
-+ automation
+ *build*
+ validate
+ bindings
+ swagger
-+ consistency
+ *alt_build*
+ osx_alt_build
+ docker-py_test
@@ -76,31 +73,22 @@ of this document, it's not possible to override the behavior of `$CIRRUS_PR`.
+ release_test
### Intended `[CI:DOCS]` PR Tasks:
-+ ext_svc_check
-+ automation
+ *build*
+ validate
+ swagger
-+ consistency
+ meta
+ success
### Intended `[CI:COPR]` PR Tasks:
-+ ext_svc_check
-+ automation
+ *build*
+ validate
+ swagger
-+ consistency
+ meta
+ success
### Intend `[CI:BUILD]` PR Tasks:
-+ ext_svc_check
-+ automation
+ *build*
+ validate
-+ consistency
+ *alt_build*
+ osx_alt_build
+ test_image_build
@@ -109,7 +97,6 @@ of this document, it's not possible to override the behavior of `$CIRRUS_PR`.
+ artifacts
### Intended Branch tasks (and Cirrus-cron jobs, except "multiarch"):
-+ ext_svc_check
+ *build*
+ swagger
+ *alt_build*
@@ -123,7 +110,6 @@ of this document, it's not possible to override the behavior of `$CIRRUS_PR`.
+ artifacts
### Intended for "multiarch" Cirrus-Cron (always a branch):
-+ ext_svc_check
+ image_build
+ meta
+ success
diff --git a/contrib/cirrus/check_go_changes.sh b/contrib/cirrus/check_go_changes.sh
index 3c35ce51a..a92ab03af 100755
--- a/contrib/cirrus/check_go_changes.sh
+++ b/contrib/cirrus/check_go_changes.sh
@@ -36,6 +36,8 @@ then
exit 0
fi
+# Defined by/in Cirrus-CI config.
+# shellcheck disable=SC2154
base=$(git merge-base $DEST_BRANCH $CIRRUS_CHANGE_IN_REPO)
diffs=$(git diff $base $CIRRUS_CHANGE_IN_REPO -- '*.go' ':^vendor/')
diff --git a/contrib/cirrus/ext_svc_check.sh b/contrib/cirrus/ext_svc_check.sh
deleted file mode 100755
index 146919c39..000000000
--- a/contrib/cirrus/ext_svc_check.sh
+++ /dev/null
@@ -1,47 +0,0 @@
-#!/bin/bash
-
-set -eo pipefail
-
-# This script attempts basic confirmation of functional networking
-# by connecting to a set of essential external servers and failing
-# if any cannot be reached. It's intended for use early on in the
-# podman CI system, to help prevent wasting time on tests that can't
-# succeed due to some outage or another.
-
-# shellcheck source=./contrib/cirrus/lib.sh
-source $(dirname $0)/lib.sh
-
-cat ${CIRRUS_WORKING_DIR}/${SCRIPT_BASE}/required_host_ports.txt | \
- while read host port
- do
- if [[ "$port" -eq "443" ]]
- then
- echo "SSL/TLS to $host:$port"
- echo -n '' | \
- err_retry 9 1000 "" openssl s_client -quiet -no_ign_eof -connect $host:$port
- else
- echo "Connect to $host:$port"
- err_retry 9 1000 1 nc -zv -w 13 $host $port
- fi
- done
-
-# Verify we can pull metadata from a few key testing images on quay.io
-# in the 'libpod' namespace. This is mostly aimed at validating the
-# quay.io service is up and responsive. Images were hand-picked with
-# egrep -ro 'quay.io/libpod/.+:latest' test | sort -u
-TEST_IMGS=(\
- alpine:latest
- busybox:latest
- alpine_labels:latest
- alpine_nginx:latest
- alpine_healthcheck:latest
- badhealthcheck:latest
- cirros:latest
-)
-
-echo "Checking quay.io test image accessibility"
-for testimg in "${TEST_IMGS[@]}"; do
- fqin="quay.io/libpod/$testimg"
- echo " $fqin"
- skopeo inspect --retry-times 5 "docker://$fqin" | jq . > /dev/null
-done
diff --git a/contrib/cirrus/postbuild.sh b/contrib/cirrus/postbuild.sh
new file mode 100755
index 000000000..47cb558e3
--- /dev/null
+++ b/contrib/cirrus/postbuild.sh
@@ -0,0 +1,30 @@
+#!/bin/bash
+
+set -eo pipefail
+
+# This script attempts to confirm all included go modules from
+# other sources match what is expected in `vendor/modules.txt`
+# vs `go.mod`. Also make sure that the generated bindings in
+# `pkg/bindings/...` are in sync with the code. It's intended
+# for use after successfully building podman, to prevent wasting
+# time on tests that might otherwise succeed with bad/ugly/invalid
+# code.
+
+source /etc/automation_environment
+source $AUTOMATION_LIB_PATH/common_lib.sh
+
+# Defined by the CI system
+# shellcheck disable=SC2154
+cd $CIRRUS_WORKING_DIR
+
+showrun make .install.goimports
+showrun make vendor
+SUGGESTION="run 'make vendor' and commit all changes" ./hack/tree_status.sh
+showrun make generate-bindings
+SUGGESTION="run 'make generate-bindings' and commit all changes" ./hack/tree_status.sh
+showrun make completions
+SUGGESTION="run 'make completions' and commit all changes" ./hack/tree_status.sh
+
+# Defined in Cirrus-CI config.
+# shellcheck disable=SC2154
+$SCRIPT_BASE/check_go_changes.sh
diff --git a/contrib/cirrus/prebuild.sh b/contrib/cirrus/prebuild.sh
new file mode 100755
index 000000000..ea05d90dc
--- /dev/null
+++ b/contrib/cirrus/prebuild.sh
@@ -0,0 +1,77 @@
+#!/bin/bash
+
+set -eo pipefail
+
+# This script attempts to confirm functional networking and
+# connectivity to essential external servers. It also verifies
+# some basic environmental expectations and shell-script sanity.
+# It's intended for use early on in the podman CI system, to help
+# prevent wasting time on tests that can't succeed due to some
+# outage, failure, or missed expectation.
+
+source /etc/automation_environment
+source $AUTOMATION_LIB_PATH/common_lib.sh
+
+req_env_vars CI DEST_BRANCH IMAGE_SUFFIX TEST_FLAVOR TEST_ENVIRON \
+ PODBIN_NAME PRIV_NAME DISTRO_NV AUTOMATION_LIB_PATH \
+ SCRIPT_BASE CIRRUS_WORKING_DIR FEDORA_NAME UBUNTU_NAME \
+ VM_IMAGE_NAME
+
+# Defined by the CI system
+# shellcheck disable=SC2154
+cd $CIRRUS_WORKING_DIR
+
+# Defined by CI config.
+# shellcheck disable=SC2154
+showrun $SCRIPT_BASE/cirrus_yaml_test.py
+
+# Defined by CI config.
+# shellcheck disable=SC2154
+if [[ "${DISTRO_NV}" =~ fedora ]]; then
+ showrun ooe.sh dnf install -y ShellCheck # small/quick addition
+ showrun shellcheck --color=always --format=tty \
+ --shell=bash --external-sources \
+ --enable add-default-case,avoid-nullary-conditions,check-unassigned-uppercase \
+ --exclude SC2046,SC2034,SC2090,SC2064 \
+ --wiki-link-count=0 --severity=warning \
+ $SCRIPT_BASE/*.sh hack/get_ci_vm.sh
+fi
+
+msg "Checking 3rd party network service connectivity"
+# shellcheck disable=SC2154
+cat ${CIRRUS_WORKING_DIR}/${SCRIPT_BASE}/required_host_ports.txt | \
+ while read host port
+ do
+ if [[ "$port" -eq "443" ]]
+ then
+ echo "SSL/TLS to $host:$port"
+ echo -n '' | \
+ err_retry 9 1000 "" openssl s_client -quiet -no_ign_eof -connect $host:$port
+ else
+ echo "Connect to $host:$port"
+ err_retry 9 1000 1 nc -zv -w 13 $host $port
+ fi
+ done
+
+# Verify we can pull metadata from a few key testing images on quay.io
+# in the 'libpod' namespace. This is mostly aimed at validating the
+# quay.io service is up and responsive. Images were hand-picked with
+# egrep -ro 'quay.io/libpod/.+:latest' test | sort -u
+TEST_IMGS=(\
+ alpine:latest
+ busybox:latest
+ alpine_labels:latest
+ alpine_nginx:latest
+ alpine_healthcheck:latest
+ badhealthcheck:latest
+ cirros:latest
+)
+
+msg "Checking quay.io test image accessibility"
+for testimg in "${TEST_IMGS[@]}"; do
+ fqin="quay.io/libpod/$testimg"
+ echo " $fqin"
+ # Belt-and-suspenders: Catch skopeo (somehow) returning False or null
+ # in addition to "bad" (invalid) JSON.
+ skopeo inspect --retry-times 5 "docker://$fqin" | jq -e . > /dev/null
+done
diff --git a/contrib/cirrus/runner.sh b/contrib/cirrus/runner.sh
index c44251e2f..d360f6a04 100755
--- a/contrib/cirrus/runner.sh
+++ b/contrib/cirrus/runner.sh
@@ -19,21 +19,6 @@ set -eo pipefail
# shellcheck source=contrib/cirrus/lib.sh
source $(dirname $0)/lib.sh
-function _run_ext_svc() {
- $SCRIPT_BASE/ext_svc_check.sh
-}
-
-function _run_automation() {
- $SCRIPT_BASE/cirrus_yaml_test.py
-
- req_env_vars CI DEST_BRANCH IMAGE_SUFFIX TEST_FLAVOR TEST_ENVIRON \
- PODBIN_NAME PRIV_NAME DISTRO_NV CONTAINER USER HOME \
- UID AUTOMATION_LIB_PATH SCRIPT_BASE OS_RELEASE_ID \
- CG_FS_TYPE
- bigto ooe.sh dnf install -y ShellCheck # small/quick addition
- $SCRIPT_BASE/shellcheck.sh
-}
-
function _run_validate() {
# TODO: aarch64 images need python3-devel installed
# https://github.com/containers/automation_images/issues/159
@@ -226,16 +211,6 @@ eof
rm -f $envvarsfile
}
-function _run_consistency() {
- make vendor
- SUGGESTION="run 'make vendor' and commit all changes" ./hack/tree_status.sh
- make generate-bindings
- SUGGESTION="run 'make generate-bindings' and commit all changes" ./hack/tree_status.sh
- make completions
- SUGGESTION="run 'make completions' and commit all changes" ./hack/tree_status.sh
- $SCRIPT_BASE/check_go_changes.sh
-}
-
function _run_build() {
# Ensure always start from clean-slate with all vendor modules downloaded
make clean
@@ -423,6 +398,8 @@ function _bail_if_test_can_be_skipped() {
return 0
fi
+ # Defined by Cirrus-CI for all tasks
+ # shellcheck disable=SC2154
head=$CIRRUS_CHANGE_IN_REPO
base=$(git merge-base $DEST_BRANCH $head)
diffs=$(git diff --name-only $base $head)
diff --git a/contrib/cirrus/setup_environment.sh b/contrib/cirrus/setup_environment.sh
index 4c86bbcfa..ca1e16544 100755
--- a/contrib/cirrus/setup_environment.sh
+++ b/contrib/cirrus/setup_environment.sh
@@ -228,13 +228,11 @@ esac
# Required to be defined by caller: The primary type of testing that will be performed
# shellcheck disable=SC2154
case "$TEST_FLAVOR" in
- ext_svc) ;;
validate)
dnf install -y $PACKAGE_DOWNLOAD_DIR/python3*.rpm
# For some reason, this is also needed for validation
make .install.pre-commit .install.gitvalidation
;;
- automation) ;;
altbuild)
# Defined in .cirrus.yml
# shellcheck disable=SC2154
@@ -366,10 +364,6 @@ case "$TEST_FLAVOR" in
docker.io/gitlab/gitlab-runner-helper:x86_64-latest-pwsh
;;
swagger) ;& # use next item
- consistency)
- make clean
- make .install.goimports
- ;;
release) ;;
*) die_unknown TEST_FLAVOR
esac
diff --git a/contrib/cirrus/shellcheck.sh b/contrib/cirrus/shellcheck.sh
deleted file mode 100755
index 667d30c91..000000000
--- a/contrib/cirrus/shellcheck.sh
+++ /dev/null
@@ -1,16 +0,0 @@
-#!/bin/bash
-
-set -eo pipefail
-
-# shellcheck source=./contrib/cirrus/lib.sh
-source $(dirname $0)/lib.sh
-
-cd $CIRRUS_WORKING_DIR
-shellcheck --color=always --format=tty \
- --shell=bash --external-sources \
- --enable add-default-case,avoid-nullary-conditions,check-unassigned-uppercase \
- --exclude SC2046,SC2034,SC2090,SC2064 \
- --wiki-link-count=0 --severity=warning \
- $SCRIPT_BASE/*.sh hack/get_ci_vm.sh
-
-echo "Shellcheck: PASS"
diff --git a/contrib/podmanimage/README.md b/contrib/podmanimage/README.md
index ab406a56a..8720b41c7 100644
--- a/contrib/podmanimage/README.md
+++ b/contrib/podmanimage/README.md
@@ -1,3 +1,16 @@
+[comment]: <> (***ATTENTION*** ***WARNING*** ***ALERT*** ***CAUTION*** ***DANGER***)
+[comment]: <> ()
+[comment]: <> (ANY changes made to this file, once commited/merged must)
+[comment]: <> (be manually copy/pasted -in markdown- into the description)
+[comment]: <> (field on Quay at the following locations:)
+[comment]: <> ()
+[comment]: <> (https://quay.io/repository/containers/podman)
+[comment]: <> (https://quay.io/repository/podman/stable)
+[comment]: <> (https://quay.io/repository/podman/testing)
+[comment]: <> (https://quay.io/repository/podman/upstream)
+[comment]: <> ()
+[comment]: <> (***ATTENTION*** ***WARNING*** ***ALERT*** ***CAUTION*** ***DANGER***)
+
![PODMAN logo](https://raw.githubusercontent.com/containers/common/main/logos/podman-logo-full-vert.png)
# podmanimage
diff --git a/docs/source/markdown/options/network.md b/docs/source/markdown/options/network.md
new file mode 100644
index 000000000..e2a2dc36a
--- /dev/null
+++ b/docs/source/markdown/options/network.md
@@ -0,0 +1,32 @@
+#### **--network**=*mode*, **--net**
+
+Set the network mode for the <<container|pod>>.
+
+Valid _mode_ values are:
+
+- **bridge[:OPTIONS,...]**: Create a network stack on the default bridge. This is the default for rootful containers. It is possible to specify these additional options:
+ - **alias=name**: Add network-scoped alias for the container.
+ - **ip=IPv4**: Specify a static ipv4 address for this container.
+ - **ip=IPv6**: Specify a static ipv6 address for this container.
+ - **mac=MAC**: Specify a static mac address for this container.
+ - **interface_name**: Specify a name for the created network interface inside the container.
+
+ For example to set a static ipv4 address and a static mac address, use `--network bridge:ip=10.88.0.10,mac=44:33:22:11:00:99`.
+- \<network name or ID\>[:OPTIONS,...]: Connect to a user-defined network; this is the network name or ID from a network created by **[podman network create](podman-network-create.1.md)**. Using the network name implies the bridge network mode. It is possible to specify the same options described under the bridge mode above. You can use the **--network** option multiple times to specify additional networks.
+- **none**: Create a network namespace for the container but do not configure network interfaces for it, thus the container has no network connectivity.
+- **container:**_id_: Reuse another container's network stack.
+- **host**: Do not create a network namespace, the container will use the host's network. Note: The host mode gives the container full access to local system services such as D-bus and is therefore considered insecure.
+- **ns:**_path_: Path to a network namespace to join.
+- **private**: Create a new namespace for the container. This will use the **bridge** mode for rootful containers and **slirp4netns** for rootless ones.
+- **slirp4netns[:OPTIONS,...]**: use **slirp4netns**(1) to create a user network stack. This is the default for rootless containers. It is possible to specify these additional options, they can also be set with `network_cmd_options` in containers.conf:
+ - **allow_host_loopback=true|false**: Allow slirp4netns to reach the host loopback IP (default is 10.0.2.2 or the second IP from slirp4netns cidr subnet when changed, see the cidr option below). The default is false.
+ - **mtu=MTU**: Specify the MTU to use for this network. (Default is `65520`).
+ - **cidr=CIDR**: Specify ip range to use for this network. (Default is `10.0.2.0/24`).
+ - **enable_ipv6=true|false**: Enable IPv6. Default is true. (Required for `outbound_addr6`).
+ - **outbound_addr=INTERFACE**: Specify the outbound interface slirp should bind to (ipv4 traffic only).
+ - **outbound_addr=IPv4**: Specify the outbound ipv4 address slirp should bind to.
+ - **outbound_addr6=INTERFACE**: Specify the outbound interface slirp should bind to (ipv6 traffic only).
+ - **outbound_addr6=IPv6**: Specify the outbound ipv6 address slirp should bind to.
+ - **port_handler=rootlesskit**: Use rootlesskit for port forwarding. Default.
+ Note: Rootlesskit changes the source IP address of incoming packets to an IP address in the container network namespace, usually `10.0.2.100`. If your application requires the real source IP address, e.g. web server logs, use the slirp4netns port handler. The rootlesskit port handler is also used for rootless containers when connected to user-defined networks.
+ - **port_handler=slirp4netns**: Use the slirp4netns port forwarding, it is slower than rootlesskit but preserves the correct source IP address. This port handler cannot be used for user-defined networks.
diff --git a/docs/source/markdown/podman-create.1.md.in b/docs/source/markdown/podman-create.1.md.in
index 102215585..503e6fac7 100644
--- a/docs/source/markdown/podman-create.1.md.in
+++ b/docs/source/markdown/podman-create.1.md.in
@@ -244,38 +244,11 @@ pod when that pod is not running.
@@option name.container
-#### **--network**=*mode*, **--net**
-
-Set the network mode for the container. Invalid if using **--dns**, **--dns-option**, or **--dns-search** with **--network** set to **none** or **container:**_id_. If used together with **--pod**, the container will not join the pod's network namespace.
-
-Valid _mode_ values are:
-
-- **bridge[:OPTIONS,...]**: Create a network stack on the default bridge. This is the default for rootful containers. It is possible to specify these additional options:
- - **alias=name**: Add network-scoped alias for the container.
- - **ip=IPv4**: Specify a static ipv4 address for this container.
- - **ip=IPv6**: Specify a static ipv6 address for this container.
- - **mac=MAC**: Specify a static mac address for this container.
- - **interface_name**: Specify a name for the created network interface inside the container.
-
- For example to set a static ipv4 address and a static mac address, use `--network bridge:ip=10.88.0.10,mac=44:33:22:11:00:99`.
-- \<network name or ID\>[:OPTIONS,...]: Connect to a user-defined network; this is the network name or ID from a network created by **[podman network create](podman-network-create.1.md)**. Using the network name implies the bridge network mode. It is possible to specify the same options described under the bridge mode above. You can use the **--network** option multiple times to specify additional networks.
-- **none**: Create a network namespace for the container but do not configure network interfaces for it, thus the container has no network connectivity.
-- **container:**_id_: Reuse another container's network stack.
-- **host**: Do not create a network namespace, the container will use the host's network. Note: The host mode gives the container full access to local system services such as D-bus and is therefore considered insecure.
-- **ns:**_path_: Path to a network namespace to join.
-- **private**: Create a new namespace for the container. This will use the **bridge** mode for rootful containers and **slirp4netns** for rootless ones.
-- **slirp4netns[:OPTIONS,...]**: use **slirp4netns**(1) to create a user network stack. This is the default for rootless containers. It is possible to specify these additional options, they can also be set with `network_cmd_options` in containers.conf:
- - **allow_host_loopback=true|false**: Allow slirp4netns to reach the host loopback IP (default is 10.0.2.2 or the second IP from slirp4netns cidr subnet when changed, see the cidr option below). The default is false.
- - **mtu=MTU**: Specify the MTU to use for this network. (Default is `65520`).
- - **cidr=CIDR**: Specify ip range to use for this network. (Default is `10.0.2.0/24`).
- - **enable_ipv6=true|false**: Enable IPv6. Default is true. (Required for `outbound_addr6`).
- - **outbound_addr=INTERFACE**: Specify the outbound interface slirp should bind to (ipv4 traffic only).
- - **outbound_addr=IPv4**: Specify the outbound ipv4 address slirp should bind to.
- - **outbound_addr6=INTERFACE**: Specify the outbound interface slirp should bind to (ipv6 traffic only).
- - **outbound_addr6=IPv6**: Specify the outbound ipv6 address slirp should bind to.
- - **port_handler=rootlesskit**: Use rootlesskit for port forwarding. Default.
- Note: Rootlesskit changes the source IP address of incoming packets to an IP address in the container network namespace, usually `10.0.2.100`. If your application requires the real source IP address, e.g. web server logs, use the slirp4netns port handler. The rootlesskit port handler is also used for rootless containers when connected to user-defined networks.
- - **port_handler=slirp4netns**: Use the slirp4netns port forwarding, it is slower than rootlesskit but preserves the correct source IP address. This port handler cannot be used for user-defined networks.
+@@option network
+
+Invalid if using **--dns**, **--dns-option**, or **--dns-search** with **--network** set to **none** or **container:**_id_.
+
+If used together with **--pod**, the container will not join the pod's network namespace.
@@option network-alias
diff --git a/docs/source/markdown/podman-kube-play.1.md.in b/docs/source/markdown/podman-kube-play.1.md.in
index cc7934b5d..d3a6eaa03 100644
--- a/docs/source/markdown/podman-kube-play.1.md.in
+++ b/docs/source/markdown/podman-kube-play.1.md.in
@@ -153,36 +153,9 @@ Set logging driver for all created containers.
Assign a static mac address to the pod. This option can be specified several times when kube play creates more than one pod.
Note: When joining multiple networks you should use the **--network name:mac=\<mac\>** syntax.
-#### **--network**=*mode*, **--net**
-
-Change the network mode of the pod. The host network mode should be configured in the YAML file.
-Valid _mode_ values are:
-
-- **bridge[:OPTIONS,...]**: Create a network stack on the default bridge. This is the default for rootful containers. It is possible to specify these additional options:
- - **alias=name**: Add network-scoped alias for the container.
- - **ip=IPv4**: Specify a static ipv4 address for this container.
- - **ip=IPv6**: Specify a static ipv6 address for this container.
- - **mac=MAC**: Specify a static mac address for this container.
- - **interface_name**: Specify a name for the created network interface inside the container.
-
- For example to set a static ipv4 address and a static mac address, use `--network bridge:ip=10.88.0.10,mac=44:33:22:11:00:99`.
-- \<network name or ID\>[:OPTIONS,...]: Connect to a user-defined network; this is the network name or ID from a network created by **[podman network create](podman-network-create.1.md)**. Using the network name implies the bridge network mode. It is possible to specify the same options described under the bridge mode above. You can use the **--network** option multiple times to specify additional networks.
-- **none**: Create a network namespace for the container but do not configure network interfaces for it, thus the container has no network connectivity.
-- **container:**_id_: Reuse another container's network stack.
-- **ns:**_path_: Path to a network namespace to join.
-- **private**: Create a new namespace for the container. This will use the **bridge** mode for rootful containers and **slirp4netns** for rootless ones.
-- **slirp4netns[:OPTIONS,...]**: use **slirp4netns**(1) to create a user network stack. This is the default for rootless containers. It is possible to specify these additional options, they can also be set with `network_cmd_options` in containers.conf:
- - **allow_host_loopback=true|false**: Allow slirp4netns to reach the host loopback IP (default is 10.0.2.2 or the second IP from slirp4netns cidr subnet when changed, see the cidr option below). The default is false.
- - **mtu=MTU**: Specify the MTU to use for this network. (Default is `65520`).
- - **cidr=CIDR**: Specify ip range to use for this network. (Default is `10.0.2.0/24`).
- - **enable_ipv6=true|false**: Enable IPv6. Default is true. (Required for `outbound_addr6`).
- - **outbound_addr=INTERFACE**: Specify the outbound interface slirp should bind to (ipv4 traffic only).
- - **outbound_addr=IPv4**: Specify the outbound ipv4 address slirp should bind to.
- - **outbound_addr6=INTERFACE**: Specify the outbound interface slirp should bind to (ipv6 traffic only).
- - **outbound_addr6=IPv6**: Specify the outbound ipv6 address slirp should bind to.
- - **port_handler=rootlesskit**: Use rootlesskit for port forwarding. Default.
- Note: Rootlesskit changes the source IP address of incoming packets to an IP address in the container network namespace, usually `10.0.2.100`. If your application requires the real source IP address, e.g. web server logs, use the slirp4netns port handler. The rootlesskit port handler is also used for rootless containers when connected to user-defined networks.
- - **port_handler=slirp4netns**: Use the slirp4netns port forwarding, it is slower than rootlesskit but preserves the correct source IP address. This port handler cannot be used for user-defined networks.
+@@option network
+
+The *host* network mode should be configured in the YAML file.
@@option no-hosts
diff --git a/docs/source/markdown/podman-pod-create.1.md.in b/docs/source/markdown/podman-pod-create.1.md.in
index fdae1d249..14c798772 100644
--- a/docs/source/markdown/podman-pod-create.1.md.in
+++ b/docs/source/markdown/podman-pod-create.1.md.in
@@ -117,38 +117,9 @@ The custom image that will be used for the infra container. Unless specified, P
Assign a name to the pod.
-#### **--network**=*mode*, **--net**
-
-Set the network mode for the pod. Invalid if using **--dns**, **--dns-option**, or **--dns-search** with **--network** that is set to **none** or **container:**_id_.
-
-Valid _mode_ values are:
-
-- **bridge[:OPTIONS,...]**: Create a network stack on the default bridge. This is the default for rootful containers. It is possible to specify these additional options:
- - **alias=name**: Add network-scoped alias for the container.
- - **ip=IPv4**: Specify a static ipv4 address for this container.
- - **ip=IPv6**: Specify a static ipv6 address for this container.
- - **mac=MAC**: Specify a static mac address for this container.
- - **interface_name**: Specify a name for the created network interface inside the container.
-
- For example to set a static ipv4 address and a static mac address, use `--network bridge:ip=10.88.0.10,mac=44:33:22:11:00:99`.
-- \<network name or ID\>[:OPTIONS,...]: Connect to a user-defined network; this is the network name or ID from a network created by **[podman network create](podman-network-create.1.md)**. Using the network name implies the bridge network mode. It is possible to specify the same options described under the bridge mode above. You can use the **--network** option multiple times to specify additional networks.
-- **none**: Create a network namespace for the container but do not configure network interfaces for it, thus the container has no network connectivity.
-- **container:**_id_: Reuse another container's network stack.
-- **host**: Do not create a network namespace, the container will use the host's network. Note: The host mode gives the container full access to local system services such as D-bus and is therefore considered insecure.
-- **ns:**_path_: Path to a network namespace to join.
-- **private**: Create a new namespace for the container. This will use the **bridge** mode for rootful containers and **slirp4netns** for rootless ones.
-- **slirp4netns[:OPTIONS,...]**: use **slirp4netns**(1) to create a user network stack. This is the default for rootless containers. It is possible to specify these additional options, they can also be set with `network_cmd_options` in containers.conf:
- - **allow_host_loopback=true|false**: Allow slirp4netns to reach the host loopback IP (default is 10.0.2.2 or the second IP from slirp4netns cidr subnet when changed, see the cidr option below). The default is false.
- - **mtu=MTU**: Specify the MTU to use for this network. (Default is `65520`).
- - **cidr=CIDR**: Specify ip range to use for this network. (Default is `10.0.2.0/24`).
- - **enable_ipv6=true|false**: Enable IPv6. Default is true. (Required for `outbound_addr6`).
- - **outbound_addr=INTERFACE**: Specify the outbound interface slirp should bind to (ipv4 traffic only).
- - **outbound_addr=IPv4**: Specify the outbound ipv4 address slirp should bind to.
- - **outbound_addr6=INTERFACE**: Specify the outbound interface slirp should bind to (ipv6 traffic only).
- - **outbound_addr6=IPv6**: Specify the outbound ipv6 address slirp should bind to.
- - **port_handler=rootlesskit**: Use rootlesskit for port forwarding. Default.
- Note: Rootlesskit changes the source IP address of incoming packets to an IP address in the container network namespace, usually `10.0.2.100`. If your application requires the real source IP address, e.g. web server logs, use the slirp4netns port handler. The rootlesskit port handler is also used for rootless containers when connected to user-defined networks.
- - **port_handler=slirp4netns**: Use the slirp4netns port forwarding, it is slower than rootlesskit but preserves the correct source IP address. This port handler cannot be used for user-defined networks.
+@@option network
+
+Invalid if using **--dns**, **--dns-option**, or **--dns-search** with **--network** set to **none** or **container:**_id_.
@@option network-alias
diff --git a/docs/source/markdown/podman-run.1.md.in b/docs/source/markdown/podman-run.1.md.in
index 57474975a..88547e126 100644
--- a/docs/source/markdown/podman-run.1.md.in
+++ b/docs/source/markdown/podman-run.1.md.in
@@ -265,38 +265,11 @@ Print usage statement
@@option name.container
-#### **--network**=*mode*, **--net**
-
-Set the network mode for the container. Invalid if using **--dns**, **--dns-option**, or **--dns-search** with **--network** set to **none** or **container:**_id_. If used together with **--pod**, the container will not join the pod's network namespace.
-
-Valid _mode_ values are:
-
-- **bridge[:OPTIONS,...]**: Create a network stack on the default bridge. This is the default for rootful containers. It is possible to specify these additional options:
- - **alias=name**: Add network-scoped alias for the container.
- - **ip=IPv4**: Specify a static ipv4 address for this container.
- - **ip=IPv6**: Specify a static ipv6 address for this container.
- - **mac=MAC**: Specify a static mac address for this container.
- - **interface_name**: Specify a name for the created network interface inside the container.
-
- For example to set a static ipv4 address and a static mac address, use `--network bridge:ip=10.88.0.10,mac=44:33:22:11:00:99`.
-- \<network name or ID\>[:OPTIONS,...]: Connect to a user-defined network; this is the network name or ID from a network created by **[podman network create](podman-network-create.1.md)**. Using the network name implies the bridge network mode. It is possible to specify the same options described under the bridge mode above. You can use the **--network** option multiple times to specify additional networks.
-- **none**: Create a network namespace for the container but do not configure network interfaces for it, thus the container has no network connectivity.
-- **container:**_id_: Reuse another container's network stack.
-- **host**: Do not create a network namespace, the container will use the host's network. Note: The host mode gives the container full access to local system services such as D-bus and is therefore considered insecure.
-- **ns:**_path_: Path to a network namespace to join.
-- **private**: Create a new namespace for the container. This will use the **bridge** mode for rootful containers and **slirp4netns** for rootless ones.
-- **slirp4netns[:OPTIONS,...]**: use **slirp4netns**(1) to create a user network stack. This is the default for rootless containers. It is possible to specify these additional options, they can also be set with `network_cmd_options` in containers.conf:
- - **allow_host_loopback=true|false**: Allow slirp4netns to reach the host loopback IP (default is 10.0.2.2 or the second IP from slirp4netns cidr subnet when changed, see the cidr option below). The default is false.
- - **mtu=MTU**: Specify the MTU to use for this network. (Default is `65520`).
- - **cidr=CIDR**: Specify ip range to use for this network. (Default is `10.0.2.0/24`).
- - **enable_ipv6=true|false**: Enable IPv6. Default is true. (Required for `outbound_addr6`).
- - **outbound_addr=INTERFACE**: Specify the outbound interface slirp should bind to (ipv4 traffic only).
- - **outbound_addr=IPv4**: Specify the outbound ipv4 address slirp should bind to.
- - **outbound_addr6=INTERFACE**: Specify the outbound interface slirp should bind to (ipv6 traffic only).
- - **outbound_addr6=IPv6**: Specify the outbound ipv6 address slirp should bind to.
- - **port_handler=rootlesskit**: Use rootlesskit for port forwarding. Default.
- Note: Rootlesskit changes the source IP address of incoming packets to an IP address in the container network namespace, usually `10.0.2.100`. If your application requires the real source IP address, e.g. web server logs, use the slirp4netns port handler. The rootlesskit port handler is also used for rootless containers when connected to user-defined networks.
- - **port_handler=slirp4netns**: Use the slirp4netns port forwarding, it is slower than rootlesskit but preserves the correct source IP address. This port handler cannot be used for user-defined networks.
+@@option network
+
+Invalid if using **--dns**, **--dns-option**, or **--dns-search** with **--network** set to **none** or **container:**_id_.
+
+If used together with **--pod**, the container will not join the pod's network namespace.
@@option network-alias
diff --git a/go.mod b/go.mod
index 6b675369c..ada872932 100644
--- a/go.mod
+++ b/go.mod
@@ -12,12 +12,12 @@ require (
github.com/containernetworking/cni v1.1.2
github.com/containernetworking/plugins v1.1.1
github.com/containers/buildah v1.27.1-0.20220921131114-d3064796af36
- github.com/containers/common v0.49.2-0.20220926195839-590004b80685
+ github.com/containers/common v0.49.2-0.20220929111928-2d1b45ae2423
github.com/containers/conmon v2.0.20+incompatible
github.com/containers/image/v5 v5.22.1-0.20220919112403-fe51f7ffca50
github.com/containers/ocicrypt v1.1.5
github.com/containers/psgo v1.7.3
- github.com/containers/storage v1.42.1-0.20220919112236-8a581aac3bdf
+ github.com/containers/storage v1.43.0
github.com/coreos/go-systemd/v22 v22.4.0
github.com/coreos/stream-metadata-go v0.0.0-20210225230131-70edb9eb47b3
github.com/cyphar/filepath-securejoin v0.2.3
@@ -48,7 +48,7 @@ require (
github.com/opencontainers/runc v1.1.4
github.com/opencontainers/runtime-spec v1.0.3-0.20211214071223-8958f93039ab
github.com/opencontainers/runtime-tools v0.9.1-0.20220714195903-17b3287fafb7
- github.com/opencontainers/selinux v1.10.1
+ github.com/opencontainers/selinux v1.10.2
github.com/openshift/imagebuilder v1.2.4-0.20220711175835-4151e43600df
github.com/rootless-containers/rootlesskit v1.0.1
github.com/sirupsen/logrus v1.9.0
diff --git a/go.sum b/go.sum
index 1ed28a7ba..20666dcfe 100644
--- a/go.sum
+++ b/go.sum
@@ -420,8 +420,8 @@ github.com/containernetworking/plugins v1.1.1/go.mod h1:Sr5TH/eBsGLXK/h71HeLfX19
github.com/containers/buildah v1.27.1-0.20220921131114-d3064796af36 h1:LTSEbPUbs0slJSJ+IH6atAjYDe0IDzA0sPgBLjT1yAo=
github.com/containers/buildah v1.27.1-0.20220921131114-d3064796af36/go.mod h1:cY3pGPyMmrNp/sEDK8ESoBOf4hoNovptZSI0oyo8eQM=
github.com/containers/common v0.49.2-0.20220920205255-8062f81c5497/go.mod h1:ZnhOPR/07UOkfIg5bezUpBilGjxEUdaeoUpu7gRBGc0=
-github.com/containers/common v0.49.2-0.20220926195839-590004b80685 h1:rutCgIKcew85mTUO0JTnh7XDXQfaTz/qQ3HyQHb0jZE=
-github.com/containers/common v0.49.2-0.20220926195839-590004b80685/go.mod h1:ZnhOPR/07UOkfIg5bezUpBilGjxEUdaeoUpu7gRBGc0=
+github.com/containers/common v0.49.2-0.20220929111928-2d1b45ae2423 h1:2QfVh7+dAKLg9Kht5n4YtRzg5WnQger0R1Brn/6TeUs=
+github.com/containers/common v0.49.2-0.20220929111928-2d1b45ae2423/go.mod h1:sJZt3VeNeXVQT7gTLDBu2Nr8x7Fv2/pa3n9m8661gsU=
github.com/containers/conmon v2.0.20+incompatible h1:YbCVSFSCqFjjVwHTPINGdMX1F6JXHGTUje2ZYobNrkg=
github.com/containers/conmon v2.0.20+incompatible/go.mod h1:hgwZ2mtuDrppv78a/cOBNiCm6O0UMWGx1mu7P00nu5I=
github.com/containers/image/v5 v5.22.1-0.20220907162003-651744379993/go.mod h1:/Ruurd87C6Ap45t1PWNOD8+SGwiZbk79XCgs1iUTvYA=
@@ -441,8 +441,9 @@ github.com/containers/psgo v1.7.3/go.mod h1:PfaNzzHmMb8M9/blPgyD4BB3ZEj/0ApZIxN6
github.com/containers/storage v1.37.0/go.mod h1:kqeJeS0b7DO2ZT1nVWs0XufrmPFbgV3c+Q/45RlH6r4=
github.com/containers/storage v1.42.0/go.mod h1:JiUJwOgOo1dr2DdOUc1MRe2GCAXABYoYmOdPF8yvH78=
github.com/containers/storage v1.42.1-0.20220907083030-5aff7f62e8d0/go.mod h1:nj2fW3rgwkr6toBVFzv5OqUYs1kowX+AMiPjgv2UXN0=
-github.com/containers/storage v1.42.1-0.20220919112236-8a581aac3bdf h1:CnGYVAFSZgwYdYHnJJhVnhxtrggWsgwooG/Be1LxWGI=
github.com/containers/storage v1.42.1-0.20220919112236-8a581aac3bdf/go.mod h1:uZ147thiIFGdVTjMmIw19knttQnUCl3y9zjreHrg11s=
+github.com/containers/storage v1.43.0 h1:P+zulGXA3mqe2GnYmZU0xu87Wy1M0PVHM2ucrgmvTdU=
+github.com/containers/storage v1.43.0/go.mod h1:uZ147thiIFGdVTjMmIw19knttQnUCl3y9zjreHrg11s=
github.com/coreos/bbolt v1.3.2/go.mod h1:iRUV2dpdMOn7Bo10OQBFzIJO9kkE559Wcmn+qkEiiKk=
github.com/coreos/etcd v3.3.10+incompatible/go.mod h1:uF7uidLiAD3TWHmW31ZFd/JWoc32PjwdhPthX9715RE=
github.com/coreos/etcd v3.3.13+incompatible/go.mod h1:uF7uidLiAD3TWHmW31ZFd/JWoc32PjwdhPthX9715RE=
@@ -1411,8 +1412,9 @@ github.com/opencontainers/selinux v1.8.2/go.mod h1:MUIHuUEvKB1wtJjQdOyYRgOnLD2xA
github.com/opencontainers/selinux v1.8.5/go.mod h1:HTvjPFoGMbpQsG886e3lQwnsRWtE4TC1OF3OUvG9FAo=
github.com/opencontainers/selinux v1.9.1/go.mod h1:2i0OySw99QjzBBQByd1Gr9gSjvuho1lHsJxIJ3gGbJI=
github.com/opencontainers/selinux v1.10.0/go.mod h1:2i0OySw99QjzBBQByd1Gr9gSjvuho1lHsJxIJ3gGbJI=
-github.com/opencontainers/selinux v1.10.1 h1:09LIPVRP3uuZGQvgR+SgMSNBd1Eb3vlRbGqQpoHsF8w=
github.com/opencontainers/selinux v1.10.1/go.mod h1:2i0OySw99QjzBBQByd1Gr9gSjvuho1lHsJxIJ3gGbJI=
+github.com/opencontainers/selinux v1.10.2 h1:NFy2xCsjn7+WspbfZkUd5zyVeisV7VFbPSP96+8/ha4=
+github.com/opencontainers/selinux v1.10.2/go.mod h1:cARutUbaUrlRClyvxOICCgKixCs6L05aUsohzA3EkHQ=
github.com/openshift/imagebuilder v1.2.4-0.20220711175835-4151e43600df h1:vf6pdI10F2Tim5a9JKiVVl4/dpNz1OEhz4EnfLdLtiA=
github.com/openshift/imagebuilder v1.2.4-0.20220711175835-4151e43600df/go.mod h1:TRYHe4CH9U6nkDjxjBNM5klrLbJBrRbpJE5SaRwUBsQ=
github.com/opentracing/opentracing-go v1.1.0/go.mod h1:UkNAQd3GIcIGf0SeVgPpRdFStlNbqXla1AfSYxPUl2o=
diff --git a/pkg/api/handlers/libpod/containers.go b/pkg/api/handlers/libpod/containers.go
index 854740b17..9d18c9420 100644
--- a/pkg/api/handlers/libpod/containers.go
+++ b/pkg/api/handlers/libpod/containers.go
@@ -305,6 +305,7 @@ func Restore(w http.ResponseWriter, r *http.Request) {
PrintStats bool `schema:"printStats"`
FileLocks bool `schema:"fileLocks"`
PublishPorts string `schema:"publishPorts"`
+ Pod string `schema:"pod"`
}{
// override any golang type defaults
}
@@ -324,6 +325,7 @@ func Restore(w http.ResponseWriter, r *http.Request) {
PrintStats: query.PrintStats,
FileLocks: query.FileLocks,
PublishPorts: strings.Fields(query.PublishPorts),
+ Pod: query.Pod,
}
var names []string
diff --git a/pkg/api/server/register_containers.go b/pkg/api/server/register_containers.go
index 311eecd17..2cf5169ba 100644
--- a/pkg/api/server/register_containers.go
+++ b/pkg/api/server/register_containers.go
@@ -1516,6 +1516,10 @@ func (s *APIServer) registerContainersHandlers(r *mux.Router) error {
// name: printStats
// type: boolean
// description: add restore statistics to the returned RestoreReport
+ // - in: query
+ // name: pod
+ // type: string
+ // description: pod to restore into
// produces:
// - application/json
// responses:
diff --git a/pkg/domain/infra/abi/play.go b/pkg/domain/infra/abi/play.go
index 4a83cb464..8779acfda 100644
--- a/pkg/domain/infra/abi/play.go
+++ b/pkg/domain/infra/abi/play.go
@@ -344,10 +344,6 @@ func (ic *ContainerEngine) playKubePod(ctx context.Context, podName string, podY
return nil, err
}
- if (ns.IsBridge() && len(networks) == 0) || ns.IsHost() {
- return nil, fmt.Errorf("invalid value passed to --network: bridge or host networking must be configured in YAML")
- }
-
podOpt.Net.Network = ns
podOpt.Net.Networks = networks
podOpt.Net.NetworkOptions = netOpts
diff --git a/test/e2e/checkpoint_image_test.go b/test/e2e/checkpoint_image_test.go
index 5700802e8..7ab0b5ca5 100644
--- a/test/e2e/checkpoint_image_test.go
+++ b/test/e2e/checkpoint_image_test.go
@@ -295,4 +295,52 @@ var _ = Describe("Podman checkpoint", func() {
Expect(result).Should(Exit(0))
Expect(podmanTest.NumberOfContainersRunning()).To(Equal(0))
})
+
+ It("podman run checkpoint image to restore container", func() {
+ SkipIfContainerized("FIXME: #15015. All checkpoint tests hang when containerized.")
+ // Container image must be lowercase
+ checkpointImage := "alpine-checkpoint-" + strings.ToLower(RandomString(6))
+ containerName := "alpine-container-" + RandomString(6)
+
+ // Create container
+ localRunString := []string{"run", "-d", "--name", containerName, ALPINE, "top"}
+ session := podmanTest.Podman(localRunString)
+ session.WaitWithDefaultTimeout()
+ Expect(session).Should(Exit(0))
+ containerID1 := session.OutputToString()
+
+ // Checkpoint container, create checkpoint image
+ result := podmanTest.Podman([]string{"container", "checkpoint", "--create-image", checkpointImage, "--keep", containerID1})
+ result.WaitWithDefaultTimeout()
+ Expect(result).Should(Exit(0))
+ Expect(podmanTest.NumberOfContainersRunning()).To(Equal(0))
+
+ // Remove existing container
+ result = podmanTest.Podman([]string{"rm", "-t", "1", "-f", containerName})
+ result.WaitWithDefaultTimeout()
+ Expect(result).Should(Exit(0))
+
+ // Restore containers from image using `podman run`
+ result = podmanTest.Podman([]string{"run", checkpointImage})
+ result.WaitWithDefaultTimeout()
+ Expect(result).Should(Exit(0))
+ Expect(podmanTest.NumberOfContainersRunning()).To(Equal(1))
+
+ // Check if the container is running
+ status := podmanTest.Podman([]string{"inspect", containerName, "--format={{.State.Status}}"})
+ status.WaitWithDefaultTimeout()
+ Expect(status).Should(Exit(0))
+ Expect(status.OutputToString()).To(Equal("running"))
+
+ // Clean-up
+ result = podmanTest.Podman([]string{"rm", "-t", "0", "-fa"})
+ result.WaitWithDefaultTimeout()
+ Expect(result).Should(Exit(0))
+ Expect(podmanTest.NumberOfContainersRunning()).To(Equal(0))
+
+ result = podmanTest.Podman([]string{"rmi", checkpointImage})
+ result.WaitWithDefaultTimeout()
+ Expect(result).Should(Exit(0))
+ Expect(podmanTest.NumberOfContainersRunning()).To(Equal(0))
+ })
})
diff --git a/test/e2e/checkpoint_test.go b/test/e2e/checkpoint_test.go
index a33936549..b0c1d36d3 100644
--- a/test/e2e/checkpoint_test.go
+++ b/test/e2e/checkpoint_test.go
@@ -1170,10 +1170,6 @@ var _ = Describe("Podman checkpoint", func() {
share := share // copy into local scope, for use inside function
It(testName, func() {
- if podmanTest.Host.Distribution == "ubuntu" && IsRemote() {
- Skip("FIXME: #15018. Cannot restore --pod under cgroupsV1 and remote")
- }
-
if !criu.CheckForCriu(criu.PodCriuVersion) {
Skip("CRIU is missing or too old.")
}
diff --git a/test/e2e/kill_test.go b/test/e2e/kill_test.go
index 30c82c45d..d789a6595 100644
--- a/test/e2e/kill_test.go
+++ b/test/e2e/kill_test.go
@@ -201,7 +201,7 @@ var _ = Describe("Podman kill", func() {
Expect(wait).Should(Exit(0))
})
- It("podman stop --all", func() {
+ It("podman kill --all", func() {
session := podmanTest.RunTopContainer("")
session.WaitWithDefaultTimeout()
Expect(session).Should(Exit(0))
diff --git a/test/e2e/network_test.go b/test/e2e/network_test.go
index b2f50ca55..4366d84aa 100644
--- a/test/e2e/network_test.go
+++ b/test/e2e/network_test.go
@@ -706,7 +706,7 @@ var _ = Describe("Podman network", func() {
})
It("podman network prune --filter", func() {
- // set custom cni directory to prevent flakes
+ // set custom network directory to prevent flakes since the dir is shared with all tests by default
podmanTest.NetworkConfigDir = tempdir
if IsRemote() {
podmanTest.RestartRemoteService()
@@ -754,7 +754,7 @@ var _ = Describe("Podman network", func() {
})
It("podman network prune", func() {
- // set custom cni directory to prevent flakes
+ // set custom network directory to prevent flakes since the dir is shared with all tests by default
podmanTest.NetworkConfigDir = tempdir
if IsRemote() {
podmanTest.RestartRemoteService()
diff --git a/test/e2e/prune_test.go b/test/e2e/prune_test.go
index 0b1d68aea..e91569231 100644
--- a/test/e2e/prune_test.go
+++ b/test/e2e/prune_test.go
@@ -259,6 +259,12 @@ var _ = Describe("Podman prune", func() {
})
It("podman system prune networks", func() {
+ // set custom network directory to prevent flakes since the dir is shared with all tests by default
+ podmanTest.NetworkConfigDir = tempdir
+ if IsRemote() {
+ podmanTest.RestartRemoteService()
+ }
+
// Create new network.
session := podmanTest.Podman([]string{"network", "create", "test"})
session.WaitWithDefaultTimeout()
diff --git a/test/e2e/restart_test.go b/test/e2e/restart_test.go
index 87d20a2e6..effb716a8 100644
--- a/test/e2e/restart_test.go
+++ b/test/e2e/restart_test.go
@@ -321,7 +321,7 @@ var _ = Describe("Podman restart", func() {
Expect(result.ErrorToString()).To(ContainSubstring("cannot be used together"))
})
- It("podman pause --filter", func() {
+ It("podman restart --filter", func() {
session1 := podmanTest.RunTopContainer("")
session1.WaitWithDefaultTimeout()
Expect(session1).Should(Exit(0))
diff --git a/test/system/700-play.bats b/test/system/700-play.bats
index 578d28394..5f3eb1ef2 100644
--- a/test/system/700-play.bats
+++ b/test/system/700-play.bats
@@ -165,8 +165,14 @@ EOF
TESTDIR=$PODMAN_TMPDIR/testdir
mkdir -p $TESTDIR
echo "$testYaml" | sed "s|TESTDIR|${TESTDIR}|g" > $PODMAN_TMPDIR/test.yaml
- run_podman 125 kube play --network host $PODMAN_TMPDIR/test.yaml
- is "$output" ".*invalid value passed to --network: bridge or host networking must be configured in YAML" "podman plan-network should fail with --network host"
+ run_podman kube play --network host $PODMAN_TMPDIR/test.yaml
+ is "$output" "Pod:.*" "podman kube play should work with --network host"
+
+ run_podman pod inspect --format "{{.InfraConfig.HostNetwork}}" test_pod
+ is "$output" "true" ".InfraConfig.HostNetwork"
+ run_podman stop -a -t 0
+ run_podman pod rm -t 0 -f test_pod
+
run_podman kube play --network slirp4netns:port_handler=slirp4netns $PODMAN_TMPDIR/test.yaml
run_podman pod inspect --format {{.InfraContainerID}} "${lines[1]}"
infraID="$output"
diff --git a/vendor/github.com/containers/common/libimage/platform.go b/vendor/github.com/containers/common/libimage/platform.go
index 274b2aa06..4d5dde310 100644
--- a/vendor/github.com/containers/common/libimage/platform.go
+++ b/vendor/github.com/containers/common/libimage/platform.go
@@ -6,6 +6,7 @@ import (
"runtime"
"github.com/containerd/containerd/platforms"
+ v1 "github.com/opencontainers/image-spec/specs-go/v1"
"github.com/sirupsen/logrus"
)
@@ -20,9 +21,18 @@ const (
)
// NormalizePlatform normalizes (according to the OCI spec) the specified os,
-// arch and variant. If left empty, the individual item will not be normalized.
+// arch and variant. If left empty, the individual item will be normalized.
func NormalizePlatform(rawOS, rawArch, rawVariant string) (os, arch, variant string) {
- rawPlatform := toPlatformString(rawOS, rawArch, rawVariant)
+ platformSpec := v1.Platform{
+ OS: rawOS,
+ Architecture: rawArch,
+ Variant: rawVariant,
+ }
+ normalizedSpec := platforms.Normalize(platformSpec)
+ if normalizedSpec.Variant == "" && rawVariant != "" {
+ normalizedSpec.Variant = rawVariant
+ }
+ rawPlatform := toPlatformString(normalizedSpec.OS, normalizedSpec.Architecture, normalizedSpec.Variant)
normalizedPlatform, err := platforms.Parse(rawPlatform)
if err != nil {
logrus.Debugf("Error normalizing platform: %v", err)
@@ -38,7 +48,7 @@ func NormalizePlatform(rawOS, rawArch, rawVariant string) (os, arch, variant str
arch = normalizedPlatform.Architecture
}
variant = rawVariant
- if rawVariant != "" {
+ if rawVariant != "" || (rawVariant == "" && normalizedPlatform.Variant != "") {
variant = normalizedPlatform.Variant
}
return os, arch, variant
diff --git a/vendor/github.com/containers/common/pkg/util/util_supported.go b/vendor/github.com/containers/common/pkg/util/util_supported.go
index 6d7060af4..0cd53af53 100644
--- a/vendor/github.com/containers/common/pkg/util/util_supported.go
+++ b/vendor/github.com/containers/common/pkg/util/util_supported.go
@@ -11,6 +11,7 @@ import (
"sync"
"syscall"
+ "github.com/containers/storage/pkg/homedir"
"github.com/containers/storage/pkg/unshare"
"github.com/sirupsen/logrus"
)
@@ -31,7 +32,10 @@ func GetRuntimeDir() (string, error) {
var rootlessRuntimeDirError error
rootlessRuntimeDirOnce.Do(func() {
- runtimeDir := os.Getenv("XDG_RUNTIME_DIR")
+ runtimeDir, err := homedir.GetRuntimeDir()
+ if err != nil {
+ logrus.Debug(err)
+ }
if runtimeDir != "" {
st, err := os.Stat(runtimeDir)
if err != nil {
diff --git a/vendor/github.com/containers/storage/VERSION b/vendor/github.com/containers/storage/VERSION
index 6d41d503d..b978278f0 100644
--- a/vendor/github.com/containers/storage/VERSION
+++ b/vendor/github.com/containers/storage/VERSION
@@ -1 +1 @@
-1.42.1-dev
+1.43.0
diff --git a/vendor/github.com/containers/storage/drivers/driver_linux.go b/vendor/github.com/containers/storage/drivers/driver_linux.go
index 7c527d279..b9e57a60d 100644
--- a/vendor/github.com/containers/storage/drivers/driver_linux.go
+++ b/vendor/github.com/containers/storage/drivers/driver_linux.go
@@ -7,6 +7,7 @@ import (
"path/filepath"
"github.com/containers/storage/pkg/mount"
+ "github.com/sirupsen/logrus"
"golang.org/x/sys/unix"
)
@@ -127,9 +128,14 @@ var (
// GetFSMagic returns the filesystem id given the path.
func GetFSMagic(rootpath string) (FsMagic, error) {
var buf unix.Statfs_t
- if err := unix.Statfs(filepath.Dir(rootpath), &buf); err != nil {
+ path := filepath.Dir(rootpath)
+ if err := unix.Statfs(path, &buf); err != nil {
return 0, err
}
+
+ if _, ok := FsNames[FsMagic(buf.Type)]; !ok {
+ logrus.Debugf("Unknown filesystem type %#x reported for %s", buf.Type, path)
+ }
return FsMagic(buf.Type), nil
}
diff --git a/vendor/github.com/containers/storage/layers.go b/vendor/github.com/containers/storage/layers.go
index 18f3630e9..c23f0b26b 100644
--- a/vendor/github.com/containers/storage/layers.go
+++ b/vendor/github.com/containers/storage/layers.go
@@ -563,6 +563,8 @@ func (s *store) newLayerStore(rundir string, layerdir string, driver drivers.Dri
uidMap: copyIDMap(s.uidMap),
gidMap: copyIDMap(s.gidMap),
}
+ rlstore.Lock()
+ defer rlstore.Unlock()
if err := rlstore.Load(); err != nil {
return nil, err
}
@@ -584,6 +586,8 @@ func newROLayerStore(rundir string, layerdir string, driver drivers.Driver) (ROL
bymount: make(map[string]*Layer),
byname: make(map[string]*Layer),
}
+ rlstore.RLock()
+ defer rlstore.Unlock()
if err := rlstore.Load(); err != nil {
return nil, err
}
diff --git a/vendor/github.com/containers/storage/pkg/archive/archive.go b/vendor/github.com/containers/storage/pkg/archive/archive.go
index 1d7bbfa98..82c0adeb7 100644
--- a/vendor/github.com/containers/storage/pkg/archive/archive.go
+++ b/vendor/github.com/containers/storage/pkg/archive/archive.go
@@ -75,6 +75,7 @@ const (
solaris = "solaris"
windows = "windows"
darwin = "darwin"
+ freebsd = "freebsd"
)
var xattrsToIgnore = map[string]interface{}{
@@ -671,7 +672,7 @@ func createTarFile(path, extractDir string, hdr *tar.Header, reader io.Reader, L
if !strings.HasPrefix(targetPath, extractDir) {
return breakoutError(fmt.Errorf("invalid hardlink %q -> %q", targetPath, hdr.Linkname))
}
- if err := os.Link(targetPath, path); err != nil {
+ if err := handleLLink(targetPath, path); err != nil {
return err
}
diff --git a/vendor/github.com/containers/storage/pkg/archive/archive_freebsd.go b/vendor/github.com/containers/storage/pkg/archive/archive_freebsd.go
index fe22eb433..36017c3bf 100644
--- a/vendor/github.com/containers/storage/pkg/archive/archive_freebsd.go
+++ b/vendor/github.com/containers/storage/pkg/archive/archive_freebsd.go
@@ -9,6 +9,7 @@ import (
"os"
"path/filepath"
"syscall"
+ "unsafe"
"github.com/containers/storage/pkg/idtools"
"github.com/containers/storage/pkg/system"
@@ -111,16 +112,18 @@ func handleLChmod(hdr *tar.Header, path string, hdrInfo os.FileInfo, forceMask *
if forceMask != nil {
permissionsMask = *forceMask
}
- if hdr.Typeflag == tar.TypeLink {
- if fi, err := os.Lstat(hdr.Linkname); err == nil && (fi.Mode()&os.ModeSymlink == 0) {
- if err := os.Chmod(path, permissionsMask); err != nil {
- return err
- }
- }
- } else if hdr.Typeflag != tar.TypeSymlink {
- if err := os.Chmod(path, permissionsMask); err != nil {
- return err
- }
+ p, err := unix.BytePtrFromString(path)
+ if err != nil {
+ return err
+ }
+ _, _, e1 := unix.Syscall(unix.SYS_LCHMOD, uintptr(unsafe.Pointer(p)), uintptr(permissionsMask), 0)
+ if e1 != 0 {
+ return e1
}
return nil
}
+
+// Hardlink without following symlinks
+func handleLLink(targetPath string, path string) error {
+ return unix.Linkat(unix.AT_FDCWD, targetPath, unix.AT_FDCWD, path, 0)
+}
diff --git a/vendor/github.com/containers/storage/pkg/archive/archive_unix.go b/vendor/github.com/containers/storage/pkg/archive/archive_unix.go
index 7c3e442da..d0fb33066 100644
--- a/vendor/github.com/containers/storage/pkg/archive/archive_unix.go
+++ b/vendor/github.com/containers/storage/pkg/archive/archive_unix.go
@@ -1,3 +1,4 @@
+//go:build !windows && !freebsd
// +build !windows,!freebsd
package archive
@@ -97,7 +98,7 @@ func handleTarTypeBlockCharFifo(hdr *tar.Header, path string) error {
mode |= unix.S_IFIFO
}
- return system.Mknod(path, mode, int(system.Mkdev(hdr.Devmajor, hdr.Devminor)))
+ return system.Mknod(path, mode, system.Mkdev(hdr.Devmajor, hdr.Devminor))
}
func handleLChmod(hdr *tar.Header, path string, hdrInfo os.FileInfo, forceMask *os.FileMode) error {
@@ -118,3 +119,13 @@ func handleLChmod(hdr *tar.Header, path string, hdrInfo os.FileInfo, forceMask *
}
return nil
}
+
+// Hardlink without symlinks
+func handleLLink(targetPath, path string) error {
+ // Note: on Linux, the link syscall will not follow symlinks.
+ // This behavior is implementation-dependent since
+ // POSIX.1-2008 so to make it clear that we need non-symlink
+ // following here we use the linkat syscall which has a flags
+ // field to select symlink following or not.
+ return unix.Linkat(unix.AT_FDCWD, targetPath, unix.AT_FDCWD, path, 0)
+}
diff --git a/vendor/github.com/containers/storage/pkg/archive/archive_windows.go b/vendor/github.com/containers/storage/pkg/archive/archive_windows.go
index 8e7a2fd02..e44011775 100644
--- a/vendor/github.com/containers/storage/pkg/archive/archive_windows.go
+++ b/vendor/github.com/containers/storage/pkg/archive/archive_windows.go
@@ -78,3 +78,8 @@ func getFileUIDGID(stat interface{}) (idtools.IDPair, error) {
// no notion of file ownership mapping yet on Windows
return idtools.IDPair{0, 0}, nil
}
+
+// Hardlink without following symlinks
+func handleLLink(targetPath string, path string) error {
+ return os.Link(targetPath, path)
+}
diff --git a/vendor/github.com/containers/storage/pkg/homedir/homedir_unix.go b/vendor/github.com/containers/storage/pkg/homedir/homedir_unix.go
index 33177bdf3..37dc9159f 100644
--- a/vendor/github.com/containers/storage/pkg/homedir/homedir_unix.go
+++ b/vendor/github.com/containers/storage/pkg/homedir/homedir_unix.go
@@ -1,3 +1,4 @@
+//go:build !windows
// +build !windows
package homedir
@@ -46,7 +47,7 @@ func GetShortcutString() string {
// See also https://standards.freedesktop.org/basedir-spec/latest/ar01s03.html
func GetRuntimeDir() (string, error) {
if xdgRuntimeDir := os.Getenv("XDG_RUNTIME_DIR"); xdgRuntimeDir != "" {
- return xdgRuntimeDir, nil
+ return filepath.EvalSymlinks(xdgRuntimeDir)
}
return "", errors.New("could not get XDG_RUNTIME_DIR")
}
diff --git a/vendor/github.com/containers/storage/pkg/system/mknod.go b/vendor/github.com/containers/storage/pkg/system/mknod.go
index c276ce8e8..d3d0ed8a1 100644
--- a/vendor/github.com/containers/storage/pkg/system/mknod.go
+++ b/vendor/github.com/containers/storage/pkg/system/mknod.go
@@ -1,3 +1,4 @@
+//go:build !windows && !freebsd
// +build !windows,!freebsd
package system
@@ -8,8 +9,8 @@ import (
// Mknod creates a filesystem node (file, device special file or named pipe) named path
// with attributes specified by mode and dev.
-func Mknod(path string, mode uint32, dev int) error {
- return unix.Mknod(path, mode, dev)
+func Mknod(path string, mode uint32, dev uint32) error {
+ return unix.Mknod(path, mode, int(dev))
}
// Mkdev is used to build the value of linux devices (in /dev/) which specifies major
diff --git a/vendor/github.com/containers/storage/pkg/system/mknod_freebsd.go b/vendor/github.com/containers/storage/pkg/system/mknod_freebsd.go
index d09005589..53c3f2837 100644
--- a/vendor/github.com/containers/storage/pkg/system/mknod_freebsd.go
+++ b/vendor/github.com/containers/storage/pkg/system/mknod_freebsd.go
@@ -1,3 +1,4 @@
+//go:build freebsd
// +build freebsd
package system
@@ -17,6 +18,6 @@ func Mknod(path string, mode uint32, dev uint64) error {
// Linux device nodes are a bit weird due to backwards compat with 16 bit device nodes.
// They are, from low to high: the lower 8 bits of the minor, then 12 bits of the major,
// then the top 12 bits of the minor.
-func Mkdev(major int64, minor int64) uint32 {
- return uint32(((minor & 0xfff00) << 12) | ((major & 0xfff) << 8) | (minor & 0xff))
+func Mkdev(major int64, minor int64) uint64 {
+ return uint64(((minor & 0xfff00) << 12) | ((major & 0xfff) << 8) | (minor & 0xff))
}
diff --git a/vendor/github.com/containers/storage/pkg/system/rm.go b/vendor/github.com/containers/storage/pkg/system/rm.go
index b65121f1d..5d63dc741 100644
--- a/vendor/github.com/containers/storage/pkg/system/rm.go
+++ b/vendor/github.com/containers/storage/pkg/system/rm.go
@@ -35,6 +35,9 @@ func EnsureRemoveAll(dir string) error {
}
for {
+ if err := resetFileFlags(dir); err != nil {
+ return fmt.Errorf("resetting file flags: %w", err)
+ }
err := os.RemoveAll(dir)
if err == nil {
return nil
diff --git a/vendor/github.com/containers/storage/pkg/system/rm_common.go b/vendor/github.com/containers/storage/pkg/system/rm_common.go
new file mode 100644
index 000000000..117eb1d6d
--- /dev/null
+++ b/vendor/github.com/containers/storage/pkg/system/rm_common.go
@@ -0,0 +1,10 @@
+//go:build !freebsd
+// +build !freebsd
+
+package system
+
+// Reset file flags in a directory tree. This allows EnsureRemoveAll
+// to delete trees which have the immutable flag set.
+func resetFileFlags(dir string) error {
+ return nil
+}
diff --git a/vendor/github.com/containers/storage/pkg/system/rm_freebsd.go b/vendor/github.com/containers/storage/pkg/system/rm_freebsd.go
new file mode 100644
index 000000000..35896c11d
--- /dev/null
+++ b/vendor/github.com/containers/storage/pkg/system/rm_freebsd.go
@@ -0,0 +1,32 @@
+package system
+
+import (
+ "io/fs"
+ "path/filepath"
+ "unsafe"
+
+ "golang.org/x/sys/unix"
+)
+
+func lchflags(path string, flags int) (err error) {
+ p, err := unix.BytePtrFromString(path)
+ if err != nil {
+ return err
+ }
+ _, _, e1 := unix.Syscall(unix.SYS_LCHFLAGS, uintptr(unsafe.Pointer(p)), uintptr(flags), 0)
+ if e1 != 0 {
+ return e1
+ }
+ return nil
+}
+
+// Reset file flags in a directory tree. This allows EnsureRemoveAll
+// to delete trees which have the immutable flag set.
+func resetFileFlags(dir string) error {
+ return filepath.WalkDir(dir, func(path string, d fs.DirEntry, err error) error {
+ if err := lchflags(path, 0); err != nil {
+ return err
+ }
+ return nil
+ })
+}
diff --git a/vendor/github.com/containers/storage/types/options.go b/vendor/github.com/containers/storage/types/options.go
index 5421c02da..4c873b45f 100644
--- a/vendor/github.com/containers/storage/types/options.go
+++ b/vendor/github.com/containers/storage/types/options.go
@@ -38,17 +38,44 @@ var (
)
func loadDefaultStoreOptions() {
- defaultStoreOptions.RunRoot = defaultRunRoot
- defaultStoreOptions.GraphRoot = defaultGraphRoot
defaultStoreOptions.GraphDriverName = ""
+ setDefaults := func() {
+ // reload could set values to empty for run and graph root if config does not contains anything
+ if defaultStoreOptions.RunRoot == "" {
+ defaultStoreOptions.RunRoot = defaultRunRoot
+ }
+ if defaultStoreOptions.GraphRoot == "" {
+ defaultStoreOptions.GraphRoot = defaultGraphRoot
+ }
+ }
+ setDefaults()
+
if path, ok := os.LookupEnv(storageConfEnv); ok {
defaultOverrideConfigFile = path
if err := ReloadConfigurationFileIfNeeded(path, &defaultStoreOptions); err != nil {
loadDefaultStoreOptionsErr = err
return
}
- } else if _, err := os.Stat(defaultOverrideConfigFile); err == nil {
+ setDefaults()
+ return
+ }
+
+ if path, ok := os.LookupEnv("XDG_CONFIG_HOME"); ok {
+ homeConfigFile := filepath.Join(path, "containers", "storage.conf")
+ if _, err := os.Stat(homeConfigFile); err == nil {
+ // user storage.conf in XDG_CONFIG_HOME if it exists
+ defaultOverrideConfigFile = homeConfigFile
+ } else {
+ if !os.IsNotExist(err) {
+ loadDefaultStoreOptionsErr = err
+ return
+ }
+ }
+ }
+
+ _, err := os.Stat(defaultOverrideConfigFile)
+ if err == nil {
// The DefaultConfigFile(rootless) function returns the path
// of the used storage.conf file, by returning defaultConfigFile
// If override exists containers/storage uses it by default.
@@ -57,22 +84,18 @@ func loadDefaultStoreOptions() {
loadDefaultStoreOptionsErr = err
return
}
- } else {
- if !os.IsNotExist(err) {
- logrus.Warningf("Attempting to use %s, %v", defaultConfigFile, err)
- }
- if err := ReloadConfigurationFileIfNeeded(defaultConfigFile, &defaultStoreOptions); err != nil && !errors.Is(err, os.ErrNotExist) {
- loadDefaultStoreOptionsErr = err
- return
- }
+ setDefaults()
+ return
}
- // reload could set values to empty for run and graph root if config does not contains anything
- if defaultStoreOptions.RunRoot == "" {
- defaultStoreOptions.RunRoot = defaultRunRoot
+
+ if !os.IsNotExist(err) {
+ logrus.Warningf("Attempting to use %s, %v", defaultConfigFile, err)
}
- if defaultStoreOptions.GraphRoot == "" {
- defaultStoreOptions.GraphRoot = defaultGraphRoot
+ if err := ReloadConfigurationFileIfNeeded(defaultConfigFile, &defaultStoreOptions); err != nil && !errors.Is(err, os.ErrNotExist) {
+ loadDefaultStoreOptionsErr = err
+ return
}
+ setDefaults()
}
// defaultStoreOptionsIsolated is an internal implementation detail of DefaultStoreOptions to allow testing.
diff --git a/vendor/github.com/opencontainers/selinux/go-selinux/doc.go b/vendor/github.com/opencontainers/selinux/go-selinux/doc.go
index 0ac7d819e..57a15c9a1 100644
--- a/vendor/github.com/opencontainers/selinux/go-selinux/doc.go
+++ b/vendor/github.com/opencontainers/selinux/go-selinux/doc.go
@@ -9,6 +9,5 @@ Usage:
if selinux.EnforceMode() != selinux.Enforcing {
selinux.SetEnforceMode(selinux.Enforcing)
}
-
*/
package selinux
diff --git a/vendor/github.com/opencontainers/selinux/go-selinux/label/label_linux.go b/vendor/github.com/opencontainers/selinux/go-selinux/label/label_linux.go
index 12de0ae5d..f61a56015 100644
--- a/vendor/github.com/opencontainers/selinux/go-selinux/label/label_linux.go
+++ b/vendor/github.com/opencontainers/selinux/go-selinux/label/label_linux.go
@@ -3,8 +3,6 @@ package label
import (
"errors"
"fmt"
- "os"
- "os/user"
"strings"
"github.com/opencontainers/selinux/go-selinux"
@@ -113,50 +111,6 @@ func Relabel(path string, fileLabel string, shared bool) error {
return nil
}
- exclude_paths := map[string]bool{
- "/": true,
- "/bin": true,
- "/boot": true,
- "/dev": true,
- "/etc": true,
- "/etc/passwd": true,
- "/etc/pki": true,
- "/etc/shadow": true,
- "/home": true,
- "/lib": true,
- "/lib64": true,
- "/media": true,
- "/opt": true,
- "/proc": true,
- "/root": true,
- "/run": true,
- "/sbin": true,
- "/srv": true,
- "/sys": true,
- "/tmp": true,
- "/usr": true,
- "/var": true,
- "/var/lib": true,
- "/var/log": true,
- }
-
- if home := os.Getenv("HOME"); home != "" {
- exclude_paths[home] = true
- }
-
- if sudoUser := os.Getenv("SUDO_USER"); sudoUser != "" {
- if usr, err := user.Lookup(sudoUser); err == nil {
- exclude_paths[usr.HomeDir] = true
- }
- }
-
- if path != "/" {
- path = strings.TrimSuffix(path, "/")
- }
- if exclude_paths[path] {
- return fmt.Errorf("SELinux relabeling of %s is not allowed", path)
- }
-
if shared {
c, err := selinux.NewContext(fileLabel)
if err != nil {
diff --git a/vendor/github.com/opencontainers/selinux/go-selinux/label/label_stub.go b/vendor/github.com/opencontainers/selinux/go-selinux/label/label_stub.go
index 02d206239..f21c80c5a 100644
--- a/vendor/github.com/opencontainers/selinux/go-selinux/label/label_stub.go
+++ b/vendor/github.com/opencontainers/selinux/go-selinux/label/label_stub.go
@@ -1,3 +1,4 @@
+//go:build !linux
// +build !linux
package label
diff --git a/vendor/github.com/opencontainers/selinux/go-selinux/rchcon.go b/vendor/github.com/opencontainers/selinux/go-selinux/rchcon.go
index feb739d32..8bff29355 100644
--- a/vendor/github.com/opencontainers/selinux/go-selinux/rchcon.go
+++ b/vendor/github.com/opencontainers/selinux/go-selinux/rchcon.go
@@ -1,3 +1,4 @@
+//go:build linux && go1.16
// +build linux,go1.16
package selinux
@@ -11,7 +12,18 @@ import (
)
func rchcon(fpath, label string) error {
+ fastMode := false
+ // If the current label matches the new label, assume
+ // other labels are correct.
+ if cLabel, err := lFileLabel(fpath); err == nil && cLabel == label {
+ fastMode = true
+ }
return pwalkdir.Walk(fpath, func(p string, _ fs.DirEntry, _ error) error {
+ if fastMode {
+ if cLabel, err := lFileLabel(fpath); err == nil && cLabel == label {
+ return nil
+ }
+ }
e := lSetFileLabel(p, label)
// Walk a file tree can race with removal, so ignore ENOENT.
if errors.Is(e, os.ErrNotExist) {
diff --git a/vendor/github.com/opencontainers/selinux/go-selinux/rchcon_go115.go b/vendor/github.com/opencontainers/selinux/go-selinux/rchcon_go115.go
index ecc7abfac..303cb1890 100644
--- a/vendor/github.com/opencontainers/selinux/go-selinux/rchcon_go115.go
+++ b/vendor/github.com/opencontainers/selinux/go-selinux/rchcon_go115.go
@@ -1,3 +1,4 @@
+//go:build linux && !go1.16
// +build linux,!go1.16
package selinux
diff --git a/vendor/github.com/opencontainers/selinux/go-selinux/selinux_linux.go b/vendor/github.com/opencontainers/selinux/go-selinux/selinux_linux.go
index ee602ab96..4582cc9e0 100644
--- a/vendor/github.com/opencontainers/selinux/go-selinux/selinux_linux.go
+++ b/vendor/github.com/opencontainers/selinux/go-selinux/selinux_linux.go
@@ -11,6 +11,7 @@ import (
"io/ioutil"
"math/big"
"os"
+ "os/user"
"path"
"path/filepath"
"strconv"
@@ -1072,21 +1073,6 @@ func copyLevel(src, dest string) (string, error) {
return tcon.Get(), nil
}
-// Prevent users from relabeling system files
-func badPrefix(fpath string) error {
- if fpath == "" {
- return ErrEmptyPath
- }
-
- badPrefixes := []string{"/usr"}
- for _, prefix := range badPrefixes {
- if strings.HasPrefix(fpath, prefix) {
- return fmt.Errorf("relabeling content in %s is not allowed", prefix)
- }
- }
- return nil
-}
-
// chcon changes the fpath file object to the SELinux label label.
// If fpath is a directory and recurse is true, then chcon walks the
// directory tree setting the label.
@@ -1097,12 +1083,70 @@ func chcon(fpath string, label string, recurse bool) error {
if label == "" {
return nil
}
- if err := badPrefix(fpath); err != nil {
- return err
+
+ exclude_paths := map[string]bool{
+ "/": true,
+ "/bin": true,
+ "/boot": true,
+ "/dev": true,
+ "/etc": true,
+ "/etc/passwd": true,
+ "/etc/pki": true,
+ "/etc/shadow": true,
+ "/home": true,
+ "/lib": true,
+ "/lib64": true,
+ "/media": true,
+ "/opt": true,
+ "/proc": true,
+ "/root": true,
+ "/run": true,
+ "/sbin": true,
+ "/srv": true,
+ "/sys": true,
+ "/tmp": true,
+ "/usr": true,
+ "/var": true,
+ "/var/lib": true,
+ "/var/log": true,
+ }
+
+ if home := os.Getenv("HOME"); home != "" {
+ exclude_paths[home] = true
+ }
+
+ if sudoUser := os.Getenv("SUDO_USER"); sudoUser != "" {
+ if usr, err := user.Lookup(sudoUser); err == nil {
+ exclude_paths[usr.HomeDir] = true
+ }
+ }
+
+ if fpath != "/" {
+ fpath = strings.TrimSuffix(fpath, "/")
+ }
+ if exclude_paths[fpath] {
+ return fmt.Errorf("SELinux relabeling of %s is not allowed", fpath)
}
if !recurse {
- return setFileLabel(fpath, label)
+ err := lSetFileLabel(fpath, label)
+ if err != nil {
+ // Check if file doesn't exist, must have been removed
+ if errors.Is(err, os.ErrNotExist) {
+ return nil
+ }
+ // Check if current label is correct on disk
+ flabel, nerr := lFileLabel(fpath)
+ if nerr == nil && flabel == label {
+ return nil
+ }
+ // Check if file doesn't exist, must have been removed
+ if errors.Is(nerr, os.ErrNotExist) {
+ return nil
+ }
+ return err
+ }
+ return nil
}
return rchcon(fpath, label)
diff --git a/vendor/github.com/opencontainers/selinux/go-selinux/selinux_stub.go b/vendor/github.com/opencontainers/selinux/go-selinux/selinux_stub.go
index 78743b020..20d888031 100644
--- a/vendor/github.com/opencontainers/selinux/go-selinux/selinux_stub.go
+++ b/vendor/github.com/opencontainers/selinux/go-selinux/selinux_stub.go
@@ -1,3 +1,4 @@
+//go:build !linux
// +build !linux
package selinux
diff --git a/vendor/modules.txt b/vendor/modules.txt
index 04c22c1c9..c95f09d75 100644
--- a/vendor/modules.txt
+++ b/vendor/modules.txt
@@ -120,7 +120,7 @@ github.com/containers/buildah/pkg/rusage
github.com/containers/buildah/pkg/sshagent
github.com/containers/buildah/pkg/util
github.com/containers/buildah/util
-# github.com/containers/common v0.49.2-0.20220926195839-590004b80685
+# github.com/containers/common v0.49.2-0.20220929111928-2d1b45ae2423
## explicit; go 1.17
github.com/containers/common/libimage
github.com/containers/common/libimage/define
@@ -266,7 +266,7 @@ github.com/containers/psgo/internal/dev
github.com/containers/psgo/internal/host
github.com/containers/psgo/internal/proc
github.com/containers/psgo/internal/process
-# github.com/containers/storage v1.42.1-0.20220919112236-8a581aac3bdf
+# github.com/containers/storage v1.43.0
## explicit; go 1.16
github.com/containers/storage
github.com/containers/storage/drivers
@@ -638,7 +638,7 @@ github.com/opencontainers/runtime-tools/generate
github.com/opencontainers/runtime-tools/generate/seccomp
github.com/opencontainers/runtime-tools/specerror
github.com/opencontainers/runtime-tools/validate
-# github.com/opencontainers/selinux v1.10.1
+# github.com/opencontainers/selinux v1.10.2
## explicit; go 1.13
github.com/opencontainers/selinux/go-selinux
github.com/opencontainers/selinux/go-selinux/label