summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.cirrus.yml75
-rw-r--r--.github/PULL_REQUEST_TEMPLATE.md16
-rw-r--r--.golangci.yml4
-rw-r--r--cmd/podman/auto-update.go2
-rw-r--r--cmd/podman/common/completion.go55
-rw-r--r--cmd/podman/common/completion_test.go14
-rw-r--r--cmd/podman/common/create.go2
-rw-r--r--cmd/podman/completion/completion.go2
-rw-r--r--cmd/podman/containers/inspect.go7
-rw-r--r--cmd/podman/containers/ps.go2
-rw-r--r--cmd/podman/containers/stats.go2
-rw-r--r--cmd/podman/images/history.go10
-rw-r--r--cmd/podman/images/inspect.go2
-rw-r--r--cmd/podman/images/list.go2
-rw-r--r--cmd/podman/images/scp.go9
-rw-r--r--cmd/podman/images/search.go9
-rw-r--r--cmd/podman/machine/inspect.go10
-rw-r--r--cmd/podman/machine/list.go2
-rw-r--r--cmd/podman/machine/set.go60
-rw-r--r--cmd/podman/networks/inspect.go3
-rw-r--r--cmd/podman/networks/list.go2
-rw-r--r--cmd/podman/play/kube.go6
-rw-r--r--cmd/podman/pods/create.go9
-rw-r--r--cmd/podman/pods/inspect.go3
-rw-r--r--cmd/podman/pods/ps.go2
-rw-r--r--cmd/podman/pods/stats.go2
-rw-r--r--cmd/podman/root.go4
-rw-r--r--cmd/podman/secrets/create.go7
-rw-r--r--cmd/podman/secrets/inspect.go6
-rw-r--r--cmd/podman/secrets/list.go2
-rw-r--r--cmd/podman/system/connection/list.go2
-rw-r--r--cmd/podman/system/events.go2
-rw-r--r--cmd/podman/system/info.go2
-rw-r--r--cmd/podman/system/migrate.go4
-rw-r--r--cmd/podman/system/renumber.go3
-rw-r--r--cmd/podman/system/reset.go8
-rw-r--r--cmd/podman/system/version.go2
-rw-r--r--cmd/podman/utils/alias.go3
-rw-r--r--cmd/podman/volumes/inspect.go2
-rw-r--r--cmd/podman/volumes/list.go3
-rw-r--r--contrib/cirrus/lib.sh53
-rwxr-xr-xcontrib/cirrus/logcollector.sh43
-rwxr-xr-xcontrib/cirrus/runner.sh9
-rwxr-xr-xcontrib/cirrus/setup_environment.sh74
-rw-r--r--docs/source/markdown/podman-history.1.md9
-rw-r--r--docs/source/markdown/podman-machine-set.1.md20
-rw-r--r--docs/source/markdown/podman-search.1.md2
-rw-r--r--docs/source/markdown/podman-volume-create.1.md3
-rw-r--r--go.mod7
-rw-r--r--go.sum11
-rwxr-xr-xhack/buildah-vendor-treadmill203
-rw-r--r--libpod/container.go2
-rw-r--r--libpod/container_api.go3
-rw-r--r--libpod/container_copy_linux.go12
-rw-r--r--libpod/container_exec.go12
-rw-r--r--libpod/container_internal_linux.go105
-rw-r--r--libpod/container_stat_linux.go7
-rw-r--r--libpod/define/annotations.go2
-rw-r--r--libpod/define/container_inspect.go4
-rw-r--r--libpod/define/info.go2
-rw-r--r--libpod/kube.go70
-rw-r--r--libpod/logs/log.go4
-rw-r--r--libpod/networking_linux.go10
-rw-r--r--libpod/networking_machine.go4
-rw-r--r--libpod/networking_slirp4netns.go4
-rw-r--r--libpod/oci_attach_linux.go8
-rw-r--r--libpod/oci_conmon_exec_linux.go12
-rw-r--r--libpod/oci_conmon_linux.go2
-rw-r--r--libpod/options.go15
-rw-r--r--libpod/pod.go36
-rw-r--r--libpod/pod_api.go2
-rw-r--r--libpod/runtime.go4
-rw-r--r--libpod/runtime_ctr.go4
-rw-r--r--libpod/runtime_pod_linux.go15
-rw-r--r--libpod/runtime_volume_linux.go39
-rw-r--r--libpod/util.go7
-rw-r--r--libpod/volume.go3
-rw-r--r--libpod/volume_internal.go3
-rw-r--r--pkg/api/handlers/compat/containers.go13
-rw-r--r--pkg/api/handlers/compat/images.go2
-rw-r--r--pkg/api/handlers/compat/images_build.go2
-rw-r--r--pkg/api/handlers/compat/images_prune.go2
-rw-r--r--pkg/api/handlers/decoder.go10
-rw-r--r--pkg/api/handlers/libpod/manifests.go10
-rw-r--r--pkg/api/handlers/libpod/secrets.go8
-rw-r--r--pkg/api/handlers/utils/handler.go2
-rw-r--r--pkg/api/server/register_manifest.go157
-rw-r--r--pkg/bindings/images/build.go16
-rw-r--r--pkg/bindings/images/types.go2
-rw-r--r--pkg/bindings/manifests/manifests.go91
-rw-r--r--pkg/bindings/network/network.go4
-rw-r--r--pkg/bindings/test/containers_test.go34
-rw-r--r--pkg/bindings/test/manifests_test.go2
-rw-r--r--pkg/bindings/test/pods_test.go6
-rw-r--r--pkg/bindings/test/volumes_test.go13
-rw-r--r--pkg/domain/entities/containers.go2
-rw-r--r--pkg/domain/entities/network.go2
-rw-r--r--pkg/domain/entities/reports/prune.go2
-rw-r--r--pkg/domain/infra/abi/containers.go6
-rw-r--r--pkg/domain/infra/abi/images.go15
-rw-r--r--pkg/domain/infra/abi/parse/parse.go5
-rw-r--r--pkg/domain/infra/abi/play.go116
-rw-r--r--pkg/domain/infra/abi/system.go6
-rw-r--r--pkg/domain/infra/abi/trust.go6
-rw-r--r--pkg/hooks/monitor_test.go2
-rw-r--r--pkg/k8s.io/api/core/v1/types.go4
-rw-r--r--pkg/k8s.io/apimachinery/pkg/api/resource/amount.go4
-rw-r--r--pkg/k8s.io/apimachinery/pkg/api/resource/math.go8
-rw-r--r--pkg/k8s.io/apimachinery/pkg/apis/meta/v1/types.go2
-rw-r--r--pkg/lookup/lookup.go2
-rw-r--r--pkg/machine/config.go143
-rw-r--r--pkg/machine/e2e/config.go16
-rw-r--r--pkg/machine/e2e/config_init.go2
-rw-r--r--pkg/machine/e2e/config_set.go43
-rw-r--r--pkg/machine/e2e/init_test.go6
-rw-r--r--pkg/machine/e2e/inspect_test.go9
-rw-r--r--pkg/machine/e2e/list_test.go27
-rw-r--r--pkg/machine/e2e/machine_test.go2
-rw-r--r--pkg/machine/e2e/rm_test.go11
-rw-r--r--pkg/machine/e2e/set_test.go134
-rw-r--r--pkg/machine/e2e/ssh_test.go11
-rw-r--r--pkg/machine/e2e/start_test.go5
-rw-r--r--pkg/machine/e2e/stop_test.go9
-rw-r--r--pkg/machine/fedora.go10
-rw-r--r--pkg/machine/qemu/config.go142
-rw-r--r--pkg/machine/qemu/config_test.go34
-rw-r--r--pkg/machine/qemu/machine.go231
-rw-r--r--pkg/machine/qemu/machine_test.go17
-rw-r--r--pkg/machine/wsl/machine.go63
-rw-r--r--pkg/namespaces/namespaces.go2
-rw-r--r--pkg/specgen/container_validate.go12
-rw-r--r--pkg/specgen/generate/container.go10
-rw-r--r--pkg/specgen/generate/container_create.go20
-rw-r--r--pkg/specgen/generate/kube/kube.go13
-rw-r--r--pkg/specgen/generate/kube/kube_test.go1
-rw-r--r--pkg/specgen/generate/namespaces.go8
-rw-r--r--pkg/specgen/generate/oci.go7
-rw-r--r--pkg/specgen/generate/validate.go6
-rw-r--r--pkg/specgen/winpath.go7
-rw-r--r--pkg/specgenutil/createparse.go7
-rw-r--r--pkg/specgenutil/specgen.go6
-rw-r--r--pkg/systemd/dbus.go14
-rw-r--r--pkg/timetype/timestamp.go9
-rw-r--r--test/apiv2/01-basic.at2
-rw-r--r--test/e2e/attach_test.go2
-rw-r--r--test/e2e/benchmarks_test.go1
-rw-r--r--test/e2e/build_test.go13
-rw-r--r--test/e2e/checkpoint_image_test.go7
-rw-r--r--test/e2e/checkpoint_test.go16
-rw-r--r--test/e2e/commit_test.go8
-rw-r--r--test/e2e/common_test.go7
-rw-r--r--test/e2e/container_clone_test.go17
-rw-r--r--test/e2e/container_create_volume_test.go3
-rw-r--r--test/e2e/container_inspect_test.go1
-rw-r--r--test/e2e/containers_conf_test.go1
-rw-r--r--test/e2e/cp_test.go1
-rw-r--r--test/e2e/create_staticip_test.go1
-rw-r--r--test/e2e/create_staticmac_test.go1
-rw-r--r--test/e2e/create_test.go40
-rw-r--r--test/e2e/diff_test.go1
-rw-r--r--test/e2e/events_test.go1
-rw-r--r--test/e2e/exec_test.go1
-rw-r--r--test/e2e/export_test.go1
-rw-r--r--test/e2e/generate_kube_test.go67
-rw-r--r--test/e2e/generate_systemd_test.go2
-rw-r--r--test/e2e/healthcheck_run_test.go25
-rw-r--r--test/e2e/history_test.go1
-rw-r--r--test/e2e/hooks/checkhook.json5
-rwxr-xr-xtest/e2e/hooks/checkhook.sh4
-rw-r--r--test/e2e/image_scp_test.go2
-rw-r--r--test/e2e/image_sign_test.go2
-rw-r--r--test/e2e/images_test.go5
-rw-r--r--test/e2e/import_test.go1
-rw-r--r--test/e2e/init_test.go13
-rw-r--r--test/e2e/inspect_test.go21
-rw-r--r--test/e2e/libpod_suite_remote_test.go26
-rw-r--r--test/e2e/libpod_suite_test.go12
-rw-r--r--test/e2e/load_test.go2
-rw-r--r--test/e2e/login_logout_test.go21
-rw-r--r--test/e2e/logs_test.go3
-rw-r--r--test/e2e/manifest_test.go1
-rw-r--r--test/e2e/mount_rootless_test.go1
-rw-r--r--test/e2e/namespace_test.go3
-rw-r--r--test/e2e/network_create_test.go9
-rw-r--r--test/e2e/network_test.go26
-rw-r--r--test/e2e/pause_test.go1
-rw-r--r--test/e2e/play_build_test.go1
-rw-r--r--test/e2e/play_kube_test.go26
-rw-r--r--test/e2e/pod_create_test.go33
-rw-r--r--test/e2e/pod_infra_container_test.go1
-rw-r--r--test/e2e/pod_initcontainers_test.go5
-rw-r--r--test/e2e/pod_inspect_test.go5
-rw-r--r--test/e2e/pod_kill_test.go1
-rw-r--r--test/e2e/pod_pause_test.go1
-rw-r--r--test/e2e/pod_pod_namespaces_test.go1
-rw-r--r--test/e2e/pod_prune_test.go1
-rw-r--r--test/e2e/pod_ps_test.go1
-rw-r--r--test/e2e/pod_restart_test.go1
-rw-r--r--test/e2e/pod_rm_test.go1
-rw-r--r--test/e2e/pod_start_test.go1
-rw-r--r--test/e2e/pod_stats_test.go1
-rw-r--r--test/e2e/pod_stop_test.go1
-rw-r--r--test/e2e/pod_top_test.go1
-rw-r--r--test/e2e/port_test.go1
-rw-r--r--test/e2e/prune_test.go1
-rw-r--r--test/e2e/ps_test.go1
-rw-r--r--test/e2e/pull_test.go25
-rw-r--r--test/e2e/push_test.go18
-rw-r--r--test/e2e/rename_test.go1
-rw-r--r--test/e2e/restart_test.go1
-rw-r--r--test/e2e/rm_test.go1
-rw-r--r--test/e2e/run_aardvark_test.go1
-rw-r--r--test/e2e/run_apparmor_test.go15
-rw-r--r--test/e2e/run_cgroup_parent_test.go7
-rw-r--r--test/e2e/run_cleanup_test.go3
-rw-r--r--test/e2e/run_cpu_test.go1
-rw-r--r--test/e2e/run_device_test.go1
-rw-r--r--test/e2e/run_dns_test.go1
-rw-r--r--test/e2e/run_entrypoint_test.go1
-rw-r--r--test/e2e/run_env_test.go1
-rw-r--r--test/e2e/run_exit_test.go1
-rw-r--r--test/e2e/run_memory_test.go1
-rw-r--r--test/e2e/run_networking_test.go100
-rw-r--r--test/e2e/run_ns_test.go1
-rw-r--r--test/e2e/run_passwd_test.go1
-rw-r--r--test/e2e/run_privileged_test.go1
-rw-r--r--test/e2e/run_restart_test.go1
-rw-r--r--test/e2e/run_seccomp_test.go1
-rw-r--r--test/e2e/run_security_labels_test.go2
-rw-r--r--test/e2e/run_selinux_test.go1
-rw-r--r--test/e2e/run_signal_test.go17
-rw-r--r--test/e2e/run_staticip_test.go1
-rw-r--r--test/e2e/run_test.go44
-rw-r--r--test/e2e/run_userns_test.go1
-rw-r--r--test/e2e/run_volume_test.go42
-rw-r--r--test/e2e/run_working_dir_test.go1
-rw-r--r--test/e2e/runlabel_test.go1
-rw-r--r--test/e2e/save_test.go3
-rw-r--r--test/e2e/search_test.go41
-rw-r--r--test/e2e/secret_test.go1
-rw-r--r--test/e2e/start_test.go1
-rw-r--r--test/e2e/stats_test.go1
-rw-r--r--test/e2e/stop_test.go1
-rw-r--r--test/e2e/system_connection_test.go2
-rw-r--r--test/e2e/system_df_test.go3
-rw-r--r--test/e2e/system_dial_stdio_test.go3
-rw-r--r--test/e2e/system_reset_test.go3
-rw-r--r--test/e2e/systemd_activate_test.go1
-rw-r--r--test/e2e/systemd_test.go1
-rw-r--r--test/e2e/toolbox_test.go1
-rw-r--r--test/e2e/top_test.go1
-rw-r--r--test/e2e/tree_test.go2
-rw-r--r--test/e2e/trust_test.go4
-rw-r--r--test/e2e/unshare_test.go1
-rw-r--r--test/e2e/version_test.go2
-rw-r--r--test/e2e/volume_create_test.go1
-rw-r--r--test/e2e/volume_exists_test.go1
-rw-r--r--test/e2e/volume_inspect_test.go1
-rw-r--r--test/e2e/volume_ls_test.go1
-rw-r--r--test/e2e/volume_plugin_test.go16
-rw-r--r--test/e2e/volume_prune_test.go1
-rw-r--r--test/e2e/volume_rm_test.go1
-rw-r--r--test/e2e/wait_test.go1
-rw-r--r--test/system/110-history.bats13
-rw-r--r--test/system/200-pod.bats28
-rw-r--r--test/system/500-networking.bats24
-rw-r--r--test/system/700-play.bats45
-rwxr-xr-xtest/test_podman_baseline.sh22
-rw-r--r--test/utils/common_function_test.go6
-rw-r--r--test/utils/podmantest_test.go12
-rw-r--r--test/utils/utils.go12
-rw-r--r--vendor/github.com/containernetworking/cni/libcni/conf.go6
-rw-r--r--vendor/github.com/containernetworking/cni/pkg/version/plugin.go4
-rw-r--r--vendor/github.com/fsnotify/fsnotify/CHANGELOG.md20
-rw-r--r--vendor/github.com/fsnotify/fsnotify/CONTRIBUTING.md17
-rw-r--r--vendor/github.com/fsnotify/fsnotify/README.md136
-rw-r--r--vendor/github.com/fsnotify/fsnotify/fsnotify_unsupported.go36
-rw-r--r--vendor/github.com/fsnotify/fsnotify/go.mod9
-rw-r--r--vendor/github.com/fsnotify/fsnotify/go.sum4
-rw-r--r--vendor/github.com/fsnotify/fsnotify/inotify.go13
-rw-r--r--vendor/github.com/fsnotify/fsnotify/inotify_poller.go1
-rw-r--r--vendor/github.com/fsnotify/fsnotify/kqueue.go13
-rw-r--r--vendor/github.com/fsnotify/fsnotify/windows.go28
-rw-r--r--vendor/github.com/mrunalp/fileutils/.gitignore1
-rw-r--r--vendor/github.com/mrunalp/fileutils/LICENSE191
-rw-r--r--vendor/github.com/mrunalp/fileutils/MAINTAINERS1
-rw-r--r--vendor/github.com/mrunalp/fileutils/README.md5
-rw-r--r--vendor/github.com/mrunalp/fileutils/fileutils.go168
-rw-r--r--vendor/github.com/mrunalp/fileutils/go.mod3
-rw-r--r--vendor/github.com/mrunalp/fileutils/idtools.go54
-rw-r--r--vendor/golang.org/x/sys/cpu/byteorder.go1
-rw-r--r--vendor/golang.org/x/sys/cpu/cpu_loong64.go13
-rw-r--r--vendor/golang.org/x/sys/unix/asm_linux_loong64.s54
-rw-r--r--vendor/golang.org/x/sys/unix/mkerrors.sh3
-rw-r--r--vendor/golang.org/x/sys/unix/syscall_bsd.go11
-rw-r--r--vendor/golang.org/x/sys/unix/syscall_darwin.go41
-rw-r--r--vendor/golang.org/x/sys/unix/syscall_dragonfly.go5
-rw-r--r--vendor/golang.org/x/sys/unix/syscall_freebsd.go5
-rw-r--r--vendor/golang.org/x/sys/unix/syscall_linux.go10
-rw-r--r--vendor/golang.org/x/sys/unix/syscall_linux_amd64.go1
-rw-r--r--vendor/golang.org/x/sys/unix/syscall_linux_arm64.go1
-rw-r--r--vendor/golang.org/x/sys/unix/syscall_netbsd.go5
-rw-r--r--vendor/golang.org/x/sys/unix/syscall_openbsd.go5
-rw-r--r--vendor/golang.org/x/sys/unix/syscall_solaris.go120
-rw-r--r--vendor/golang.org/x/sys/unix/zerrors_linux.go29
-rw-r--r--vendor/golang.org/x/sys/unix/zsyscall_darwin_amd64.go13
-rw-r--r--vendor/golang.org/x/sys/unix/zsyscall_darwin_amd64.s8
-rw-r--r--vendor/golang.org/x/sys/unix/zsyscall_darwin_arm64.go13
-rw-r--r--vendor/golang.org/x/sys/unix/zsyscall_darwin_arm64.s8
-rw-r--r--vendor/golang.org/x/sys/unix/zsyscall_linux.go89
-rw-r--r--vendor/golang.org/x/sys/unix/zsyscall_linux_amd64.go11
-rw-r--r--vendor/golang.org/x/sys/unix/zsyscall_linux_arm64.go11
-rw-r--r--vendor/golang.org/x/sys/unix/zsysnum_linux_386.go1
-rw-r--r--vendor/golang.org/x/sys/unix/zsysnum_linux_amd64.go1
-rw-r--r--vendor/golang.org/x/sys/unix/zsysnum_linux_arm.go1
-rw-r--r--vendor/golang.org/x/sys/unix/zsysnum_linux_arm64.go1
-rw-r--r--vendor/golang.org/x/sys/unix/zsysnum_linux_mips.go1
-rw-r--r--vendor/golang.org/x/sys/unix/zsysnum_linux_mips64.go1
-rw-r--r--vendor/golang.org/x/sys/unix/zsysnum_linux_mips64le.go1
-rw-r--r--vendor/golang.org/x/sys/unix/zsysnum_linux_mipsle.go1
-rw-r--r--vendor/golang.org/x/sys/unix/zsysnum_linux_ppc.go1
-rw-r--r--vendor/golang.org/x/sys/unix/zsysnum_linux_ppc64.go1
-rw-r--r--vendor/golang.org/x/sys/unix/zsysnum_linux_ppc64le.go1
-rw-r--r--vendor/golang.org/x/sys/unix/zsysnum_linux_riscv64.go1
-rw-r--r--vendor/golang.org/x/sys/unix/zsysnum_linux_s390x.go1
-rw-r--r--vendor/golang.org/x/sys/unix/zsysnum_linux_sparc64.go1
-rw-r--r--vendor/golang.org/x/sys/unix/ztypes_linux.go62
-rw-r--r--vendor/golang.org/x/sys/unix/ztypes_linux_386.go6
-rw-r--r--vendor/golang.org/x/sys/unix/ztypes_linux_amd64.go6
-rw-r--r--vendor/golang.org/x/sys/unix/ztypes_linux_arm.go6
-rw-r--r--vendor/golang.org/x/sys/unix/ztypes_linux_arm64.go6
-rw-r--r--vendor/golang.org/x/sys/unix/ztypes_linux_mips.go6
-rw-r--r--vendor/golang.org/x/sys/unix/ztypes_linux_mips64.go6
-rw-r--r--vendor/golang.org/x/sys/unix/ztypes_linux_mips64le.go6
-rw-r--r--vendor/golang.org/x/sys/unix/ztypes_linux_mipsle.go6
-rw-r--r--vendor/golang.org/x/sys/unix/ztypes_linux_ppc.go6
-rw-r--r--vendor/golang.org/x/sys/unix/ztypes_linux_ppc64.go6
-rw-r--r--vendor/golang.org/x/sys/unix/ztypes_linux_ppc64le.go6
-rw-r--r--vendor/golang.org/x/sys/unix/ztypes_linux_riscv64.go6
-rw-r--r--vendor/golang.org/x/sys/unix/ztypes_linux_s390x.go6
-rw-r--r--vendor/golang.org/x/sys/unix/ztypes_linux_sparc64.go6
-rw-r--r--vendor/modules.txt9
-rw-r--r--version/version.go4
343 files changed, 2974 insertions, 2160 deletions
diff --git a/.cirrus.yml b/.cirrus.yml
index cf97f4467..958c6b0c7 100644
--- a/.cirrus.yml
+++ b/.cirrus.yml
@@ -7,10 +7,6 @@ env:
####
# Name of the ultimate destination branch for this CI run, PR or post-merge.
DEST_BRANCH: "main"
- # Netavark branch to use when TEST_ENVIRON=host-netavark
- NETAVARK_BRANCH: "main"
- # Aardvark branch to use
- AARDVARK_BRANCH: "main"
# Overrides default location (/tmp/cirrus) for repo clone
GOPATH: &gopath "/var/tmp/go"
GOBIN: "${GOPATH}/bin"
@@ -24,21 +20,16 @@ env:
# Runner statistics log file path/name
STATS_LOGFILE_SFX: 'runner_stats.log'
STATS_LOGFILE: '$GOSRC/${CIRRUS_TASK_NAME}-${STATS_LOGFILE_SFX}'
- # Netavark/aardvark location/options when TEST_ENVIRON=host-netavark
- NETAVARK_URL: "https://api.cirrus-ci.com/v1/artifact/github/containers/netavark/success/binary.zip?branch=${NETAVARK_BRANCH}"
- NETAVARK_DEBUG: 0 # set non-zero to use the debug-mode binary
- AARDVARK_URL: "https://api.cirrus-ci.com/v1/artifact/github/containers/aardvark-dns/success/binary.zip?branch=${AARDVARK_BRANCH}"
- AARDVARK_DEBUG: 0 # set non-zero to use the debug-mode binary
####
#### Cache-image names to test with (double-quotes around names are critical)
####
- FEDORA_NAME: "fedora-35"
- PRIOR_FEDORA_NAME: "fedora-34"
+ FEDORA_NAME: "fedora-36"
+ PRIOR_FEDORA_NAME: "fedora-35"
UBUNTU_NAME: "ubuntu-2110"
# Google-cloud VM Images
- IMAGE_SUFFIX: "c4831699639992320"
+ IMAGE_SUFFIX: "c4955393725038592"
FEDORA_CACHE_IMAGE_NAME: "fedora-${IMAGE_SUFFIX}"
PRIOR_FEDORA_CACHE_IMAGE_NAME: "prior-fedora-${IMAGE_SUFFIX}"
UBUNTU_CACHE_IMAGE_NAME: "ubuntu-${IMAGE_SUFFIX}"
@@ -53,7 +44,7 @@ env:
#### N/B: Required ALL of these are set for every single task.
####
TEST_FLAVOR: # int, sys, ext_svc, validate, automation, etc.
- TEST_ENVIRON: host # 'host', 'host-netavark', or 'container'
+ TEST_ENVIRON: host # 'host', or 'container'
PODBIN_NAME: podman # 'podman' or 'remote'
PRIV_NAME: root # 'root' or 'rootless'
DISTRO_NV: # any {PRIOR_,}{FEDORA,UBUNTU}_NAME value
@@ -161,11 +152,11 @@ build_task:
CTR_FQIN: ${FEDORA_CONTAINER_FQIN}
# ID for re-use of build output
_BUILD_CACHE_HANDLE: ${FEDORA_NAME}-build-${CIRRUS_BUILD_ID}
- #- env: &priorfedora_envvars
- # DISTRO_NV: ${PRIOR_FEDORA_NAME}
- # VM_IMAGE_NAME: ${PRIOR_FEDORA_CACHE_IMAGE_NAME}
- # CTR_FQIN: ${PRIOR_FEDORA_CONTAINER_FQIN}
- # _BUILD_CACHE_HANDLE: ${PRIOR_FEDORA_NAME}-build-${CIRRUS_BUILD_ID}
+ - env: &priorfedora_envvars
+ DISTRO_NV: ${PRIOR_FEDORA_NAME}
+ VM_IMAGE_NAME: ${PRIOR_FEDORA_CACHE_IMAGE_NAME}
+ CTR_FQIN: ${PRIOR_FEDORA_CONTAINER_FQIN}
+ _BUILD_CACHE_HANDLE: ${PRIOR_FEDORA_NAME}-build-${CIRRUS_BUILD_ID}
- env: &ubuntu_envvars
DISTRO_NV: ${UBUNTU_NAME}
VM_IMAGE_NAME: ${UBUNTU_CACHE_IMAGE_NAME}
@@ -394,7 +385,7 @@ unit_test_task:
- validate
matrix:
- env: *stdenvars
- #- env: *priorfedora_envvars
+ - env: *priorfedora_envvars
- env: *ubuntu_envvars
# Special-case: Rootless on latest Fedora (standard) VM
- name: "Rootless unit on $DISTRO_NV"
@@ -515,11 +506,11 @@ container_integration_test_task:
_BUILD_CACHE_HANDLE: ${FEDORA_NAME}-build-${CIRRUS_BUILD_ID}
VM_IMAGE_NAME: ${FEDORA_CACHE_IMAGE_NAME}
CTR_FQIN: ${FEDORA_CONTAINER_FQIN}
- #- env:
- # DISTRO_NV: ${PRIOR_FEDORA_NAME}
- # _BUILD_CACHE_HANDLE: ${PRIOR_FEDORA_NAME}-build-${CIRRUS_BUILD_ID}
- # VM_IMAGE_NAME: ${PRIOR_FEDORA_CACHE_IMAGE_NAME}
- # CTR_FQIN: ${PRIOR_FEDORA_CONTAINER_FQIN}
+ - env:
+ DISTRO_NV: ${PRIOR_FEDORA_NAME}
+ _BUILD_CACHE_HANDLE: ${PRIOR_FEDORA_NAME}-build-${CIRRUS_BUILD_ID}
+ VM_IMAGE_NAME: ${PRIOR_FEDORA_CACHE_IMAGE_NAME}
+ CTR_FQIN: ${PRIOR_FEDORA_CONTAINER_FQIN}
gce_instance: *standardvm
timeout_in: 90m
env:
@@ -553,41 +544,6 @@ rootless_integration_test_task:
always: *int_logs_artifacts
-# Run various scenarios using upstream netavark/aardvark-dns binaries
-netavark_task:
- name: "Netavark $TEST_FLAVOR $PODBIN_NAME $PRIV_NAME"
- alias: netavark
- only_if: *not_build
- skip: *branches_and_tags
- depends_on:
- - unit_test
- gce_instance: *standardvm
- matrix:
- - env: &nenv
- DISTRO_NV: ${FEDORA_NAME}
- _BUILD_CACHE_HANDLE: ${FEDORA_NAME}-build-${CIRRUS_BUILD_ID}
- VM_IMAGE_NAME: ${FEDORA_CACHE_IMAGE_NAME}
- CTR_FQIN: ${FEDORA_CONTAINER_FQIN}
- TEST_FLAVOR: int
- TEST_ENVIRON: host-netavark
- - env:
- <<: *nenv
- TEST_FLAVOR: int
- PRIV_NAME: rootless
- - env:
- <<: *nenv
- TEST_FLAVOR: sys
- - env:
- <<: *nenv
- TEST_FLAVOR: sys
- PRIV_NAME: rootless
- clone_script: *noop # Comes from cache
- gopath_cache: *ro_gopath_cache
- setup_script: *setup
- main_script: *main
- always: *int_logs_artifacts
-
-
# Always run subsequent to integration tests. While parallelism is lost
# with runtime, debugging system-test failures can be more challenging
# for some golang developers. Otherwise the following tasks run across
@@ -841,7 +797,6 @@ success_task:
- remote_integration_test
- container_integration_test
- rootless_integration_test
- - netavark
- local_system_test
- remote_system_test
- rootless_system_test
diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md
index 16ec09357..9a4563308 100644
--- a/.github/PULL_REQUEST_TEMPLATE.md
+++ b/.github/PULL_REQUEST_TEMPLATE.md
@@ -9,3 +9,19 @@ Finally, be sure to sign commits with your real name. Since by opening
a PR you already have commits, you can add signatures if needed with
something like `git commit -s --amend`.
-->
+
+#### Does this PR introduce a user-facing change?
+
+<!--
+If no, just write `None` in the release-note block below. If yes, a release note
+is required: Enter your extended release note in the block below. If the PR
+requires additional action from users switching to the new release, include the
+string "action required".
+
+For more information on release notes please follow the kubernetes model:
+https://git.k8s.io/community/contributors/guide/release-notes.md
+-->
+
+```release-note
+
+```
diff --git a/.golangci.yml b/.golangci.yml
index a3c9c4a8b..7eb6ea57e 100644
--- a/.golangci.yml
+++ b/.golangci.yml
@@ -45,8 +45,6 @@ linters:
- gocyclo
- lll
- unconvert
- - errcheck
- - gocritic
- gosec
- maligned
- gomoddirectives
@@ -66,4 +64,4 @@ linters:
linters-settings:
errcheck:
check-blank: false
- ignore: encoding/json:^Unmarshal,fmt:.*
+ ignore: fmt:.*
diff --git a/cmd/podman/auto-update.go b/cmd/podman/auto-update.go
index f8b9fba08..1dc29530e 100644
--- a/cmd/podman/auto-update.go
+++ b/cmd/podman/auto-update.go
@@ -57,7 +57,7 @@ func init() {
flags.BoolVar(&autoUpdateOptions.Rollback, "rollback", true, "Rollback to previous image if update fails")
flags.StringVar(&autoUpdateOptions.format, "format", "", "Change the output format to JSON or a Go template")
- _ = autoUpdateCommand.RegisterFlagCompletionFunc("format", common.AutocompleteFormat(autoUpdateOutput{}))
+ _ = autoUpdateCommand.RegisterFlagCompletionFunc("format", common.AutocompleteFormat(&autoUpdateOutput{}))
}
func autoUpdate(cmd *cobra.Command, args []string) error {
diff --git a/cmd/podman/common/completion.go b/cmd/podman/common/completion.go
index abb943942..ddf922b2a 100644
--- a/cmd/podman/common/completion.go
+++ b/cmd/podman/common/completion.go
@@ -327,7 +327,7 @@ func suffixCompSlice(suf string, slice []string) []string {
if len(split) > 1 {
slice[i] = split[0] + suf + "\t" + split[1]
} else {
- slice[i] = slice[i] + suf
+ slice[i] += suf
}
}
return slice
@@ -647,7 +647,10 @@ func AutocompleteInspect(cmd *cobra.Command, args []string, toComplete string) (
pods, _ := getPods(cmd, toComplete, completeDefault)
networks, _ := getNetworks(cmd, toComplete, completeDefault)
volumes, _ := getVolumes(cmd, toComplete)
- suggestions := append(containers, images...)
+
+ suggestions := make([]string, 0, len(containers)+len(images)+len(pods)+len(networks)+len(volumes))
+ suggestions = append(suggestions, containers...)
+ suggestions = append(suggestions, images...)
suggestions = append(suggestions, pods...)
suggestions = append(suggestions, networks...)
suggestions = append(suggestions, volumes...)
@@ -961,6 +964,8 @@ func AutocompleteFormat(o interface{}) func(cmd *cobra.Command, args []string, t
// this function provides shell completion for go templates
return func(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) {
// autocomplete json when nothing or json is typed
+ // gocritic complains about the argument order but this is correct in this case
+ //nolint:gocritic
if strings.HasPrefix("json", toComplete) {
return []string{"json"}, cobra.ShellCompDirectiveNoFileComp
}
@@ -982,14 +987,12 @@ func AutocompleteFormat(o interface{}) func(cmd *cobra.Command, args []string, t
fields := strings.Split(field[len(field)-1], ".")
f := reflect.ValueOf(o)
for i := 1; i < len(fields); i++ {
- if f.Kind() == reflect.Ptr {
- f = f.Elem()
- }
-
- // the only supported type is struct
- if f.Kind() != reflect.Struct {
+ val := getActualStructType(f)
+ if val == nil {
+ // no struct return nothing to complete
return nil, cobra.ShellCompDirectiveNoFileComp
}
+ f = *val
// last field get all names to suggest
if i == len(fields)-1 {
@@ -1007,17 +1010,38 @@ func AutocompleteFormat(o interface{}) func(cmd *cobra.Command, args []string, t
}
}
-// getStructFields reads all struct field names and method names and returns them.
-func getStructFields(f reflect.Value, prefix string) []string {
- suggestions := []string{}
+// getActualStructType take the value and check if it is a struct,
+// if it is pointer it will dereference it and when it is nil,
+// it will create a new value from it to get the actual struct
+// returns nil when type is not a struct
+func getActualStructType(f reflect.Value) *reflect.Value {
// follow the pointer first
if f.Kind() == reflect.Ptr {
+ // if the pointer is nil we create a new value from the elements type
+ // this allows us to follow nil pointers and get the actual struct fields
+ if f.IsNil() {
+ f = reflect.New(f.Type().Elem())
+ }
f = f.Elem()
}
// we only support structs
if f.Kind() != reflect.Struct {
return nil
}
+ return &f
+}
+
+// getStructFields reads all struct field names and method names and returns them.
+func getStructFields(f reflect.Value, prefix string) []string {
+ suggestions := []string{}
+
+ val := getActualStructType(f)
+ if val == nil {
+ // no struct return nothing to complete
+ return nil
+ }
+ f = *val
+
// loop over all field names
for j := 0; j < f.NumField(); j++ {
field := f.Type().Field(j)
@@ -1032,13 +1056,12 @@ func getStructFields(f reflect.Value, prefix string) []string {
if kind == reflect.Struct {
suffix = "."
}
- if strings.HasPrefix(fname, prefix) {
- // add field name with suffix
- suggestions = append(suggestions, fname+suffix)
- }
// if field is anonymous add the child fields as well
if field.Anonymous {
- suggestions = append(suggestions, getStructFields(f.FieldByIndex([]int{j}), prefix)...)
+ suggestions = append(suggestions, getStructFields(f.Field(j), prefix)...)
+ } else if strings.HasPrefix(fname, prefix) {
+ // add field name with suffix
+ suggestions = append(suggestions, fname+suffix)
}
}
diff --git a/cmd/podman/common/completion_test.go b/cmd/podman/common/completion_test.go
index d28ac3928..ae117a173 100644
--- a/cmd/podman/common/completion_test.go
+++ b/cmd/podman/common/completion_test.go
@@ -34,10 +34,9 @@ func TestAutocompleteFormat(t *testing.T) {
Name string
Age int
Car *Car
+ Car2 *Car
*Anonymous
- }{
- Anonymous: &Anonymous{},
- }
+ }{}
testStruct.Car = &Car{}
testStruct.Car.Extras = map[string]string{"test": "1"}
@@ -80,12 +79,12 @@ func TestAutocompleteFormat(t *testing.T) {
{
"fist level struct field name",
"{{.",
- []string{"{{.Name}}", "{{.Age}}", "{{.Car.", "{{.Anonymous.", "{{.Hello}}"},
+ []string{"{{.Name}}", "{{.Age}}", "{{.Car.", "{{.Car2.", "{{.Hello}}"},
},
{
"fist level struct field name",
"{{ .",
- []string{"{{ .Name}}", "{{ .Age}}", "{{ .Car.", "{{ .Anonymous.", "{{ .Hello}}"},
+ []string{"{{ .Name}}", "{{ .Age}}", "{{ .Car.", "{{ .Car2.", "{{ .Hello}}"},
},
{
"fist level struct field name",
@@ -103,6 +102,11 @@ func TestAutocompleteFormat(t *testing.T) {
[]string{"{{ .Car.Brand}}"},
},
{
+ "second level nil struct field name",
+ "{{ .Car2.",
+ []string{"{{ .Car2.Brand}}", "{{ .Car2.Stats.", "{{ .Car2.Extras}}", "{{ .Car2.Color}}", "{{ .Car2.Type}}"},
+ },
+ {
"three level struct field name",
"{{ .Car.Stats.",
[]string{"{{ .Car.Stats.HP}}", "{{ .Car.Stats.Displacement}}"},
diff --git a/cmd/podman/common/create.go b/cmd/podman/common/create.go
index 62c9f4c9a..1c1a7c3e3 100644
--- a/cmd/podman/common/create.go
+++ b/cmd/podman/common/create.go
@@ -896,7 +896,7 @@ func DefineCreateFlags(cmd *cobra.Command, cf *entities.ContainerCreateOptions,
)
_ = cmd.RegisterFlagCompletionFunc(memorySwappinessFlagName, completion.AutocompleteNone)
}
- //anyone can use these
+ // anyone can use these
cpusFlagName := "cpus"
createFlags.Float64Var(
&cf.CPUS,
diff --git a/cmd/podman/completion/completion.go b/cmd/podman/completion/completion.go
index b02a0d772..6f185cde8 100644
--- a/cmd/podman/completion/completion.go
+++ b/cmd/podman/completion/completion.go
@@ -31,7 +31,7 @@ var (
Example: `podman completion bash
podman completion zsh -f _podman
podman completion fish --no-desc`,
- //don't show this command to users
+ // don't show this command to users
Hidden: true,
}
)
diff --git a/cmd/podman/containers/inspect.go b/cmd/podman/containers/inspect.go
index 8c219b67c..03e6411a1 100644
--- a/cmd/podman/containers/inspect.go
+++ b/cmd/podman/containers/inspect.go
@@ -35,12 +35,7 @@ func init() {
formatFlagName := "format"
flags.StringVarP(&inspectOpts.Format, formatFlagName, "f", "json", "Format the output to a Go template or json")
- _ = inspectCmd.RegisterFlagCompletionFunc(formatFlagName, common.AutocompleteFormat(define.InspectContainerData{
- State: &define.InspectContainerState{},
- NetworkSettings: &define.InspectNetworkSettings{},
- Config: &define.InspectContainerConfig{},
- HostConfig: &define.InspectContainerHostConfig{},
- }))
+ _ = inspectCmd.RegisterFlagCompletionFunc(formatFlagName, common.AutocompleteFormat(&define.InspectContainerData{}))
validate.AddLatestFlag(inspectCmd, &inspectOpts.Latest)
}
diff --git a/cmd/podman/containers/ps.go b/cmd/podman/containers/ps.go
index 4adae30c2..a011a8ae6 100644
--- a/cmd/podman/containers/ps.go
+++ b/cmd/podman/containers/ps.go
@@ -80,7 +80,7 @@ func listFlagSet(cmd *cobra.Command) {
formatFlagName := "format"
flags.StringVar(&listOpts.Format, formatFlagName, "", "Pretty-print containers to JSON or using a Go template")
- _ = cmd.RegisterFlagCompletionFunc(formatFlagName, common.AutocompleteFormat(entities.ListContainer{}))
+ _ = cmd.RegisterFlagCompletionFunc(formatFlagName, common.AutocompleteFormat(&psReporter{}))
lastFlagName := "last"
flags.IntVarP(&listOpts.Last, lastFlagName, "n", -1, "Print the n last created containers (all states)")
diff --git a/cmd/podman/containers/stats.go b/cmd/podman/containers/stats.go
index 715f5c081..500671d31 100644
--- a/cmd/podman/containers/stats.go
+++ b/cmd/podman/containers/stats.go
@@ -67,7 +67,7 @@ func statFlags(cmd *cobra.Command) {
formatFlagName := "format"
flags.StringVar(&statsOptions.Format, formatFlagName, "", "Pretty-print container statistics to JSON or using a Go template")
- _ = cmd.RegisterFlagCompletionFunc(formatFlagName, common.AutocompleteFormat(define.ContainerStats{}))
+ _ = cmd.RegisterFlagCompletionFunc(formatFlagName, common.AutocompleteFormat(&containerStats{}))
flags.BoolVar(&statsOptions.NoReset, "no-reset", false, "Disable resetting the screen between intervals")
flags.BoolVar(&statsOptions.NoStream, "no-stream", false, "Disable streaming stats and only pull the first result, default setting is false")
diff --git a/cmd/podman/images/history.go b/cmd/podman/images/history.go
index c05d3475b..e190941e7 100644
--- a/cmd/podman/images/history.go
+++ b/cmd/podman/images/history.go
@@ -69,7 +69,7 @@ func historyFlags(cmd *cobra.Command) {
formatFlagName := "format"
flags.StringVar(&opts.format, formatFlagName, "", "Change the output to JSON or a Go template")
- _ = cmd.RegisterFlagCompletionFunc(formatFlagName, common.AutocompleteFormat(entities.ImageHistoryLayer{}))
+ _ = cmd.RegisterFlagCompletionFunc(formatFlagName, common.AutocompleteFormat(&historyReporter{}))
flags.BoolVarP(&opts.human, "human", "H", true, "Display sizes and dates in human readable format")
flags.BoolVar(&opts.noTrunc, "no-trunc", false, "Do not truncate the output")
@@ -168,3 +168,11 @@ func (h historyReporter) ID() string {
}
return h.ImageHistoryLayer.ID
}
+
+func (h historyReporter) CreatedAt() string {
+ return time.Unix(h.ImageHistoryLayer.Created.Unix(), 0).UTC().String()
+}
+
+func (h historyReporter) CreatedSince() string {
+ return h.Created()
+}
diff --git a/cmd/podman/images/inspect.go b/cmd/podman/images/inspect.go
index b4a79bc96..22c404b3f 100644
--- a/cmd/podman/images/inspect.go
+++ b/cmd/podman/images/inspect.go
@@ -34,7 +34,7 @@ func init() {
formatFlagName := "format"
flags.StringVarP(&inspectOpts.Format, formatFlagName, "f", "json", "Format the output to a Go template or json")
- _ = inspectCmd.RegisterFlagCompletionFunc(formatFlagName, common.AutocompleteFormat(inspectTypes.ImageData{}))
+ _ = inspectCmd.RegisterFlagCompletionFunc(formatFlagName, common.AutocompleteFormat(&inspectTypes.ImageData{}))
}
func inspectExec(cmd *cobra.Command, args []string) error {
diff --git a/cmd/podman/images/list.go b/cmd/podman/images/list.go
index 58fb3e919..81011f9b1 100644
--- a/cmd/podman/images/list.go
+++ b/cmd/podman/images/list.go
@@ -94,7 +94,7 @@ func imageListFlagSet(cmd *cobra.Command) {
formatFlagName := "format"
flags.StringVar(&listFlag.format, formatFlagName, "", "Change the output format to JSON or a Go template")
- _ = cmd.RegisterFlagCompletionFunc(formatFlagName, common.AutocompleteFormat(entities.ImageSummary{}))
+ _ = cmd.RegisterFlagCompletionFunc(formatFlagName, common.AutocompleteFormat(&imageReporter{}))
flags.BoolVar(&listFlag.digests, "digests", false, "Show digests")
flags.BoolVarP(&listFlag.noHeading, "noheading", "n", false, "Do not print column headings")
diff --git a/cmd/podman/images/scp.go b/cmd/podman/images/scp.go
index 51a9d1c4e..3dbc9c331 100644
--- a/cmd/podman/images/scp.go
+++ b/cmd/podman/images/scp.go
@@ -121,13 +121,8 @@ func scp(cmd *cobra.Command, args []string) (finalErr error) {
return err
}
if flipConnections { // the order of cliConnections matters, we need to flip both arrays since the args are parsed separately sometimes.
- connect := cliConnections[0]
- cliConnections[0] = cliConnections[1]
- cliConnections[1] = connect
-
- loc := locations[0]
- locations[0] = locations[1]
- locations[1] = loc
+ cliConnections[0], cliConnections[1] = cliConnections[1], cliConnections[0]
+ locations[0], locations[1] = locations[1], locations[0]
}
dest = *locations[1]
case len(locations) == 1:
diff --git a/cmd/podman/images/search.go b/cmd/podman/images/search.go
index aa11cf254..335ea2b5a 100644
--- a/cmd/podman/images/search.go
+++ b/cmd/podman/images/search.go
@@ -9,6 +9,7 @@ import (
"github.com/containers/common/pkg/completion"
"github.com/containers/common/pkg/report"
"github.com/containers/image/v5/types"
+ "github.com/containers/podman/v4/cmd/podman/common"
"github.com/containers/podman/v4/cmd/podman/registry"
"github.com/containers/podman/v4/pkg/domain/entities"
"github.com/pkg/errors"
@@ -23,6 +24,7 @@ type searchOptionsWrapper struct {
Compatible bool // Docker compat
TLSVerifyCLI bool // Used to convert to an optional bool later
Format string // For go templating
+ NoTrunc bool
}
// listEntryTag is a utility structure used for json serialization.
@@ -86,13 +88,13 @@ func searchFlags(cmd *cobra.Command) {
formatFlagName := "format"
flags.StringVar(&searchOptions.Format, formatFlagName, "", "Change the output format to JSON or a Go template")
- _ = cmd.RegisterFlagCompletionFunc(formatFlagName, completion.AutocompleteNone)
+ _ = cmd.RegisterFlagCompletionFunc(formatFlagName, common.AutocompleteFormat(&entities.ImageSearchReport{}))
limitFlagName := "limit"
flags.IntVar(&searchOptions.Limit, limitFlagName, 0, "Limit the number of results")
_ = cmd.RegisterFlagCompletionFunc(limitFlagName, completion.AutocompleteNone)
- flags.Bool("no-trunc", true, "Do not truncate the output. Default: true")
+ flags.BoolVar(&searchOptions.NoTrunc, "no-trunc", false, "Do not truncate the output")
flags.BoolVar(&searchOptions.Compatible, "compatible", false, "List stars, official and automated columns (Docker compatibility)")
authfileFlagName := "authfile"
@@ -139,11 +141,10 @@ func imageSearch(cmd *cobra.Command, args []string) error {
return nil
}
- noTrunc, _ := cmd.Flags().GetBool("no-trunc")
isJSON := report.IsJSON(searchOptions.Format)
for i, element := range searchReport {
d := strings.ReplaceAll(element.Description, "\n", " ")
- if len(d) > 44 && !(noTrunc || isJSON) {
+ if len(d) > 44 && !(searchOptions.NoTrunc || isJSON) {
d = strings.TrimSpace(d[:44]) + "..."
}
searchReport[i].Description = d
diff --git a/cmd/podman/machine/inspect.go b/cmd/podman/machine/inspect.go
index 1884cf94d..21e5074b7 100644
--- a/cmd/podman/machine/inspect.go
+++ b/cmd/podman/machine/inspect.go
@@ -41,7 +41,7 @@ func init() {
flags := inspectCmd.Flags()
formatFlagName := "format"
flags.StringVar(&inspectFlag.format, formatFlagName, "", "Format volume output using JSON or a Go template")
- _ = inspectCmd.RegisterFlagCompletionFunc(formatFlagName, common.AutocompleteFormat(machine.InspectInfo{}))
+ _ = inspectCmd.RegisterFlagCompletionFunc(formatFlagName, common.AutocompleteFormat(&machine.InspectInfo{}))
}
func inspect(cmd *cobra.Command, args []string) error {
@@ -59,16 +59,12 @@ func inspect(cmd *cobra.Command, args []string) error {
errs = append(errs, err)
continue
}
- state, err := vm.State(false)
+ ii, err := vm.Inspect()
if err != nil {
errs = append(errs, err)
continue
}
- ii := machine.InspectInfo{
- State: state,
- VM: vm,
- }
- vms = append(vms, ii)
+ vms = append(vms, *ii)
}
if len(inspectFlag.format) > 0 {
// need jhonce to work his template magic
diff --git a/cmd/podman/machine/list.go b/cmd/podman/machine/list.go
index 587e521a3..c987bf71a 100644
--- a/cmd/podman/machine/list.go
+++ b/cmd/podman/machine/list.go
@@ -69,7 +69,7 @@ func init() {
flags := lsCmd.Flags()
formatFlagName := "format"
flags.StringVar(&listFlag.format, formatFlagName, "{{.Name}}\t{{.VMType}}\t{{.Created}}\t{{.LastUp}}\t{{.CPUs}}\t{{.Memory}}\t{{.DiskSize}}\n", "Format volume output using JSON or a Go template")
- _ = lsCmd.RegisterFlagCompletionFunc(formatFlagName, common.AutocompleteFormat(machineReporter{}))
+ _ = lsCmd.RegisterFlagCompletionFunc(formatFlagName, common.AutocompleteFormat(&machineReporter{}))
flags.BoolVar(&listFlag.noHeading, "noheading", false, "Do not print headers")
flags.BoolVarP(&listFlag.quiet, "quiet", "q", false, "Show only machine names")
}
diff --git a/cmd/podman/machine/set.go b/cmd/podman/machine/set.go
index 4c15f1de1..a994c981b 100644
--- a/cmd/podman/machine/set.go
+++ b/cmd/podman/machine/set.go
@@ -4,6 +4,9 @@
package machine
import (
+ "fmt"
+ "os"
+
"github.com/containers/common/pkg/completion"
"github.com/containers/podman/v4/cmd/podman/registry"
"github.com/containers/podman/v4/pkg/machine"
@@ -23,9 +26,17 @@ var (
)
var (
- setOpts = machine.SetOptions{}
+ setFlags = SetFlags{}
+ setOpts = machine.SetOptions{}
)
+type SetFlags struct {
+ CPUs uint64
+ DiskSize uint64
+ Memory uint64
+ Rootful bool
+}
+
func init() {
registry.Commands = append(registry.Commands, registry.CliCommand{
Command: setCmd,
@@ -34,7 +45,32 @@ func init() {
flags := setCmd.Flags()
rootfulFlagName := "rootful"
- flags.BoolVar(&setOpts.Rootful, rootfulFlagName, false, "Whether this machine should prefer rootful container execution")
+ flags.BoolVar(&setFlags.Rootful, rootfulFlagName, false, "Whether this machine should prefer rootful container execution")
+
+ cpusFlagName := "cpus"
+ flags.Uint64Var(
+ &setFlags.CPUs,
+ cpusFlagName, 0,
+ "Number of CPUs",
+ )
+ _ = setCmd.RegisterFlagCompletionFunc(cpusFlagName, completion.AutocompleteNone)
+
+ diskSizeFlagName := "disk-size"
+ flags.Uint64Var(
+ &setFlags.DiskSize,
+ diskSizeFlagName, 0,
+ "Disk size in GB",
+ )
+
+ _ = setCmd.RegisterFlagCompletionFunc(diskSizeFlagName, completion.AutocompleteNone)
+
+ memoryFlagName := "memory"
+ flags.Uint64VarP(
+ &setFlags.Memory,
+ memoryFlagName, "m", 0,
+ "Memory in MB",
+ )
+ _ = setCmd.RegisterFlagCompletionFunc(memoryFlagName, completion.AutocompleteNone)
}
func setMachine(cmd *cobra.Command, args []string) error {
@@ -53,5 +89,23 @@ func setMachine(cmd *cobra.Command, args []string) error {
return err
}
- return vm.Set(vmName, setOpts)
+ if cmd.Flags().Changed("rootful") {
+ setOpts.Rootful = &setFlags.Rootful
+ }
+ if cmd.Flags().Changed("cpus") {
+ setOpts.CPUs = &setFlags.CPUs
+ }
+ if cmd.Flags().Changed("memory") {
+ setOpts.Memory = &setFlags.Memory
+ }
+ if cmd.Flags().Changed("disk-size") {
+ setOpts.DiskSize = &setFlags.DiskSize
+ }
+
+ setErrs, lasterr := vm.Set(vmName, setOpts)
+ for _, err := range setErrs {
+ fmt.Fprintf(os.Stderr, "%v\n", err)
+ }
+
+ return lasterr
}
diff --git a/cmd/podman/networks/inspect.go b/cmd/podman/networks/inspect.go
index 3c07e5492..8f39ec395 100644
--- a/cmd/podman/networks/inspect.go
+++ b/cmd/podman/networks/inspect.go
@@ -1,6 +1,7 @@
package network
import (
+ "github.com/containers/common/libnetwork/types"
"github.com/containers/podman/v4/cmd/podman/common"
"github.com/containers/podman/v4/cmd/podman/inspect"
"github.com/containers/podman/v4/cmd/podman/registry"
@@ -32,7 +33,7 @@ func init() {
formatFlagName := "format"
flags.StringVarP(&inspectOpts.Format, formatFlagName, "f", "", "Pretty-print network to JSON or using a Go template")
- _ = networkinspectCommand.RegisterFlagCompletionFunc(formatFlagName, common.AutocompleteFormat(nil))
+ _ = networkinspectCommand.RegisterFlagCompletionFunc(formatFlagName, common.AutocompleteFormat(&types.Network{}))
}
func networkInspect(_ *cobra.Command, args []string) error {
diff --git a/cmd/podman/networks/list.go b/cmd/podman/networks/list.go
index f14e0ed0f..5d4be2a81 100644
--- a/cmd/podman/networks/list.go
+++ b/cmd/podman/networks/list.go
@@ -40,7 +40,7 @@ var (
func networkListFlags(flags *pflag.FlagSet) {
formatFlagName := "format"
flags.StringVar(&networkListOptions.Format, formatFlagName, "", "Pretty-print networks to JSON or using a Go template")
- _ = networklistCommand.RegisterFlagCompletionFunc(formatFlagName, common.AutocompleteFormat(ListPrintReports{}))
+ _ = networklistCommand.RegisterFlagCompletionFunc(formatFlagName, common.AutocompleteFormat(&ListPrintReports{}))
flags.BoolVarP(&networkListOptions.Quiet, "quiet", "q", false, "display only names")
flags.BoolVar(&noTrunc, "no-trunc", false, "Do not truncate the network ID")
diff --git a/cmd/podman/play/kube.go b/cmd/podman/play/kube.go
index e92516eb4..40d14a609 100644
--- a/cmd/podman/play/kube.go
+++ b/cmd/podman/play/kube.go
@@ -178,7 +178,11 @@ func kube(cmd *cobra.Command, args []string) error {
if kubeOptions.Annotations == nil {
kubeOptions.Annotations = make(map[string]string)
}
- kubeOptions.Annotations[splitN[0]] = splitN[1]
+ annotation := splitN[1]
+ if len(annotation) > define.MaxKubeAnnotation {
+ return errors.Errorf("annotation exceeds maximum size, %d, of kubernetes annotation: %s", define.MaxKubeAnnotation, annotation)
+ }
+ kubeOptions.Annotations[splitN[0]] = annotation
}
yamlfile := args[0]
if yamlfile == "-" {
diff --git a/cmd/podman/pods/create.go b/cmd/podman/pods/create.go
index b45ed0d39..4623ade63 100644
--- a/cmd/podman/pods/create.go
+++ b/cmd/podman/pods/create.go
@@ -214,7 +214,7 @@ func create(cmd *cobra.Command, args []string) error {
ret, err := parsers.ParseUintList(copy)
copy = ""
if err != nil {
- errors.Wrapf(err, "could not parse list")
+ return errors.Wrapf(err, "could not parse list")
}
var vals []int
for ind, val := range ret {
@@ -224,7 +224,8 @@ func create(cmd *cobra.Command, args []string) error {
}
sort.Ints(vals)
for ind, core := range vals {
- if core > int(cpuSet) {
+ switch {
+ case core > int(cpuSet):
if copy == "" {
copy = "0-" + strconv.Itoa(int(cpuSet))
infraOptions.CPUSetCPUs = copy
@@ -233,9 +234,9 @@ func create(cmd *cobra.Command, args []string) error {
infraOptions.CPUSetCPUs = copy
break
}
- } else if ind != 0 {
+ case ind != 0:
copy += "," + strconv.Itoa(core)
- } else {
+ default:
copy = "" + strconv.Itoa(core)
}
}
diff --git a/cmd/podman/pods/inspect.go b/cmd/podman/pods/inspect.go
index ae6a5ba88..bb30fe6e6 100644
--- a/cmd/podman/pods/inspect.go
+++ b/cmd/podman/pods/inspect.go
@@ -9,7 +9,6 @@ import (
"github.com/containers/podman/v4/cmd/podman/common"
"github.com/containers/podman/v4/cmd/podman/registry"
"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/pkg/errors"
"github.com/spf13/cobra"
@@ -43,7 +42,7 @@ func init() {
formatFlagName := "format"
flags.StringVarP(&inspectOptions.Format, formatFlagName, "f", "json", "Format the output to a Go template or json")
- _ = inspectCmd.RegisterFlagCompletionFunc(formatFlagName, common.AutocompleteFormat(define.InspectPodData{}))
+ _ = inspectCmd.RegisterFlagCompletionFunc(formatFlagName, common.AutocompleteFormat(&entities.PodInspectReport{}))
validate.AddLatestFlag(inspectCmd, &inspectOptions.Latest)
}
diff --git a/cmd/podman/pods/ps.go b/cmd/podman/pods/ps.go
index 4a049541a..1275e65dc 100644
--- a/cmd/podman/pods/ps.go
+++ b/cmd/podman/pods/ps.go
@@ -57,7 +57,7 @@ func init() {
formatFlagName := "format"
flags.StringVar(&psInput.Format, formatFlagName, "", "Pretty-print pods to JSON or using a Go template")
- _ = psCmd.RegisterFlagCompletionFunc(formatFlagName, common.AutocompleteFormat(ListPodReporter{ListPodsReport: &entities.ListPodsReport{}}))
+ _ = psCmd.RegisterFlagCompletionFunc(formatFlagName, common.AutocompleteFormat(&ListPodReporter{}))
flags.Bool("noheading", false, "Do not print headers")
flags.BoolVar(&psInput.Namespace, "namespace", false, "Display namespace information of the pod")
diff --git a/cmd/podman/pods/stats.go b/cmd/podman/pods/stats.go
index f7a56d3f3..9833f4cea 100644
--- a/cmd/podman/pods/stats.go
+++ b/cmd/podman/pods/stats.go
@@ -54,7 +54,7 @@ func init() {
formatFlagName := "format"
flags.StringVar(&statsOptions.Format, formatFlagName, "", "Pretty-print container statistics to JSON or using a Go template")
- _ = statsCmd.RegisterFlagCompletionFunc(formatFlagName, common.AutocompleteFormat(entities.PodStatsReport{}))
+ _ = statsCmd.RegisterFlagCompletionFunc(formatFlagName, common.AutocompleteFormat(&entities.PodStatsReport{}))
flags.BoolVar(&statsOptions.NoReset, "no-reset", false, "Disable resetting the screen when streaming")
flags.BoolVar(&statsOptions.NoStream, "no-stream", false, "Disable streaming stats and only pull the first result")
diff --git a/cmd/podman/root.go b/cmd/podman/root.go
index 9b1aa778b..2bd4fa723 100644
--- a/cmd/podman/root.go
+++ b/cmd/podman/root.go
@@ -153,7 +153,9 @@ func persistentPreRunE(cmd *cobra.Command, args []string) error {
*runtime,
)
}
- runtimeFlag.Value.Set(*runtime)
+ if err := runtimeFlag.Value.Set(*runtime); err != nil {
+ return err
+ }
runtimeFlag.Changed = true
logrus.Debugf("Checkpoint was created using '%s'. Restore will use the same runtime", *runtime)
} else if cfg.RuntimePath != *runtime {
diff --git a/cmd/podman/secrets/create.go b/cmd/podman/secrets/create.go
index 069e2a1dc..01ee3d256 100644
--- a/cmd/podman/secrets/create.go
+++ b/cmd/podman/secrets/create.go
@@ -62,13 +62,14 @@ func create(cmd *cobra.Command, args []string) error {
path := args[1]
var reader io.Reader
- if env {
+ switch {
+ case env:
envValue := os.Getenv(path)
if envValue == "" {
return errors.Errorf("cannot create store secret data: environment variable %s is not set", path)
}
reader = strings.NewReader(envValue)
- } else if path == "-" || path == "/dev/stdin" {
+ case path == "-" || path == "/dev/stdin":
stat, err := os.Stdin.Stat()
if err != nil {
return err
@@ -77,7 +78,7 @@ func create(cmd *cobra.Command, args []string) error {
return errors.New("if `-` is used, data must be passed into stdin")
}
reader = os.Stdin
- } else {
+ default:
file, err := os.Open(path)
if err != nil {
return err
diff --git a/cmd/podman/secrets/inspect.go b/cmd/podman/secrets/inspect.go
index 0977434f7..473d5620c 100644
--- a/cmd/podman/secrets/inspect.go
+++ b/cmd/podman/secrets/inspect.go
@@ -36,7 +36,7 @@ func init() {
flags := inspectCmd.Flags()
formatFlagName := "format"
flags.StringVar(&format, formatFlagName, "", "Format volume output using Go template")
- _ = inspectCmd.RegisterFlagCompletionFunc(formatFlagName, common.AutocompleteFormat(entities.SecretInfoReport{}))
+ _ = inspectCmd.RegisterFlagCompletionFunc(formatFlagName, common.AutocompleteFormat(&entities.SecretInfoReport{}))
}
func inspect(cmd *cobra.Command, args []string) error {
@@ -61,7 +61,9 @@ func inspect(cmd *cobra.Command, args []string) error {
return err
}
defer w.Flush()
- tmpl.Execute(w, inspected)
+ if err := tmpl.Execute(w, inspected); err != nil {
+ return err
+ }
} else {
buf, err := json.MarshalIndent(inspected, "", " ")
if err != nil {
diff --git a/cmd/podman/secrets/list.go b/cmd/podman/secrets/list.go
index 2ef84cd48..558a16ccf 100644
--- a/cmd/podman/secrets/list.go
+++ b/cmd/podman/secrets/list.go
@@ -45,7 +45,7 @@ func init() {
flags := lsCmd.Flags()
formatFlagName := "format"
flags.StringVar(&listFlag.format, formatFlagName, "{{.ID}}\t{{.Name}}\t{{.Driver}}\t{{.CreatedAt}}\t{{.UpdatedAt}}\t\n", "Format volume output using Go template")
- _ = lsCmd.RegisterFlagCompletionFunc(formatFlagName, common.AutocompleteFormat(entities.SecretInfoReport{}))
+ _ = lsCmd.RegisterFlagCompletionFunc(formatFlagName, common.AutocompleteFormat(&entities.SecretInfoReport{}))
filterFlagName := "filter"
flags.StringSliceVarP(&listFlag.filter, filterFlagName, "f", []string{}, "Filter secret output")
_ = lsCmd.RegisterFlagCompletionFunc(filterFlagName, common.AutocompleteSecretFilters)
diff --git a/cmd/podman/system/connection/list.go b/cmd/podman/system/connection/list.go
index fe37677df..2c5f6a310 100644
--- a/cmd/podman/system/connection/list.go
+++ b/cmd/podman/system/connection/list.go
@@ -38,7 +38,7 @@ func init() {
})
listCmd.Flags().String("format", "", "Custom Go template for printing connections")
- _ = listCmd.RegisterFlagCompletionFunc("format", common.AutocompleteFormat(namedDestination{}))
+ _ = listCmd.RegisterFlagCompletionFunc("format", common.AutocompleteFormat(&namedDestination{}))
}
type namedDestination struct {
diff --git a/cmd/podman/system/events.go b/cmd/podman/system/events.go
index 2723adc43..09e589d3c 100644
--- a/cmd/podman/system/events.go
+++ b/cmd/podman/system/events.go
@@ -51,7 +51,7 @@ func init() {
formatFlagName := "format"
flags.StringVar(&eventFormat, formatFlagName, "", "format the output using a Go template")
- _ = eventsCommand.RegisterFlagCompletionFunc(formatFlagName, common.AutocompleteFormat(events.Event{}))
+ _ = eventsCommand.RegisterFlagCompletionFunc(formatFlagName, common.AutocompleteFormat(&events.Event{}))
flags.BoolVar(&eventOptions.Stream, "stream", true, "stream new events; for testing only")
diff --git a/cmd/podman/system/info.go b/cmd/podman/system/info.go
index e95e9336d..f8fd946cd 100644
--- a/cmd/podman/system/info.go
+++ b/cmd/podman/system/info.go
@@ -66,7 +66,7 @@ func infoFlags(cmd *cobra.Command) {
formatFlagName := "format"
flags.StringVarP(&inFormat, formatFlagName, "f", "", "Change the output format to JSON or a Go template")
- _ = cmd.RegisterFlagCompletionFunc(formatFlagName, common.AutocompleteFormat(define.Info{Host: &define.HostInfo{}, Store: &define.StoreInfo{}}))
+ _ = cmd.RegisterFlagCompletionFunc(formatFlagName, common.AutocompleteFormat(&define.Info{}))
}
func info(cmd *cobra.Command, args []string) error {
diff --git a/cmd/podman/system/migrate.go b/cmd/podman/system/migrate.go
index 5d7b31314..b2bca9be0 100644
--- a/cmd/podman/system/migrate.go
+++ b/cmd/podman/system/migrate.go
@@ -69,6 +69,10 @@ func migrate(cmd *cobra.Command, args []string) {
err = engine.Migrate(registry.Context(), cmd.Flags(), registry.PodmanConfig(), migrateOptions)
if err != nil {
fmt.Println(err)
+
+ // FIXME change this to return the error like other commands
+ // defer will never run on os.Exit()
+ //nolint:gocritic
os.Exit(define.ExecErrorCodeGeneric)
}
os.Exit(0)
diff --git a/cmd/podman/system/renumber.go b/cmd/podman/system/renumber.go
index f24488822..e5a241a4f 100644
--- a/cmd/podman/system/renumber.go
+++ b/cmd/podman/system/renumber.go
@@ -56,6 +56,9 @@ func renumber(cmd *cobra.Command, args []string) {
err = engine.Renumber(registry.Context(), cmd.Flags(), registry.PodmanConfig())
if err != nil {
fmt.Println(err)
+ // FIXME change this to return the error like other commands
+ // defer will never run on os.Exit()
+ //nolint:gocritic
os.Exit(define.ExecErrorCodeGeneric)
}
os.Exit(0)
diff --git a/cmd/podman/system/reset.go b/cmd/podman/system/reset.go
index e8cf127b7..8f2e73375 100644
--- a/cmd/podman/system/reset.go
+++ b/cmd/podman/system/reset.go
@@ -81,7 +81,10 @@ func reset(cmd *cobra.Command, args []string) {
}
// Purge all the external containers with storage
- registry.ContainerEngine().ContainerRm(registry.Context(), listCtnIds, entities.RmOptions{Force: true, All: true, Ignore: true, Volumes: true})
+ _, err := registry.ContainerEngine().ContainerRm(registry.Context(), listCtnIds, entities.RmOptions{Force: true, All: true, Ignore: true, Volumes: true})
+ if err != nil {
+ logrus.Error(err)
+ }
// Shutdown all running engines, `reset` will hijack repository
registry.ContainerEngine().Shutdown(registry.Context())
registry.ImageEngine().Shutdown(registry.Context())
@@ -95,6 +98,9 @@ func reset(cmd *cobra.Command, args []string) {
if err := engine.Reset(registry.Context()); err != nil {
logrus.Error(err)
+ // FIXME change this to return the error like other commands
+ // defer will never run on os.Exit()
+ //nolint:gocritic
os.Exit(define.ExecErrorCodeGeneric)
}
os.Exit(0)
diff --git a/cmd/podman/system/version.go b/cmd/podman/system/version.go
index 9fb4a966a..7202b2c08 100644
--- a/cmd/podman/system/version.go
+++ b/cmd/podman/system/version.go
@@ -34,7 +34,7 @@ func init() {
formatFlagName := "format"
flags.StringVarP(&versionFormat, formatFlagName, "f", "", "Change the output format to JSON or a Go template")
- _ = versionCommand.RegisterFlagCompletionFunc(formatFlagName, common.AutocompleteFormat(entities.SystemVersionReport{}))
+ _ = versionCommand.RegisterFlagCompletionFunc(formatFlagName, common.AutocompleteFormat(&entities.SystemVersionReport{}))
}
func version(cmd *cobra.Command, args []string) error {
diff --git a/cmd/podman/utils/alias.go b/cmd/podman/utils/alias.go
index 4d5b625d0..b37d0f714 100644
--- a/cmd/podman/utils/alias.go
+++ b/cmd/podman/utils/alias.go
@@ -37,8 +37,7 @@ func AliasFlags(f *pflag.FlagSet, name string) pflag.NormalizedName {
// TimeoutAliasFlags is a function to handle backwards compatibility with old timeout flags
func TimeoutAliasFlags(f *pflag.FlagSet, name string) pflag.NormalizedName {
- switch name {
- case "timeout":
+ if name == "timeout" {
name = "time"
}
return pflag.NormalizedName(name)
diff --git a/cmd/podman/volumes/inspect.go b/cmd/podman/volumes/inspect.go
index 2230a2818..f21f9c233 100644
--- a/cmd/podman/volumes/inspect.go
+++ b/cmd/podman/volumes/inspect.go
@@ -41,7 +41,7 @@ func init() {
formatFlagName := "format"
flags.StringVarP(&inspectOpts.Format, formatFlagName, "f", "json", "Format volume output using Go template")
- _ = inspectCommand.RegisterFlagCompletionFunc(formatFlagName, common.AutocompleteFormat(define.InspectVolumeData{}))
+ _ = inspectCommand.RegisterFlagCompletionFunc(formatFlagName, common.AutocompleteFormat(&define.InspectVolumeData{}))
}
func volumeInspect(cmd *cobra.Command, args []string) error {
diff --git a/cmd/podman/volumes/list.go b/cmd/podman/volumes/list.go
index 2edf04097..c14cf08bd 100644
--- a/cmd/podman/volumes/list.go
+++ b/cmd/podman/volumes/list.go
@@ -11,7 +11,6 @@ import (
"github.com/containers/podman/v4/cmd/podman/parse"
"github.com/containers/podman/v4/cmd/podman/registry"
"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/pkg/errors"
"github.com/spf13/cobra"
@@ -57,7 +56,7 @@ func init() {
formatFlagName := "format"
flags.StringVar(&cliOpts.Format, formatFlagName, "{{.Driver}}\t{{.Name}}\n", "Format volume output using Go template")
- _ = lsCommand.RegisterFlagCompletionFunc(formatFlagName, common.AutocompleteFormat(define.InspectVolumeData{}))
+ _ = lsCommand.RegisterFlagCompletionFunc(formatFlagName, common.AutocompleteFormat(&entities.VolumeListReport{}))
flags.Bool("noheading", false, "Do not print headers")
flags.BoolVarP(&cliOpts.Quiet, "quiet", "q", false, "Print volume output in quiet mode")
diff --git a/contrib/cirrus/lib.sh b/contrib/cirrus/lib.sh
index 09a255e6f..0f02c166f 100644
--- a/contrib/cirrus/lib.sh
+++ b/contrib/cirrus/lib.sh
@@ -97,7 +97,7 @@ EPOCH_TEST_COMMIT="$CIRRUS_BASE_SHA"
# testing operations on all platforms and versions. This is necessary
# to avoid needlessly passing through global/system values across
# contexts, such as host->container or root->rootless user
-PASSTHROUGH_ENV_RE='(^CI.*)|(^CIRRUS)|(^DISTRO_NV)|(^GOPATH)|(^GOCACHE)|(^GOSRC)|(^SCRIPT_BASE)|(CGROUP_MANAGER)|(OCI_RUNTIME)|(^TEST.*)|(^PODBIN_NAME)|(^PRIV_NAME)|(^ALT_NAME)|(^ROOTLESS_USER)|(SKIP_USERNS)|(.*_NAME)|(.*_FQIN)'
+PASSTHROUGH_ENV_RE='(^CI.*)|(^CIRRUS)|(^DISTRO_NV)|(^GOPATH)|(^GOCACHE)|(^GOSRC)|(^SCRIPT_BASE)|(CGROUP_MANAGER)|(OCI_RUNTIME)|(^TEST.*)|(^PODBIN_NAME)|(^PRIV_NAME)|(^ALT_NAME)|(^ROOTLESS_USER)|(SKIP_USERNS)|(.*_NAME)|(.*_FQIN)|(NETWORK_BACKEND)'
# Unsafe env. vars for display
SECRET_ENV_RE='(ACCOUNT)|(GC[EP]..+)|(SSH)|(PASSWORD)|(TOKEN)'
@@ -169,10 +169,6 @@ setup_rootless() {
groupadd -g $rootless_gid $ROOTLESS_USER
useradd -g $rootless_gid -u $rootless_uid --no-user-group --create-home $ROOTLESS_USER
- # We also set up rootless user for image-scp tests (running as root)
- if [[ $PRIV_NAME = "rootless" ]]; then
- chown -R $ROOTLESS_USER:$ROOTLESS_USER "$GOPATH" "$GOSRC"
- fi
echo "$ROOTLESS_USER ALL=(root) NOPASSWD: ALL" > /etc/sudoers.d/ci-rootless
mkdir -p "$HOME/.ssh" "/home/$ROOTLESS_USER/.ssh"
@@ -216,20 +212,39 @@ setup_rootless() {
install_test_configs() {
msg "Installing ./test/registries.conf system-wide."
install -v -D -m 644 ./test/registries.conf /etc/containers/
- if [[ "$TEST_ENVIRON" =~ netavark ]]; then
- # belt-and-suspenders: any pre-existing CNI config. will spoil
- # default use tof netavark (when both are installed).
- rm -rf /etc/cni/net.d/*
- else
- echo "Installing cni config, policy and registry config"
- req_env_vars GOSRC SCRIPT_BASE
- cd $GOSRC || exit 1
- install -v -D -m 644 ./cni/87-podman-bridge.conflist /etc/cni/net.d/
- # This config must always sort last in the list of networks (podman picks first one
- # as the default). This config prevents allocation of network address space used
- # by default in google cloud. https://cloud.google.com/vpc/docs/vpc#ip-ranges
- install -v -D -m 644 $SCRIPT_BASE/99-do-not-use-google-subnets.conflist /etc/cni/net.d/
- fi
+}
+
+use_cni() {
+ msg "Unsetting NETWORK_BACKEND for all subsequent environments."
+ echo "export -n NETWORK_BACKEND" >> /etc/ci_environment
+ echo "unset NETWORK_BACKEND" >> /etc/ci_environment
+ export -n NETWORK_BACKEND
+ unset NETWORK_BACKEND
+ msg "Installing default CNI configuration"
+ cd $GOSRC || exit 1
+ rm -rvf /etc/cni/net.d
+ mkdir -p /etc/cni/net.d
+ install -v -D -m 644 ./cni/87-podman-bridge.conflist \
+ /etc/cni/net.d/
+ # This config must always sort last in the list of networks (podman picks
+ # first one as the default). This config prevents allocation of network
+ # address space used by default in google cloud.
+ # https://cloud.google.com/vpc/docs/vpc#ip-ranges
+ install -v -D -m 644 $SCRIPT_BASE/99-do-not-use-google-subnets.conflist \
+ /etc/cni/net.d/
+}
+
+use_netavark() {
+ msg "Forcing NETWORK_BACKEND=netavark for all subsequent environments."
+ echo "NETWORK_BACKEND=netavark" >> /etc/ci_environment
+ export NETWORK_BACKEND=netavark # needed for install_test_configs()
+ msg "Removing any/all CNI configuration"
+ rm -rvf /etc/cni/net.d/*
+
+ # TODO: Remove this when netavark/aardvark-dns development slows down
+ warn "Updating netavark/aardvark-dns to avoid frequent VM image rebuilds"
+ # N/B: This is coming from updates-testing repo in F36
+ lilto dnf update -y netavark aardvark-dns
}
# Remove all files provided by the distro version of podman.
diff --git a/contrib/cirrus/logcollector.sh b/contrib/cirrus/logcollector.sh
index 0cfbf7135..d712713b4 100755
--- a/contrib/cirrus/logcollector.sh
+++ b/contrib/cirrus/logcollector.sh
@@ -40,32 +40,34 @@ case $1 in
packages)
# These names are common to Fedora and Ubuntu
PKG_NAMES=(\
- conmon \
- containernetworking-plugins \
- containers-common \
- criu \
- crun \
- golang \
- podman \
- runc \
- skopeo \
- slirp4netns \
+ conmon
+ containernetworking-plugins
+ containers-common
+ criu
+ crun
+ golang
+ podman
+ runc
+ skopeo
+ slirp4netns
)
case $OS_RELEASE_ID in
fedora)
cat /etc/fedora-release
PKG_LST_CMD='rpm -q --qf=%{N}-%{V}-%{R}-%{ARCH}\n'
PKG_NAMES+=(\
- container-selinux \
- libseccomp \
+ aardvark
+ container-selinux
+ libseccomp
+ netavark
)
;;
ubuntu)
cat /etc/issue
PKG_LST_CMD='dpkg-query --show --showformat=${Package}-${Version}-${Architecture}\n'
PKG_NAMES+=(\
- cri-o-runc \
- libseccomp2 \
+ cri-o-runc
+ libseccomp2
)
;;
*) bad_os_id_ver ;;
@@ -74,19 +76,6 @@ case $1 in
echo "Cgroups: " $(stat -f -c %T /sys/fs/cgroup)
# Any not-present packages will be listed as such
$PKG_LST_CMD "${PKG_NAMES[@]}" | sort -u
-
- # TODO: Remove this once netavark/aardvark-dns packages are used
- if [[ "$TEST_ENVIRON" =~ netavark ]]; then
- _npath=/usr/local/libexec/podman/
- for name in netavark aardvark-dns; do
- echo "$name binary details:"
- if [[ -r "$_npath/${name}.info" ]]; then
- cat "$_npath/${name}.info"
- else
- echo "WARNING: $_npath/${name}.info not found."
- fi
- done
- fi
;;
time)
# Assumed to be empty/undefined outside of Cirrus-CI (.cirrus.yml)
diff --git a/contrib/cirrus/runner.sh b/contrib/cirrus/runner.sh
index 5d6ba9921..101270703 100755
--- a/contrib/cirrus/runner.sh
+++ b/contrib/cirrus/runner.sh
@@ -12,7 +12,7 @@ set -eo pipefail
# most notably:
#
# PODBIN_NAME : "podman" (i.e. local) or "remote"
-# TEST_ENVIRON : 'host', 'host-netavark', or 'container'; desired environment in which to run
+# TEST_ENVIRON : 'host', or 'container'; desired environment in which to run
# CONTAINER : 1 if *currently* running inside a container, 0 if host
#
@@ -449,6 +449,13 @@ if [[ "$PRIV_NAME" == "rootless" ]] && [[ "$UID" -eq 0 ]]; then
# https://github.com/containers/podman/issues/10857
rm -rf /var/lib/cni
+ # This must be done at the last second, otherwise `make` calls
+ # in setup_environment (as root) will balk about ownership.
+ msg "Recursively chowning \$GOPATH and \$GOSRC to $ROOTLESS_USER"
+ if [[ $PRIV_NAME = "rootless" ]]; then
+ chown -R $ROOTLESS_USER:$ROOTLESS_USER "$GOPATH" "$GOSRC"
+ fi
+
req_env_vars ROOTLESS_USER
msg "Re-executing runner through ssh as user '$ROOTLESS_USER'"
msg "************************************************************"
diff --git a/contrib/cirrus/setup_environment.sh b/contrib/cirrus/setup_environment.sh
index 742289733..e3eb46783 100755
--- a/contrib/cirrus/setup_environment.sh
+++ b/contrib/cirrus/setup_environment.sh
@@ -38,13 +38,12 @@ done
cp hack/podman-registry /bin
-# Make sure cni network plugins directory exists
-mkdir -p /etc/cni/net.d
-
# 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"
+# Bypass git safety/security checks when operating in a throwaway environment
+git config --system --add safe.directory $GOSRC
# Ensure that all lower-level contexts and child-processes have
# ready access to higher level orchestration (e.g Cirrus-CI)
@@ -84,13 +83,6 @@ case "$CG_FS_TYPE" in
else
echo "OCI_RUNTIME=runc" >> /etc/ci_environment
fi
-
- # As a general policy CGv1 + runc should coincide with the "older"
- # VM Images in CI. Verify this is the case.
- if [[ -n "$VM_IMAGE_NAME" ]] && [[ ! "$VM_IMAGE_NAME" =~ prior ]]
- then
- die "Most recent distro. version should never run with CGv1"
- fi
fi
;;
cgroup2fs)
@@ -99,13 +91,6 @@ case "$CG_FS_TYPE" in
# which uses runc as the default.
warn "Forcing testing with crun instead of runc"
echo "OCI_RUNTIME=crun" >> /etc/ci_environment
-
- # As a general policy CGv2 + crun should coincide with the "newer"
- # VM Images in CI. Verify this is the case.
- if [[ -n "$VM_IMAGE_NAME" ]] && [[ "$VM_IMAGE_NAME" =~ prior ]]
- then
- die "Least recent distro. version should never run with CGv2"
- fi
fi
;;
*) die_unknown CG_FS_TYPE
@@ -130,6 +115,19 @@ case "$OS_RELEASE_ID" in
msg "Enabling container_manage_cgroup"
setsebool container_manage_cgroup true
fi
+
+ # For release 36 and later, netavark/aardvark is the default
+ # networking stack for podman. All previous releases only have
+ # CNI networking available. Upgrading from one to the other is
+ # not supported at this time. Support execution of the upgrade
+ # tests in F36 and later, by disabling Netavark and enabling CNI.
+ if [[ "$OS_RELEASE_VER" -ge 36 ]] && \
+ [[ "$TEST_FLAVOR" != "upgrade_test" ]];
+ then
+ use_netavark
+ else # Fedora < 36, or upgrade testing.
+ use_cni
+ fi
;;
*) die_unknown OS_RELEASE_ID
esac
@@ -137,7 +135,7 @@ esac
# Required to be defined by caller: The environment where primary testing happens
# shellcheck disable=SC2154
case "$TEST_ENVIRON" in
- host*)
+ host)
# The e2e tests wrongly guess `--cgroup-manager` option
# shellcheck disable=SC2154
if [[ "$CG_FS_TYPE" == "cgroup2fs" ]] || [[ "$PRIV_NAME" == "root" ]]
@@ -148,43 +146,6 @@ case "$TEST_ENVIRON" in
warn "Forcing CGROUP_MANAGER=cgroupfs"
echo "CGROUP_MANAGER=cgroupfs" >> /etc/ci_environment
fi
- # TODO: For the foreseeable future, need to support running tests
- # with and without the latest netavark/aardvark. Once they're more
- # stable and widely supported in Fedora, they can be pre-installed
- # from its RPM at VM image build-time.
- if [[ "$TEST_ENVIRON" =~ netavark ]]; then
- for info in "netavark $NETAVARK_BRANCH $NETAVARK_URL $NETAVARK_DEBUG" \
- "aardvark-dns $AARDVARK_BRANCH $AARDVARK_URL $AARDVARK_DEBUG"; do
-
- read _name _branch _url _debug <<<"$info"
- req_env_vars _name _branch _url _debug
- msg "Downloading latest $_name from upstream branch '$_branch'"
- # Use identifiable archive filename in of a get_ci_env.sh environment
- curl --fail --location -o /tmp/$_name.zip "$_url"
-
- # Needs to be in a specific location
- # ref: https://github.com/containers/common/blob/main/pkg/config/config_linux.go#L39
- _pdir=/usr/local/libexec/podman
- mkdir -p $_pdir
- cd $_pdir
- msg "$PWD"
- unzip /tmp/$_name.zip
- if ((_debug)); then
- warn "Using debug $_name binary"
- mv $_name.debug $_name
- else
- rm $_name.debug
- fi
- chmod 0755 $_pdir/$_name
- cd -
- done
-
- restorecon -F -v $_nvdir
- # This is critical, it signals to all tests that netavark
- # use is expected.
- msg "Forcing NETWORK_BACKEND=netavark in all subsequent environments."
- echo "NETWORK_BACKEND=netavark" >> /etc/ci_environment
- fi
;;
container)
if ((CONTAINER==0)); then # not yet inside a container
@@ -345,6 +306,9 @@ case "$TEST_FLAVOR" in
# Guarantee the docker daemon can't be started, even by accident
rm -vf $(type -P dockerd)
+ msg "Recursively chowning source to $ROOTLESS_USER"
+ chown -R $ROOTLESS_USER:$ROOTLESS_USER "$GOPATH" "$GOSRC"
+
msg "Obtaining necessary gitlab-runner testing bits"
slug="gitlab.com/gitlab-org/gitlab-runner"
helper_fqin="registry.gitlab.com/gitlab-org/gitlab-runner/gitlab-runner-helper:x86_64-latest-pwsh"
diff --git a/docs/source/markdown/podman-history.1.md b/docs/source/markdown/podman-history.1.md
index af35814c2..16f1e48e6 100644
--- a/docs/source/markdown/podman-history.1.md
+++ b/docs/source/markdown/podman-history.1.md
@@ -23,10 +23,11 @@ Valid placeholders for the Go template are listed below:
| --------------- | ----------------------------------------------------------------------------- |
| .ID | Image ID |
| .Created | if --human, time elapsed since creation, otherwise time stamp of creation |
-| .CreatedBy | Command used to create the layer |
-| .Size | Size of layer on disk |
-| .Comment | Comment for the layer |
-
+| .CreatedAt | Time when the image layer was created |
+| .CreatedBy | Command used to create the layer |
+| .CreatedSince | Elapsed time since the image layer was created |
+| .Size | Size of layer on disk |
+| .Comment | Comment for the layer |
## OPTIONS
Print the numeric IDs only (default *false*).
diff --git a/docs/source/markdown/podman-machine-set.1.md b/docs/source/markdown/podman-machine-set.1.md
index a4918eacf..de90ee4b0 100644
--- a/docs/source/markdown/podman-machine-set.1.md
+++ b/docs/source/markdown/podman-machine-set.1.md
@@ -8,17 +8,29 @@ podman\-machine\-set - Sets a virtual machine setting
## DESCRIPTION
-Sets an updatable virtual machine setting.
-
-Options mirror values passed to `podman machine init`. Only a limited
-subset can be changed after machine initialization.
+Change a machine setting.
## OPTIONS
+#### **--cpus**=*number*
+
+Number of CPUs.
+Only supported for QEMU machines.
+
+#### **--disk-size**=*number*
+
+Size of the disk for the guest VM in GB.
+Can only be increased. Only supported for QEMU machines.
+
#### **--help**
Print usage statement.
+#### **--memory**, **-m**=*number*
+
+Memory (in MB).
+Only supported for QEMU machines.
+
#### **--rootful**=*true|false*
Whether this machine should prefer rootful (`true`) or rootless (`false`)
diff --git a/docs/source/markdown/podman-search.1.md b/docs/source/markdown/podman-search.1.md
index 81a67d762..5b49d7f8e 100644
--- a/docs/source/markdown/podman-search.1.md
+++ b/docs/source/markdown/podman-search.1.md
@@ -90,7 +90,7 @@ The result contains the Image name and its tag, one line for every tag associate
#### **--no-trunc**
-Do not truncate the output (default *true*).
+Do not truncate the output (default *false*).
#### **--tls-verify**
diff --git a/docs/source/markdown/podman-volume-create.1.md b/docs/source/markdown/podman-volume-create.1.md
index 365a5acac..06fadcaa1 100644
--- a/docs/source/markdown/podman-volume-create.1.md
+++ b/docs/source/markdown/podman-volume-create.1.md
@@ -38,7 +38,8 @@ The `device` option sets the device to be mounted, and is equivalent to the `dev
The `o` option sets options for the mount, and is equivalent to the `-o` flag to **mount(8)** with these exceptions:
- The `o` option supports `uid` and `gid` options to set the UID and GID of the created volume that are not normally supported by **mount(8)**.
- - The `o` option supports the `size` option to set the maximum size of the created volume and the `inodes` option to set the maximum number of inodes for the volume. Currently these flags are only supported on "xfs" file system mounted with the `prjquota` flag described in the **xfs_quota(8)** man page.
+ - The `o` option supports the `size` option to set the maximum size of the created volume, the `inodes` option to set the maximum number of inodes for the volume and `noquota` to completely disable quota support even for tracking of disk usage. Currently these flags are only supported on "xfs" file system mounted with the `prjquota` flag described in the **xfs_quota(8)** man page.
+ - The `o` option supports .
- Using volume options other then the UID/GID options with the **local** driver requires root privileges.
When not using the **local** driver, the given options are passed directly to the volume plugin. In this case, supported options are dictated by the plugin in question, not Podman.
diff --git a/go.mod b/go.mod
index d16f420be..3689cfcfb 100644
--- a/go.mod
+++ b/go.mod
@@ -9,7 +9,7 @@ require (
github.com/checkpoint-restore/checkpointctl v0.0.0-20220321135231-33f4a66335f0
github.com/checkpoint-restore/go-criu/v5 v5.3.0
github.com/container-orchestrated-devices/container-device-interface v0.4.0
- github.com/containernetworking/cni v1.0.1
+ github.com/containernetworking/cni v1.1.0
github.com/containernetworking/plugins v1.1.1
github.com/containers/buildah v1.25.2-0.20220423102655-8f2bb8876f3f
github.com/containers/common v0.47.5-0.20220425182415-4081e6be9356
@@ -29,7 +29,7 @@ require (
github.com/docker/go-plugins-helpers v0.0.0-20211224144127-6eecb7beb651
github.com/docker/go-units v0.4.0
github.com/dtylman/scp v0.0.0-20181017070807-f3000a34aef4
- github.com/fsnotify/fsnotify v1.5.3
+ github.com/fsnotify/fsnotify v1.5.4
github.com/ghodss/yaml v1.0.0
github.com/godbus/dbus/v5 v5.1.0
github.com/google/gofuzz v1.2.0
@@ -42,7 +42,6 @@ require (
github.com/json-iterator/go v1.1.12
github.com/mattn/go-isatty v0.0.14
github.com/moby/term v0.0.0-20210619224110-3f7ff695adc6
- github.com/mrunalp/fileutils v0.5.0
github.com/nxadm/tail v1.4.8
github.com/onsi/ginkgo v1.16.5
github.com/onsi/gomega v1.19.0
@@ -67,7 +66,7 @@ require (
go.etcd.io/bbolt v1.3.6
golang.org/x/crypto v0.0.0-20220411220226-7b82a4e95df4
golang.org/x/sync v0.0.0-20210220032951-036812b2e83c
- golang.org/x/sys v0.0.0-20220319134239-a9b59b0215f8
+ golang.org/x/sys v0.0.0-20220412211240-33da011f77ad
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211
golang.org/x/text v0.3.7
google.golang.org/protobuf v1.28.0
diff --git a/go.sum b/go.sum
index 9ed1c0e57..ab8d114fc 100644
--- a/go.sum
+++ b/go.sum
@@ -347,8 +347,9 @@ github.com/containerd/zfs v1.0.0/go.mod h1:m+m51S1DvAP6r3FcmYCp54bQ34pyOwTieQDNR
github.com/containernetworking/cni v0.7.1/go.mod h1:LGwApLUm2FpoOfxTDEeq8T9ipbpZ61X79hmU3w8FmsY=
github.com/containernetworking/cni v0.8.0/go.mod h1:LGwApLUm2FpoOfxTDEeq8T9ipbpZ61X79hmU3w8FmsY=
github.com/containernetworking/cni v0.8.1/go.mod h1:LGwApLUm2FpoOfxTDEeq8T9ipbpZ61X79hmU3w8FmsY=
-github.com/containernetworking/cni v1.0.1 h1:9OIL/sZmMYDBe+G8svzILAlulUpaDTUjeAbtH/JNLBo=
github.com/containernetworking/cni v1.0.1/go.mod h1:AKuhXbN5EzmD4yTNtfSsX3tPcmtrBI6QcRV0NiNt15Y=
+github.com/containernetworking/cni v1.1.0 h1:T00oIz4hef+/p9gpRZa57SnIN+QnbmAHBjbxaOSFo9U=
+github.com/containernetworking/cni v1.1.0/go.mod h1:sDpYKmGVENF3s6uvMvGgldDWeG8dMxakj/u+i9ht9vw=
github.com/containernetworking/plugins v0.8.6/go.mod h1:qnw5mN19D8fIwkqW7oHHYDHVlzhJpcY6TQxn/fUyDDM=
github.com/containernetworking/plugins v0.9.1/go.mod h1:xP/idU2ldlzN6m4p5LmGiwRDjeJr6FLK6vuiUwoH7P8=
github.com/containernetworking/plugins v1.0.1/go.mod h1:QHCfGpaTwYTbbH+nZXKVTxNBDZcxSOplJT5ico8/FLE=
@@ -512,8 +513,8 @@ github.com/frankban/quicktest v1.11.3/go.mod h1:wRf/ReqHper53s+kmmSZizM8NamnL3IM
github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo=
github.com/fsnotify/fsnotify v1.4.9/go.mod h1:znqG4EE+3YCdAaPaxE2ZRY/06pZUdp0tY4IgpuI1SZQ=
github.com/fsnotify/fsnotify v1.5.1/go.mod h1:T3375wBYaZdLLcVNkcVbzGHY7f1l/uK5T5Ai1i3InKU=
-github.com/fsnotify/fsnotify v1.5.3 h1:vNFpj2z7YIbwh2bw7x35sqYpp2wfuq+pivKbWG09B8c=
-github.com/fsnotify/fsnotify v1.5.3/go.mod h1:T3375wBYaZdLLcVNkcVbzGHY7f1l/uK5T5Ai1i3InKU=
+github.com/fsnotify/fsnotify v1.5.4 h1:jRbGcIw6P2Meqdwuo0H1p6JVLbL5DHKAKlYndzMwVZI=
+github.com/fsnotify/fsnotify v1.5.4/go.mod h1:OVB6XrOHzAwXMpEM7uPOzcehqUV2UqJxmVXmkdnm1bU=
github.com/fsouza/go-dockerclient v1.7.7/go.mod h1:njNCXvoZj3sLPjf3yO0DPHf1mdLdCPDYPc14GskKA4Y=
github.com/fsouza/go-dockerclient v1.7.10 h1:KIda66AP88BWQpyg+8ve9LQmn1ZZ/usCbmxeBoMth3U=
github.com/fsouza/go-dockerclient v1.7.10/go.mod h1:rdD3Eq3rHwMA8p/xrn+gLb+3ov7uRJGVkV1HsUFY39A=
@@ -1029,7 +1030,6 @@ github.com/morikuni/aec v1.0.0 h1:nP9CBfwrvYnBRgY6qfDQkygYDmYwOilePFkwzv4dU8A=
github.com/morikuni/aec v1.0.0/go.mod h1:BbKIizmSmc5MMPqRYbxO4ZU0S0+P200+tUnFx7PXmsc=
github.com/mozilla/scribe v0.0.0-20180711195314-fb71baf557c1/go.mod h1:FIczTrinKo8VaLxe6PWTPEXRXDIHz2QAwiaBaP5/4a8=
github.com/mozilla/tls-observatory v0.0.0-20210609171429-7bc42856d2e5/go.mod h1:FUqVoUPHSEdDR0MnFM3Dh8AU0pZHLXUD127SAJGER/s=
-github.com/mrunalp/fileutils v0.5.0 h1:NKzVxiH7eSk+OQ4M+ZYW1K6h27RUV3MI6NUTsHhU6Z4=
github.com/mrunalp/fileutils v0.5.0/go.mod h1:M1WthSahJixYnrXQl/DFQuteStB1weuxD2QJNHXfbSQ=
github.com/munnerz/goautoneg v0.0.0-20120707110453-a547fc61f48d/go.mod h1:+n7T8mK8HuQTcFwEeznm/DIxMOiR9yIdICNftLE1DvQ=
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822/go.mod h1:+n7T8mK8HuQTcFwEeznm/DIxMOiR9yIdICNftLE1DvQ=
@@ -1784,8 +1784,9 @@ golang.org/x/sys v0.0.0-20220114195835-da31bd327af9/go.mod h1:oPkhp1MJrh7nUepCBc
golang.org/x/sys v0.0.0-20220128215802-99c3d69c2c27/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220209214540-3681064d5158/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220227234510-4e6760a101f9/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
-golang.org/x/sys v0.0.0-20220319134239-a9b59b0215f8 h1:OH54vjqzRWmbJ62fjuhxy7AxFFgoHN0/DPc/UrL8cAs=
golang.org/x/sys v0.0.0-20220319134239-a9b59b0215f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
+golang.org/x/sys v0.0.0-20220412211240-33da011f77ad h1:ntjMns5wyP/fN65tdBD4g8J5w8n015+iIIs9rtjXkY0=
+golang.org/x/sys v0.0.0-20220412211240-33da011f77ad/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw=
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
golang.org/x/term v0.0.0-20210220032956-6a3ed077a48d/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
diff --git a/hack/buildah-vendor-treadmill b/hack/buildah-vendor-treadmill
index 1feffaa60..dddabef93 100755
--- a/hack/buildah-vendor-treadmill
+++ b/hack/buildah-vendor-treadmill
@@ -24,6 +24,10 @@ our $VERSION = '0.1';
###############################################################################
# BEGIN user-customizable section
+# Page describing this process in much more detail
+our $Docs_URL =
+ 'https://github.com/containers/podman/wiki/Buildah-Vendor-Treadmill';
+
# github path to buildah
our $Buildah = 'github.com/containers/buildah';
@@ -72,7 +76,7 @@ Call me with one of two options:
For latest documentation and best practices, please see:
- https://github.com/containers/podman/wiki/Buildah-Vendor-Treadmill
+ $Docs_URL
OPTIONS:
@@ -86,7 +90,8 @@ END_USAGE
# Command-line options. Note that this operates directly on @ARGV !
our %action;
our $debug = 0;
-our $force = 0;
+our $force_old_main = 0; # in --pick, proceeds even if main is old
+our $force_testing = 0; # in --sync, test even no podman/buildah changes
our $verbose = 0;
our $NOT = ''; # print "blahing the blah$NOT\n" if $debug
sub handle_opts {
@@ -95,9 +100,11 @@ sub handle_opts {
'sync' => sub { $action{sync}++ },
'pick' => sub { $action{pick}++ },
+ 'force-old-main' => \$force_old_main,
+ 'force-testing' => \$force_testing,
+
'debug!' => \$debug,
'dry-run|n!' => sub { $NOT = ' [NOT]' },
- 'force' => \$force,
'verbose|v' => \$verbose,
help => \&usage,
@@ -161,6 +168,13 @@ sub do_sync {
die "$ME: HEAD is a buildah commit, but HEAD^ is not a treadmill commit! Cannot continue.\n";
}
}
+ else {
+ # This can happen if a previous script run got interrupted before
+ # committing a new buildah; or when a new buildah has been vendored
+ # into podman and our go.mod version == latest on buildah.
+ warn "$ME: Warning: HEAD is not a buildah vendor commit; will try to continue anyway\n";
+ }
+
# HEAD must now be a treadmill commit
is_treadmill_commit('HEAD')
or die "$ME: HEAD is not a treadmill commit!\n";
@@ -168,7 +182,7 @@ sub do_sync {
# HEAD is now a change to buildah-tests. Now update main and rebase.
pull_main();
git('checkout', '-q', $current_branch);
- my $forkpoint = git('merge-base', '--fork-point', 'main');
+ my $forkpoint = git_forkpoint();
my $main_commit = git('rev-parse', 'main');
my $rebased;
if ($forkpoint eq $main_commit) {
@@ -195,6 +209,10 @@ sub do_sync {
or die "$ME: make vendor failed\n";
my $buildah_new = vendored_buildah();
print "-> buildah new = $buildah_new\n";
+
+ # Tweak .cirrus.yml so we run bud tests first. Fail fast.
+ tweak_cirrus_test_order();
+
git('commit', '-as', '-m', <<"END_COMMIT_MESSAGE");
[DO NOT MERGE] vendor in buildah \@ $buildah_new
@@ -208,10 +226,19 @@ END_COMMIT_MESSAGE
my $change_message = '';
if ($buildah_new eq $buildah_old) {
if (! $rebased) {
- progress("Nothing has changed (same buildah, same podman). Bye!");
- exit 0;
+ $change_message = "Nothing has changed (same buildah, same podman).";
+ if ($force_testing) {
+ $change_message .= " Testing anyway due to --force-testing.";
+ }
+ else {
+ progress($change_message);
+ progress("Not much point to testing this, but use --force-testing to continue.");
+ exit 0;
+ }
+ }
+ else {
+ $change_message = "Podman has bumped, but Buildah is unchanged. There's probably not much point to testing this.";
}
- $change_message = "Podman has bumped, but Buildah is unchanged. There's probably not much point to testing this.";
}
else {
my $samenew = ($rebased ? 'new' : 'same');
@@ -243,6 +270,58 @@ sub pull_main {
git('pull', '-r', git_upstream(), 'main');
}
+#############################
+# tweak_cirrus_test_order # Run bud tests first, to fail fast & early
+#############################
+sub tweak_cirrus_test_order {
+ my $cirrus_yml = '.cirrus.yml';
+ my $tmpfile = "$cirrus_yml.tmp.$$";
+ unlink $tmpfile;
+
+ progress("Tweaking test order in $cirrus_yml to run bud tests early");
+ open my $in, '<', $cirrus_yml
+ or do {
+ warn "$ME: Cannot read $cirrus_yml: $!\n";
+ warn "$ME: Will continue anyway\n";
+ return;
+ };
+ open my $out, '>'. $tmpfile
+ or die "$ME: Cannot create $tmpfile: $!\n";
+ my $current_task = '';
+ my $in_depend;
+ while (my $line = <$in>) {
+ chomp $line;
+ if ($line =~ /^(\S+)_task:$/) {
+ $current_task = $1;
+ undef $in_depend;
+ }
+ elsif ($line =~ /^(\s+)depends_on:$/) {
+ $in_depend = $1;
+ }
+ elsif ($in_depend && $line =~ /^($in_depend\s+-\s+)(\S+)/) {
+ if ($current_task eq 'buildah_bud_test') {
+ # Buildah bud test now depends on validate, so it runs early
+ $line = "${1}validate";
+ }
+ elsif ($2 eq 'validate' && $current_task ne 'success') {
+ # Other tests that relied on validate, now rely on bud instead
+ $line = "${1}buildah_bud_test";
+ }
+ }
+ else {
+ undef $in_depend;
+ }
+
+ print { $out } $line, "\n";
+ }
+ close $in;
+ close $out
+ or die "$ME: Error writing $tmpfile: $!\n";
+ chmod 0644 => $tmpfile;
+ rename $tmpfile => $cirrus_yml
+ or die "$ME: Could not rename $tmpfile: $!\n";
+}
+
############################
# build_and_check_podman # Run quick (local) sanity checks before pushing
############################
@@ -262,13 +341,41 @@ sub build_and_check_podman {
# the name of the directory created by the bud-tests script.
progress("Confirming that buildah-bud-tests patches still apply...");
system('rm -rf test-buildah-*');
- $errs += system('test/buildah-bud/run-buildah-bud-tests', '--no-test');
- # Clean up
- system('rm -rf test-buildah-*');
+ if (system('test/buildah-bud/run-buildah-bud-tests', '--no-test')) {
+ # Error
+ ++$errs;
+ warn "$ME: Leaving test-buildah- directory for you to investigate\n";
+ }
+ else {
+ # Patches apply cleanly. Clean up
+ system('rm -rf test-buildah-*');
+ }
return if !$errs;
- warn "$ME: Errors found. Please address, then add to HEAD^ commit\n";
- die " ...see $ME --help for more information.\n";
+ warn <<"END_WARN";
+$ME: Errors found. I have to stop now for you to fix them.
+ Your best bet now is:
+ 1) Find and fix whatever needs to be fixed; then
+ 2) git commit -am'fixme-fixme'; then
+ 3) git rebase -i main:
+ a) you are now in an editor window
+ b) move the new fixme-fixme commit up a line, to between the
+ 'buildah vendor treadmill' and 'vendor in buildah @ ...' lines
+ c) change 'pick' to 'squash' (or just 's')
+ d) save & quit to continue the rebase
+ e) back to a new editor window
+ f) change the commit message: remove fixme-fixme, add a description
+ of what you actually fixed. If possible, reference the PR (buildah
+ or podman) that introduced the failure
+ g) save & quit to continue the rebase
+
+ Now, for good measure, rerun this script.
+
+ For full documentation, refer to
+
+ $Docs_URL
+END_WARN
+ exit 1;
}
# END sync and its helpers
@@ -288,7 +395,11 @@ sub do_pick {
my $treadmill_pr = treadmill_pr();
my $treadmill_branch = "$ME/pr$treadmill_pr/tmp$$";
progress("Fetching treadmill PR $treadmill_pr into $treadmill_branch");
- git('fetch', git_upstream(), "pull/$treadmill_pr/head:$treadmill_branch");
+ git('fetch', '-q', git_upstream(), "pull/$treadmill_pr/head:$treadmill_branch");
+
+ # Compare merge bases of our branch and the treadmill one
+ progress("Checking merge bases");
+ check_merge_bases($treadmill_pr, $treadmill_branch);
# read buildah go.mod from it, and from current tree, and compare
my $buildah_on_treadmill = vendored_buildah($treadmill_branch);
@@ -309,7 +420,7 @@ sub do_pick {
build_and_check_podman();
- progress("Looks good! Please 'git commit --amend' before pushing.");
+ progress("Looks good! Please 'git commit --amend' and edit commit message before pushing.");
}
##################
@@ -383,6 +494,51 @@ END_QUERY
return $prs[0]{node}{number};
}
+#######################
+# check_merge_bases # It's OK if our branch is newer than treadmill
+#######################
+sub check_merge_bases {
+ my $treadmill_pr = shift; # e.g., 12345
+ my $treadmill_branch = shift; # e.g., b-v-p/pr12345/tmpNNN
+
+ # Fetch latest main, for accurate comparison
+ git('fetch', '-q', git_upstream(), 'main');
+
+ my $forkpoint_cur = git_forkpoint();
+ my $forkpoint_treadmill = git_forkpoint($treadmill_branch);
+
+ print "fork cur: $forkpoint_cur\nfork tm: $forkpoint_treadmill\n"
+ if $debug;
+ if ($forkpoint_cur eq $forkpoint_treadmill) {
+ progress("Nice. This branch is up-to-date wrt treadmill PR $treadmill_pr");
+ return;
+ }
+
+ # They differ.
+ if (git_is_ancestor($forkpoint_cur, $forkpoint_treadmill)) {
+ warn <<"END_WARN";
+$ME: treadmill PR $treadmill_pr is based on
+ a newer main than this branch. This means it might have
+ more up-to-date patches.
+
+END_WARN
+
+ if ($force_old_main) {
+ warn "$ME: Proceeding due to --force-old-main\n";
+ return;
+ }
+
+ # Cannot continue. Clean up side branch, and bail.
+ git('branch', '-D', $treadmill_branch);
+ warn "$ME: You might want to consider rebasing on latest main.\n";
+ warn "$ME: Aborting. Use --force-old-main to continue without rebasing.\n";
+ exit 1;
+ }
+ else {
+ progress("Your branch is based on a newer main than treadmill PR $treadmill_pr. This is usually OK.");
+ }
+}
+
#################
# cherry_pick # cherry-pick a commit, updating its commit message
#################
@@ -474,6 +630,25 @@ sub git_current_branch() {
return $b;
}
+###################
+# git_forkpoint # Hash at which branch (default: cur) branched from main
+###################
+sub git_forkpoint {
+ return git('merge-base', '--fork-point', 'main', @_);
+}
+
+#####################
+# git_is_ancestor # Is hash1 an ancestor of hash2?
+#####################
+sub git_is_ancestor {
+ # Use system(), not git(), because we don't want to abort on exit status
+ my $rc = system('git', 'merge-base', '--is-ancestor', @_);
+ die "$ME: Cannot continue\n" if $? > 256; # e.g., Not a valid object
+
+ # Translate shell 0/256 status to logical 1/0
+ return !$rc;
+}
+
##################
# git_upstream # Name of true github upstream
##################
diff --git a/libpod/container.go b/libpod/container.go
index 6e2b7f528..3e7ab7b0a 100644
--- a/libpod/container.go
+++ b/libpod/container.go
@@ -1180,7 +1180,7 @@ func (c *Container) Umask() string {
return c.config.Umask
}
-//Secrets return the secrets in the container
+// Secrets return the secrets in the container
func (c *Container) Secrets() []*ContainerSecret {
return c.config.Secrets
}
diff --git a/libpod/container_api.go b/libpod/container_api.go
index fe41998c0..a6fcf709d 100644
--- a/libpod/container_api.go
+++ b/libpod/container_api.go
@@ -229,8 +229,7 @@ func (c *Container) Kill(signal uint) error {
// This function returns when the attach finishes. It does not hold the lock for
// the duration of its runtime, only using it at the beginning to verify state.
func (c *Container) Attach(streams *define.AttachStreams, keys string, resize <-chan define.TerminalSize) error {
- switch c.LogDriver() {
- case define.PassthroughLogging:
+ if c.LogDriver() == define.PassthroughLogging {
return errors.Wrapf(define.ErrNoLogs, "this container is using the 'passthrough' log driver, cannot attach")
}
if !c.batched {
diff --git a/libpod/container_copy_linux.go b/libpod/container_copy_linux.go
index 91e712c74..7566fbb12 100644
--- a/libpod/container_copy_linux.go
+++ b/libpod/container_copy_linux.go
@@ -48,7 +48,11 @@ func (c *Container) copyFromArchive(path string, chown bool, rename map[string]s
if err != nil {
return nil, err
}
- unmount = func() { c.unmount(false) }
+ unmount = func() {
+ if err := c.unmount(false); err != nil {
+ logrus.Errorf("Failed to unmount container: %v", err)
+ }
+ }
}
if c.state.State == define.ContainerStateRunning {
@@ -117,7 +121,11 @@ func (c *Container) copyToArchive(path string, writer io.Writer) (func() error,
if err != nil {
return nil, err
}
- unmount = func() { c.unmount(false) }
+ unmount = func() {
+ if err := c.unmount(false); err != nil {
+ logrus.Errorf("Failed to unmount container: %v", err)
+ }
+ }
}
statInfo, resolvedRoot, resolvedPath, err := c.stat(mountPoint, path)
diff --git a/libpod/container_exec.go b/libpod/container_exec.go
index d782bebf8..c05e7fd94 100644
--- a/libpod/container_exec.go
+++ b/libpod/container_exec.go
@@ -817,16 +817,16 @@ func (c *Container) Exec(config *ExecConfig, streams *define.AttachStreams, resi
// Please be careful when using this function since it might temporarily unlock
// the container when os.RemoveAll($bundlePath) fails with ENOTEMPTY or EBUSY
// errors.
-func (c *Container) cleanupExecBundle(sessionID string) (Err error) {
+func (c *Container) cleanupExecBundle(sessionID string) (err error) {
path := c.execBundlePath(sessionID)
for attempts := 0; attempts < 50; attempts++ {
- Err = os.RemoveAll(path)
- if Err == nil || os.IsNotExist(Err) {
+ err = os.RemoveAll(path)
+ if err == nil || os.IsNotExist(err) {
return nil
}
- if pathErr, ok := Err.(*os.PathError); ok {
- Err = pathErr.Err
- if errors.Cause(Err) == unix.ENOTEMPTY || errors.Cause(Err) == unix.EBUSY {
+ if pathErr, ok := err.(*os.PathError); ok {
+ err = pathErr.Err
+ if errors.Cause(err) == unix.ENOTEMPTY || errors.Cause(err) == unix.EBUSY {
// give other processes a chance to use the container
if !c.batched {
if err := c.save(); err != nil {
diff --git a/libpod/container_internal_linux.go b/libpod/container_internal_linux.go
index 9f8b7c686..4742b22ab 100644
--- a/libpod/container_internal_linux.go
+++ b/libpod/container_internal_linux.go
@@ -505,8 +505,7 @@ func (c *Container) generateSpec(ctx context.Context) (*spec.Spec, error) {
}
for _, o := range namedVol.Options {
- switch o {
- case "U":
+ if o == "U" {
if err := c.ChangeHostPathOwnership(mountPoint, true, int(hostUID), int(hostGID)); err != nil {
return nil, err
}
@@ -596,8 +595,7 @@ func (c *Container) generateSpec(ctx context.Context) (*spec.Spec, error) {
// Check overlay volume options
for _, o := range overlayVol.Options {
- switch o {
- case "U":
+ if o == "U" {
if err := c.ChangeHostPathOwnership(overlayVol.Source, true, int(hostUID), int(hostGID)); err != nil {
return nil, err
}
@@ -1182,7 +1180,11 @@ func (c *Container) createCheckpointImage(ctx context.Context, options Container
return err
}
// Clean-up buildah working container
- defer importBuilder.Delete()
+ defer func() {
+ if err := importBuilder.Delete(); err != nil {
+ logrus.Errorf("Image builder delete failed: %v", err)
+ }
+ }()
if err := c.prepareCheckpointExport(); err != nil {
return err
@@ -1203,7 +1205,9 @@ func (c *Container) createCheckpointImage(ctx context.Context, options Container
// Copy checkpoint from temporary tar file in the image
addAndCopyOptions := buildah.AddAndCopyOptions{}
- importBuilder.Add("", true, addAndCopyOptions, options.TargetFile)
+ if err := importBuilder.Add("", true, addAndCopyOptions, options.TargetFile); err != nil {
+ return err
+ }
if err := c.addCheckpointImageMetadata(importBuilder); err != nil {
return err
@@ -1545,7 +1549,11 @@ func (c *Container) importCheckpointImage(ctx context.Context, imageID string) e
}
mountPoint, err := img.Mount(ctx, nil, "")
- defer img.Unmount(true)
+ defer func() {
+ if err := c.unmount(true); err != nil {
+ logrus.Errorf("Failed to unmount container: %v", err)
+ }
+ }()
if err != nil {
return err
}
@@ -2115,15 +2123,9 @@ func (c *Container) makeBindMounts() error {
}
} else {
if !c.config.UseImageResolvConf {
- newResolv, err := c.generateResolvConf()
- if err != nil {
+ if err := c.generateResolvConf(); err != nil {
return errors.Wrapf(err, "error creating resolv.conf for container %s", c.ID())
}
- err = c.mountIntoRootDirs("/etc/resolv.conf", newResolv)
-
- if err != nil {
- return errors.Wrapf(err, "error assigning mounts to container %s", c.ID())
- }
}
if !c.config.UseImageHosts {
@@ -2144,11 +2146,9 @@ func (c *Container) makeBindMounts() error {
return err
}
}
- } else {
- if !c.config.UseImageHosts && c.state.BindMounts["/etc/hosts"] == "" {
- if err := c.createHosts(); err != nil {
- return errors.Wrapf(err, "error creating hosts file for container %s", c.ID())
- }
+ } else if !c.config.UseImageHosts && c.state.BindMounts["/etc/hosts"] == "" {
+ if err := c.createHosts(); err != nil {
+ return errors.Wrapf(err, "error creating hosts file for container %s", c.ID())
}
}
@@ -2267,7 +2267,7 @@ rootless=%d
base := "/run/secrets"
if secret.Target != "" {
secretFileName = secret.Target
- //If absolute path for target given remove base.
+ // If absolute path for target given remove base.
if filepath.IsAbs(secretFileName) {
base = ""
}
@@ -2282,23 +2282,25 @@ rootless=%d
}
// generateResolvConf generates a containers resolv.conf
-func (c *Container) generateResolvConf() (string, error) {
+func (c *Container) generateResolvConf() error {
var (
nameservers []string
networkNameServers []string
networkSearchDomains []string
)
+ hostns := true
resolvConf := "/etc/resolv.conf"
for _, namespace := range c.config.Spec.Linux.Namespaces {
if namespace.Type == spec.NetworkNamespace {
+ hostns = false
if namespace.Path != "" && !strings.HasPrefix(namespace.Path, "/proc/") {
definedPath := filepath.Join("/etc/netns", filepath.Base(namespace.Path), "resolv.conf")
_, err := os.Stat(definedPath)
if err == nil {
resolvConf = definedPath
} else if !os.IsNotExist(err) {
- return "", err
+ return err
}
}
break
@@ -2308,17 +2310,17 @@ func (c *Container) generateResolvConf() (string, error) {
contents, err := ioutil.ReadFile(resolvConf)
// resolv.conf doesn't have to exists
if err != nil && !os.IsNotExist(err) {
- return "", err
+ return err
}
ns := resolvconf.GetNameservers(contents)
// check if systemd-resolved is used, assume it is used when 127.0.0.53 is the only nameserver
- if len(ns) == 1 && ns[0] == "127.0.0.53" {
+ if !hostns && len(ns) == 1 && ns[0] == "127.0.0.53" {
// read the actual resolv.conf file for systemd-resolved
resolvedContents, err := ioutil.ReadFile("/run/systemd/resolve/resolv.conf")
if err != nil {
if !os.IsNotExist(err) {
- return "", errors.Wrapf(err, "detected that systemd-resolved is in use, but could not locate real resolv.conf")
+ return errors.Wrapf(err, "detected that systemd-resolved is in use, but could not locate real resolv.conf")
}
} else {
contents = resolvedContents
@@ -2341,31 +2343,31 @@ func (c *Container) generateResolvConf() (string, error) {
ipv6, err := c.checkForIPv6(netStatus)
if err != nil {
- return "", err
+ return err
}
// Ensure that the container's /etc/resolv.conf is compatible with its
// network configuration.
- resolv, err := resolvconf.FilterResolvDNS(contents, ipv6, c.config.CreateNetNS)
+ resolv, err := resolvconf.FilterResolvDNS(contents, ipv6, !hostns)
if err != nil {
- return "", errors.Wrapf(err, "error parsing host resolv.conf")
+ return errors.Wrapf(err, "error parsing host resolv.conf")
}
- dns := make([]net.IP, 0, len(c.runtime.config.Containers.DNSServers))
+ dns := make([]net.IP, 0, len(c.runtime.config.Containers.DNSServers)+len(c.config.DNSServer))
for _, i := range c.runtime.config.Containers.DNSServers {
result := net.ParseIP(i)
if result == nil {
- return "", errors.Wrapf(define.ErrInvalidArg, "invalid IP address %s", i)
+ return errors.Wrapf(define.ErrInvalidArg, "invalid IP address %s", i)
}
dns = append(dns, result)
}
- dnsServers := append(dns, c.config.DNSServer...)
+ dns = append(dns, c.config.DNSServer...)
// If the user provided dns, it trumps all; then dns masq; then resolv.conf
var search []string
switch {
- case len(dnsServers) > 0:
+ case len(dns) > 0:
// We store DNS servers as net.IP, so need to convert to string
- for _, server := range dnsServers {
+ for _, server := range dns {
nameservers = append(nameservers, server.String())
}
default:
@@ -2406,20 +2408,15 @@ func (c *Container) generateResolvConf() (string, error) {
destPath := filepath.Join(c.state.RunDir, "resolv.conf")
if err := os.Remove(destPath); err != nil && !os.IsNotExist(err) {
- return "", errors.Wrapf(err, "container %s", c.ID())
+ return errors.Wrapf(err, "container %s", c.ID())
}
// Build resolv.conf
if _, err = resolvconf.Build(destPath, nameservers, search, options); err != nil {
- return "", errors.Wrapf(err, "error building resolv.conf for container %s", c.ID())
+ return errors.Wrapf(err, "error building resolv.conf for container %s", c.ID())
}
- // Relabel resolv.conf for the container
- if err := c.relabel(destPath, c.config.MountLabel, true); err != nil {
- return "", err
- }
-
- return destPath, nil
+ return c.bindMountRootFile(destPath, "/etc/resolv.conf")
}
// Check if a container uses IPv6.
@@ -2594,17 +2591,21 @@ func (c *Container) createHosts() error {
return err
}
- if err := os.Chown(targetFile, c.RootUID(), c.RootGID()); err != nil {
+ return c.bindMountRootFile(targetFile, config.DefaultHostsFile)
+}
+
+// bindMountRootFile will chown and relabel the source file to make it usable in the container.
+// It will also add the path to the container bind mount map.
+// source is the path on the host, dest is the path in the container.
+func (c *Container) bindMountRootFile(source, dest string) error {
+ if err := os.Chown(source, c.RootUID(), c.RootGID()); err != nil {
return err
}
- if err := label.Relabel(targetFile, c.MountLabel(), false); err != nil {
+ if err := label.Relabel(source, c.MountLabel(), false); err != nil {
return err
}
- if err = c.mountIntoRootDirs(config.DefaultHostsFile, targetFile); err != nil {
- return err
- }
- return nil
+ return c.mountIntoRootDirs(dest, source)
}
// generateGroupEntry generates an entry or entries into /etc/group as
@@ -2890,11 +2891,11 @@ func (c *Container) generateUserPasswdEntry(addedUID int) (string, error) {
func (c *Container) passwdEntry(username string, uid, gid, name, homeDir string) string {
s := c.config.PasswdEntry
- s = strings.Replace(s, "$USERNAME", username, -1)
- s = strings.Replace(s, "$UID", uid, -1)
- s = strings.Replace(s, "$GID", gid, -1)
- s = strings.Replace(s, "$NAME", name, -1)
- s = strings.Replace(s, "$HOME", homeDir, -1)
+ s = strings.ReplaceAll(s, "$USERNAME", username)
+ s = strings.ReplaceAll(s, "$UID", uid)
+ s = strings.ReplaceAll(s, "$GID", gid)
+ s = strings.ReplaceAll(s, "$NAME", name)
+ s = strings.ReplaceAll(s, "$HOME", homeDir)
return s + "\n"
}
diff --git a/libpod/container_stat_linux.go b/libpod/container_stat_linux.go
index 9e225de2e..bbe3edbb3 100644
--- a/libpod/container_stat_linux.go
+++ b/libpod/container_stat_linux.go
@@ -94,15 +94,16 @@ func (c *Container) stat(containerMountPoint string, containerPath string) (*def
}
}
- if statInfo.IsSymlink {
+ switch {
+ case statInfo.IsSymlink:
// Symlinks are already evaluated and always relative to the
// container's mount point.
absContainerPath = statInfo.ImmediateTarget
- } else if strings.HasPrefix(resolvedPath, containerMountPoint) {
+ case strings.HasPrefix(resolvedPath, containerMountPoint):
// If the path is on the container's mount point, strip it off.
absContainerPath = strings.TrimPrefix(resolvedPath, containerMountPoint)
absContainerPath = filepath.Join("/", absContainerPath)
- } else {
+ default:
// No symlink and not on the container's mount point, so let's
// move it back to the original input. It must have evaluated
// to a volume or bind mount but we cannot return host paths.
diff --git a/libpod/define/annotations.go b/libpod/define/annotations.go
index a83fbff0b..8f5279981 100644
--- a/libpod/define/annotations.go
+++ b/libpod/define/annotations.go
@@ -135,6 +135,8 @@ const (
// creating a checkpoint image to specify the name of host distribution on
// which the checkpoint was created.
CheckpointAnnotationDistributionName = "io.podman.annotations.checkpoint.distribution.name"
+ // MaxKubeAnnotation is the max length of annotations allowed by Kubernetes.
+ MaxKubeAnnotation = 63
)
// IsReservedAnnotation returns true if the specified value corresponds to an
diff --git a/libpod/define/container_inspect.go b/libpod/define/container_inspect.go
index ae2ce9724..6cdffb8b7 100644
--- a/libpod/define/container_inspect.go
+++ b/libpod/define/container_inspect.go
@@ -100,7 +100,7 @@ type InspectRestartPolicy struct {
// InspectLogConfig holds information about a container's configured log driver
type InspectLogConfig struct {
Type string `json:"Type"`
- Config map[string]string `json:"Config"` //idk type, TODO
+ Config map[string]string `json:"Config"`
// Path specifies a path to the log file
Path string `json:"Path"`
// Tag specifies a custom log tag for the container
@@ -680,7 +680,7 @@ type InspectContainerData struct {
SizeRootFs int64 `json:"SizeRootFs,omitempty"`
Mounts []InspectMount `json:"Mounts"`
Dependencies []string `json:"Dependencies"`
- NetworkSettings *InspectNetworkSettings `json:"NetworkSettings"` //TODO
+ NetworkSettings *InspectNetworkSettings `json:"NetworkSettings"`
Namespace string `json:"Namespace"`
IsInfra bool `json:"IsInfra"`
Config *InspectContainerConfig `json:"Config"`
diff --git a/libpod/define/info.go b/libpod/define/info.go
index 48ad51c22..713129ada 100644
--- a/libpod/define/info.go
+++ b/libpod/define/info.go
@@ -12,7 +12,7 @@ type Info struct {
Version Version `json:"version"`
}
-//HostInfo describes the libpod host
+// HostInfo describes the libpod host
type SecurityInfo struct {
AppArmorEnabled bool `json:"apparmorEnabled"`
DefaultCapabilities string `json:"capabilities"`
diff --git a/libpod/kube.go b/libpod/kube.go
index eb62643fe..5a5fe9d35 100644
--- a/libpod/kube.go
+++ b/libpod/kube.go
@@ -10,6 +10,7 @@ import (
"strconv"
"strings"
"time"
+ "unicode/utf8"
"github.com/containers/common/libnetwork/types"
"github.com/containers/common/pkg/config"
@@ -220,7 +221,7 @@ func ConvertV1PodToYAMLPod(pod *v1.Pod) *YAMLPod {
cs = append(cs, &YAMLContainer{Container: cc, Resources: res})
}
mpo := &YAMLPod{Pod: *pod}
- mpo.Spec = &YAMLPodSpec{PodSpec: (*pod).Spec, Containers: cs}
+ mpo.Spec = &YAMLPodSpec{PodSpec: pod.Spec, Containers: cs}
for _, ctr := range pod.Spec.Containers {
if ctr.SecurityContext == nil || ctr.SecurityContext.SELinuxOptions == nil {
continue
@@ -288,6 +289,16 @@ func newServicePortState() servicePortState {
}
}
+func TruncateKubeAnnotation(str string) string {
+ str = strings.TrimSpace(str)
+ if utf8.RuneCountInString(str) < define.MaxKubeAnnotation {
+ return str
+ }
+ trunc := string([]rune(str)[:define.MaxKubeAnnotation])
+ logrus.Warnf("Truncation Annotation: %q to %q: Kubernetes only allows %d characters", str, trunc, define.MaxKubeAnnotation)
+ return trunc
+}
+
// containerPortsToServicePorts takes a slice of containerports and generates a
// slice of service ports
func (state *servicePortState) containerPortsToServicePorts(containerPorts []v1.ContainerPort) ([]v1.ServicePort, error) {
@@ -348,11 +359,13 @@ func (p *Pod) podWithContainers(ctx context.Context, containers []*Container, po
for _, ctr := range containers {
if !ctr.IsInfra() {
+ for k, v := range ctr.config.Spec.Annotations {
+ podAnnotations[fmt.Sprintf("%s/%s", k, removeUnderscores(ctr.Name()))] = TruncateKubeAnnotation(v)
+ }
// Convert auto-update labels into kube annotations
- for k, v := range getAutoUpdateAnnotations(removeUnderscores(ctr.Name()), ctr.Labels()) {
- podAnnotations[k] = v
+ for k, v := range getAutoUpdateAnnotations(ctr.Name(), ctr.Labels()) {
+ podAnnotations[k] = TruncateKubeAnnotation(v)
}
-
isInit := ctr.IsInitCtr()
ctr, volumes, _, annotations, err := containerToV1Container(ctx, ctr)
@@ -360,7 +373,7 @@ func (p *Pod) podWithContainers(ctx context.Context, containers []*Container, po
return nil, err
}
for k, v := range annotations {
- podAnnotations[define.BindMountPrefix+k] = strings.TrimSpace(v)
+ podAnnotations[define.BindMountPrefix+k] = TruncateKubeAnnotation(v)
}
// Since port bindings for the pod are handled by the
// infra container, wipe them here.
@@ -466,10 +479,14 @@ func simplePodWithV1Containers(ctx context.Context, ctrs []*Container) (*v1.Pod,
kubeAnnotations := make(map[string]string)
ctrNames := make([]string, 0, len(ctrs))
for _, ctr := range ctrs {
- ctrNames = append(ctrNames, strings.ReplaceAll(ctr.Name(), "_", ""))
+ ctrNames = append(ctrNames, removeUnderscores(ctr.Name()))
+ for k, v := range ctr.config.Spec.Annotations {
+ kubeAnnotations[fmt.Sprintf("%s/%s", k, removeUnderscores(ctr.Name()))] = TruncateKubeAnnotation(v)
+ }
+
// Convert auto-update labels into kube annotations
- for k, v := range getAutoUpdateAnnotations(removeUnderscores(ctr.Name()), ctr.Labels()) {
- kubeAnnotations[k] = v
+ for k, v := range getAutoUpdateAnnotations(ctr.Name(), ctr.Labels()) {
+ kubeAnnotations[k] = TruncateKubeAnnotation(v)
}
isInit := ctr.IsInitCtr()
@@ -482,7 +499,7 @@ func simplePodWithV1Containers(ctx context.Context, ctrs []*Container) (*v1.Pod,
return nil, err
}
for k, v := range annotations {
- kubeAnnotations[define.BindMountPrefix+k] = strings.TrimSpace(v)
+ kubeAnnotations[define.BindMountPrefix+k] = TruncateKubeAnnotation(v)
}
if isInit {
kubeInitCtrs = append(kubeInitCtrs, kubeCtr)
@@ -523,11 +540,11 @@ func simplePodWithV1Containers(ctx context.Context, ctrs []*Container) (*v1.Pod,
}
} // end if ctrDNS
}
- podName := strings.ReplaceAll(ctrs[0].Name(), "_", "")
+ podName := removeUnderscores(ctrs[0].Name())
// Check if the pod name and container name will end up conflicting
// Append -pod if so
if util.StringInSlice(podName, ctrNames) {
- podName = podName + "-pod"
+ podName += "-pod"
}
return newPodObject(
@@ -633,7 +650,7 @@ func containerToV1Container(ctx context.Context, c *Container) (v1.Container, []
kubeContainer.Ports = ports
// This should not be applicable
- //container.EnvFromSource =
+ // container.EnvFromSource =
kubeContainer.SecurityContext = kubeSec
kubeContainer.StdinOnce = false
kubeContainer.TTY = c.config.Spec.Process.Terminal
@@ -885,7 +902,7 @@ func convertVolumePathToName(hostSourcePath string) (string, error) {
}
// First, trim trailing slashes, then replace slashes with dashes.
// Thus, /mnt/data/ will become mnt-data
- return strings.Replace(strings.Trim(hostSourcePath, "/"), "/", "-", -1), nil
+ return strings.ReplaceAll(strings.Trim(hostSourcePath, "/"), "/", "-"), nil
}
func determineCapAddDropFromCapabilities(defaultCaps, containerCaps []string) *v1.Capabilities {
@@ -927,14 +944,20 @@ func capAddDrop(caps *specs.LinuxCapabilities) (*v1.Capabilities, error) {
if err != nil {
return nil, err
}
+
+ defCaps := g.Config.Process.Capabilities
// Combine all the default capabilities into a slice
- defaultCaps := append(g.Config.Process.Capabilities.Ambient, g.Config.Process.Capabilities.Bounding...)
- defaultCaps = append(defaultCaps, g.Config.Process.Capabilities.Effective...)
- defaultCaps = append(defaultCaps, g.Config.Process.Capabilities.Inheritable...)
- defaultCaps = append(defaultCaps, g.Config.Process.Capabilities.Permitted...)
+ defaultCaps := make([]string, 0, len(defCaps.Ambient)+len(defCaps.Bounding)+len(defCaps.Effective)+len(defCaps.Inheritable)+len(defCaps.Permitted))
+ defaultCaps = append(defaultCaps, defCaps.Ambient...)
+ defaultCaps = append(defaultCaps, defCaps.Bounding...)
+ defaultCaps = append(defaultCaps, defCaps.Effective...)
+ defaultCaps = append(defaultCaps, defCaps.Inheritable...)
+ defaultCaps = append(defaultCaps, defCaps.Permitted...)
// Combine all the container's capabilities into a slice
- containerCaps := append(caps.Ambient, caps.Bounding...)
+ containerCaps := make([]string, 0, len(caps.Ambient)+len(caps.Bounding)+len(caps.Effective)+len(caps.Inheritable)+len(caps.Permitted))
+ containerCaps = append(containerCaps, caps.Ambient...)
+ containerCaps = append(containerCaps, caps.Bounding...)
containerCaps = append(containerCaps, caps.Effective...)
containerCaps = append(containerCaps, caps.Inheritable...)
containerCaps = append(containerCaps, caps.Permitted...)
@@ -1011,7 +1034,11 @@ func generateKubeSecurityContext(c *Container) (*v1.SecurityContext, error) {
if err != nil {
return nil, errors.Wrapf(err, "failed to mount %s mountpoint", c.ID())
}
- defer c.unmount(false)
+ defer func() {
+ if err := c.unmount(false); err != nil {
+ logrus.Errorf("Failed to unmount container: %v", err)
+ }
+ }()
}
logrus.Debugf("Looking in container for user: %s", c.User())
@@ -1042,7 +1069,7 @@ func generateKubeVolumeDeviceFromLinuxDevice(devices []specs.LinuxDevice) []v1.V
}
func removeUnderscores(s string) string {
- return strings.Replace(s, "_", "", -1)
+ return strings.ReplaceAll(s, "_", "")
}
// getAutoUpdateAnnotations searches for auto-update container labels
@@ -1051,12 +1078,13 @@ func getAutoUpdateAnnotations(ctrName string, ctrLabels map[string]string) map[s
autoUpdateLabel := "io.containers.autoupdate"
annotations := make(map[string]string)
+ ctrName = removeUnderscores(ctrName)
for k, v := range ctrLabels {
if strings.Contains(k, autoUpdateLabel) {
// since labels can variate between containers within a pod, they will be
// identified with the container name when converted into kube annotations
kc := fmt.Sprintf("%s/%s", k, ctrName)
- annotations[kc] = v
+ annotations[kc] = TruncateKubeAnnotation(v)
}
}
diff --git a/libpod/logs/log.go b/libpod/logs/log.go
index 0eb3bb922..4d7d5ac58 100644
--- a/libpod/logs/log.go
+++ b/libpod/logs/log.go
@@ -28,7 +28,7 @@ const (
// FullLogType signifies a log line is full
FullLogType = "F"
- //ANSIEscapeResetCode is a code that resets all colors and text effects
+ // ANSIEscapeResetCode is a code that resets all colors and text effects
ANSIEscapeResetCode = "\033[0m"
)
@@ -167,7 +167,7 @@ func getTailLog(path string, tail int) ([]*LogLine, error) {
return tailLog, nil
}
-//getColor returns a ANSI escape code for color based on the colorID
+// getColor returns a ANSI escape code for color based on the colorID
func getColor(colorID int64) string {
colors := map[int64]string{
0: "\033[37m", // Light Gray
diff --git a/libpod/networking_linux.go b/libpod/networking_linux.go
index a312f5a0c..0c124cf0b 100644
--- a/libpod/networking_linux.go
+++ b/libpod/networking_linux.go
@@ -488,7 +488,7 @@ func (r *Runtime) GetRootlessNetNs(new bool) (*RootlessNetNS, error) {
pid := strconv.Itoa(cmd.Process.Pid)
err = ioutil.WriteFile(filepath.Join(rootlessNetNsDir, rootlessNetNsSilrp4netnsPidFile), []byte(pid), 0700)
if err != nil {
- errors.Wrap(err, "unable to write rootless-netns slirp4netns pid file")
+ return nil, errors.Wrap(err, "unable to write rootless-netns slirp4netns pid file")
}
defer func() {
@@ -579,7 +579,7 @@ func (r *Runtime) GetRootlessNetNs(new bool) (*RootlessNetNS, error) {
// lets add /usr/sbin to $PATH ourselves.
path = os.Getenv("PATH")
if !strings.Contains(path, "/usr/sbin") {
- path = path + ":/usr/sbin"
+ path += ":/usr/sbin"
os.Setenv("PATH", path)
}
@@ -1148,7 +1148,7 @@ func resultToBasicNetworkConfig(result types.StatusBlock) define.InspectBasicNet
for _, netAddress := range netInt.Subnets {
size, _ := netAddress.IPNet.Mask.Size()
if netAddress.IPNet.IP.To4() != nil {
- //ipv4
+ // ipv4
if config.IPAddress == "" {
config.IPAddress = netAddress.IPNet.IP.String()
config.IPPrefixLen = size
@@ -1157,7 +1157,7 @@ func resultToBasicNetworkConfig(result types.StatusBlock) define.InspectBasicNet
config.SecondaryIPAddresses = append(config.SecondaryIPAddresses, define.Address{Addr: netAddress.IPNet.IP.String(), PrefixLength: size})
}
} else {
- //ipv6
+ // ipv6
if config.GlobalIPv6Address == "" {
config.GlobalIPv6Address = netAddress.IPNet.IP.String()
config.GlobalIPv6PrefixLen = size
@@ -1508,7 +1508,7 @@ func ocicniPortsToNetTypesPorts(ports []types.OCICNIPortMapping) []types.PortMap
ports[i].Protocol == currentPort.Protocol &&
ports[i].HostPort-int32(currentPort.Range) == int32(currentPort.HostPort) &&
ports[i].ContainerPort-int32(currentPort.Range) == int32(currentPort.ContainerPort) {
- currentPort.Range = currentPort.Range + 1
+ currentPort.Range++
} else {
newPorts = append(newPorts, currentPort)
currentPort = types.PortMapping{
diff --git a/libpod/networking_machine.go b/libpod/networking_machine.go
index 73089c474..7b8eb94df 100644
--- a/libpod/networking_machine.go
+++ b/libpod/networking_machine.go
@@ -33,9 +33,9 @@ type machineExpose struct {
func requestMachinePorts(expose bool, ports []types.PortMapping) error {
url := "http://" + machineGvproxyEndpoint + "/services/forwarder/"
if expose {
- url = url + "expose"
+ url += "expose"
} else {
- url = url + "unexpose"
+ url += "unexpose"
}
ctx := context.Background()
client := &http.Client{
diff --git a/libpod/networking_slirp4netns.go b/libpod/networking_slirp4netns.go
index 4a0ef0b3a..788834435 100644
--- a/libpod/networking_slirp4netns.go
+++ b/libpod/networking_slirp4netns.go
@@ -82,7 +82,9 @@ func checkSlirpFlags(path string) (*slirpFeatures, error) {
}
func parseSlirp4netnsNetworkOptions(r *Runtime, extraOptions []string) (*slirp4netnsNetworkOptions, error) {
- slirpOptions := append(r.config.Engine.NetworkCmdOptions, extraOptions...)
+ slirpOptions := make([]string, 0, len(r.config.Engine.NetworkCmdOptions)+len(extraOptions))
+ slirpOptions = append(slirpOptions, r.config.Engine.NetworkCmdOptions...)
+ slirpOptions = append(slirpOptions, extraOptions...)
slirp4netnsOpts := &slirp4netnsNetworkOptions{
// overwrite defaults
disableHostLoopback: true,
diff --git a/libpod/oci_attach_linux.go b/libpod/oci_attach_linux.go
index b5eabec1f..c6af294d5 100644
--- a/libpod/oci_attach_linux.go
+++ b/libpod/oci_attach_linux.go
@@ -274,11 +274,15 @@ func readStdio(conn *net.UnixConn, streams *define.AttachStreams, receiveStdoutE
var err error
select {
case err = <-receiveStdoutError:
- conn.CloseWrite()
+ if err := conn.CloseWrite(); err != nil {
+ logrus.Errorf("Failed to close stdin: %v", err)
+ }
return err
case err = <-stdinDone:
if err == define.ErrDetach {
- conn.CloseWrite()
+ if err := conn.CloseWrite(); err != nil {
+ logrus.Errorf("Failed to close stdin: %v", err)
+ }
return err
}
if err == nil {
diff --git a/libpod/oci_conmon_exec_linux.go b/libpod/oci_conmon_exec_linux.go
index b8fd82591..6d2f13525 100644
--- a/libpod/oci_conmon_exec_linux.go
+++ b/libpod/oci_conmon_exec_linux.go
@@ -766,13 +766,11 @@ func prepareProcessExec(c *Container, options *ExecOptions, env []string, sessio
if execUser.Uid == 0 {
pspec.Capabilities.Effective = pspec.Capabilities.Bounding
pspec.Capabilities.Permitted = pspec.Capabilities.Bounding
- } else {
- if user == c.config.User {
- pspec.Capabilities.Effective = ctrSpec.Process.Capabilities.Effective
- pspec.Capabilities.Inheritable = ctrSpec.Process.Capabilities.Effective
- pspec.Capabilities.Permitted = ctrSpec.Process.Capabilities.Effective
- pspec.Capabilities.Ambient = ctrSpec.Process.Capabilities.Effective
- }
+ } else if user == c.config.User {
+ pspec.Capabilities.Effective = ctrSpec.Process.Capabilities.Effective
+ pspec.Capabilities.Inheritable = ctrSpec.Process.Capabilities.Effective
+ pspec.Capabilities.Permitted = ctrSpec.Process.Capabilities.Effective
+ pspec.Capabilities.Ambient = ctrSpec.Process.Capabilities.Effective
}
hasHomeSet := false
diff --git a/libpod/oci_conmon_linux.go b/libpod/oci_conmon_linux.go
index dc1c75cea..c232702e9 100644
--- a/libpod/oci_conmon_linux.go
+++ b/libpod/oci_conmon_linux.go
@@ -1371,7 +1371,7 @@ func (r *ConmonOCIRuntime) sharedConmonArgs(ctr *Container, cuuid, bundlePath, p
case define.JSONLogging:
fallthrough
//lint:ignore ST1015 the default case has to be here
- default: //nolint:stylecheck
+ default: //nolint:stylecheck,gocritic
// No case here should happen except JSONLogging, but keep this here in case the options are extended
logrus.Errorf("%s logging specified but not supported. Choosing k8s-file logging instead", ctr.LogDriver())
fallthrough
diff --git a/libpod/options.go b/libpod/options.go
index 4e597201a..98eb45e76 100644
--- a/libpod/options.go
+++ b/libpod/options.go
@@ -1634,6 +1634,19 @@ func WithVolumeNoChown() VolumeCreateOption {
}
}
+// WithVolumeDisableQuota prevents the volume from being assigned a quota.
+func WithVolumeDisableQuota() VolumeCreateOption {
+ return func(volume *Volume) error {
+ if volume.valid {
+ return define.ErrVolumeFinalized
+ }
+
+ volume.config.DisableQuota = true
+
+ return nil
+ }
+}
+
// withSetAnon sets a bool notifying libpod that this volume is anonymous and
// should be removed when containers using it are removed and volumes are
// specified for removal.
@@ -1662,7 +1675,7 @@ func WithTimezone(path string) CtrCreateOption {
if err != nil {
return err
}
- //We don't want to mount a timezone directory
+ // We don't want to mount a timezone directory
if file.IsDir() {
return errors.New("Invalid timezone: is a directory")
}
diff --git a/libpod/pod.go b/libpod/pod.go
index ed2d97b37..237c42901 100644
--- a/libpod/pod.go
+++ b/libpod/pod.go
@@ -1,7 +1,6 @@
package libpod
import (
- "context"
"fmt"
"sort"
"strings"
@@ -159,6 +158,15 @@ func (p *Pod) CPUQuota() int64 {
return 0
}
+// NetworkMode returns the Network mode given by the user ex: pod, private...
+func (p *Pod) NetworkMode() string {
+ infra, err := p.runtime.GetContainer(p.state.InfraContainerID)
+ if err != nil {
+ return ""
+ }
+ return infra.NetworkMode()
+}
+
// PidMode returns the PID mode given by the user ex: pod, private...
func (p *Pod) PidMode() string {
infra, err := p.runtime.GetContainer(p.state.InfraContainerID)
@@ -296,35 +304,9 @@ func (p *Pod) CgroupPath() (string, error) {
if err := p.updatePod(); err != nil {
return "", err
}
- if p.state.CgroupPath != "" {
- return p.state.CgroupPath, nil
- }
if p.state.InfraContainerID == "" {
return "", errors.Wrap(define.ErrNoSuchCtr, "pod has no infra container")
}
-
- id, err := p.infraContainerID()
- if err != nil {
- return "", err
- }
-
- if id != "" {
- ctr, err := p.infraContainer()
- if err != nil {
- return "", errors.Wrapf(err, "could not get infra")
- }
- if ctr != nil {
- ctr.Start(context.Background(), true)
- cgroupPath, err := ctr.CgroupPath()
- fmt.Println(cgroupPath)
- if err != nil {
- return "", errors.Wrapf(err, "could not get container cgroup")
- }
- p.state.CgroupPath = cgroupPath
- p.save()
- return cgroupPath, nil
- }
- }
return p.state.CgroupPath, nil
}
diff --git a/libpod/pod_api.go b/libpod/pod_api.go
index 48049798b..ba30d878e 100644
--- a/libpod/pod_api.go
+++ b/libpod/pod_api.go
@@ -593,7 +593,7 @@ func (p *Pod) Inspect() (*define.InspectPodData, error) {
return nil, err
}
infraConfig = new(define.InspectPodInfraConfig)
- infraConfig.HostNetwork = !infra.config.ContainerNetworkConfig.UseImageHosts
+ infraConfig.HostNetwork = p.NetworkMode() == "host"
infraConfig.StaticIP = infra.config.ContainerNetworkConfig.StaticIP
infraConfig.NoManageResolvConf = infra.config.UseImageResolvConf
infraConfig.NoManageHosts = infra.config.UseImageHosts
diff --git a/libpod/runtime.go b/libpod/runtime.go
index 877e151a9..6c2323d88 100644
--- a/libpod/runtime.go
+++ b/libpod/runtime.go
@@ -550,6 +550,10 @@ func makeRuntime(runtime *Runtime) (retErr error) {
// Check if the pause process was created. If it was created, then
// move it to its own systemd scope.
utils.MovePauseProcessToScope(pausePid)
+
+ // gocritic complains because defer is not run on os.Exit()
+ // However this is fine because the lock is released anyway when the process exits
+ //nolint:gocritic
os.Exit(ret)
}
}
diff --git a/libpod/runtime_ctr.go b/libpod/runtime_ctr.go
index fd3ffd199..df7174ac6 100644
--- a/libpod/runtime_ctr.go
+++ b/libpod/runtime_ctr.go
@@ -513,7 +513,9 @@ func (r *Runtime) setupContainer(ctx context.Context, ctr *Container) (_ *Contai
case define.NoLogging, define.PassthroughLogging:
break
case define.JournaldLogging:
- ctr.initializeJournal(ctx)
+ if err := ctr.initializeJournal(ctx); err != nil {
+ return nil, fmt.Errorf("failed to initialize journal: %w", err)
+ }
default:
if ctr.config.LogPath == "" {
ctr.config.LogPath = filepath.Join(ctr.config.StaticDir, "ctr.log")
diff --git a/libpod/runtime_pod_linux.go b/libpod/runtime_pod_linux.go
index 2bbccfdf6..62ec7df60 100644
--- a/libpod/runtime_pod_linux.go
+++ b/libpod/runtime_pod_linux.go
@@ -199,10 +199,15 @@ func (r *Runtime) removePod(ctx context.Context, p *Pod, removeCtrs, force bool,
// Go through and lock all containers so we can operate on them all at
// once.
// First loop also checks that we are ready to go ahead and remove.
+ containersLocked := true
for _, ctr := range ctrs {
ctrLock := ctr.lock
ctrLock.Lock()
- defer ctrLock.Unlock()
+ defer func() {
+ if containersLocked {
+ ctrLock.Unlock()
+ }
+ }()
// If we're force-removing, no need to check status.
if force {
@@ -304,6 +309,12 @@ func (r *Runtime) removePod(ctx context.Context, p *Pod, removeCtrs, force bool,
}
}
+ // let's unlock the containers so if there is any cleanup process, it can terminate its execution
+ for _, ctr := range ctrs {
+ ctr.lock.Unlock()
+ }
+ containersLocked = false
+
// Remove pod cgroup, if present
if p.state.CgroupPath != "" {
logrus.Debugf("Removing pod cgroup %s", p.state.CgroupPath)
@@ -332,7 +343,7 @@ func (r *Runtime) removePod(ctx context.Context, p *Pod, removeCtrs, force bool,
}
}
if err == nil {
- if err := conmonCgroup.Delete(); err != nil {
+ if err = conmonCgroup.Delete(); err != nil {
if removalErr == nil {
removalErr = errors.Wrapf(err, "error removing pod %s conmon cgroup", p.ID())
} else {
diff --git a/libpod/runtime_volume_linux.go b/libpod/runtime_volume_linux.go
index 241f6e2f2..f8788e183 100644
--- a/libpod/runtime_volume_linux.go
+++ b/libpod/runtime_volume_linux.go
@@ -73,7 +73,7 @@ func (r *Runtime) newVolume(options ...VolumeCreateOption) (_ *Volume, deferredE
return nil, errors.Wrapf(err, "invalid volume option %s for driver 'local'", key)
}
}
- case "o", "type", "uid", "gid", "size", "inodes":
+ case "o", "type", "uid", "gid", "size", "inodes", "noquota":
// Do nothing, valid keys
default:
return nil, errors.Wrapf(define.ErrInvalidArg, "invalid mount option %s for driver 'local'", key)
@@ -111,23 +111,28 @@ func (r *Runtime) newVolume(options ...VolumeCreateOption) (_ *Volume, deferredE
if err := LabelVolumePath(fullVolPath); err != nil {
return nil, err
}
- projectQuotaSupported := false
-
- q, err := quota.NewControl(r.config.Engine.VolumePath)
- if err == nil {
- projectQuotaSupported = true
- }
- quota := quota.Quota{}
- if volume.config.Size > 0 || volume.config.Inodes > 0 {
- if !projectQuotaSupported {
- return nil, errors.New("Volume options size and inodes not supported. Filesystem does not support Project Quota")
+ if volume.config.DisableQuota {
+ if volume.config.Size > 0 || volume.config.Inodes > 0 {
+ return nil, errors.New("volume options size and inodes cannot be used without quota")
}
- quota.Size = volume.config.Size
- quota.Inodes = volume.config.Inodes
- }
- if projectQuotaSupported {
- if err := q.SetQuota(fullVolPath, quota); err != nil {
- return nil, errors.Wrapf(err, "failed to set size quota size=%d inodes=%d for volume directory %q", volume.config.Size, volume.config.Inodes, fullVolPath)
+ } else {
+ projectQuotaSupported := false
+ q, err := quota.NewControl(r.config.Engine.VolumePath)
+ if err == nil {
+ projectQuotaSupported = true
+ }
+ quota := quota.Quota{}
+ if volume.config.Size > 0 || volume.config.Inodes > 0 {
+ if !projectQuotaSupported {
+ return nil, errors.New("volume options size and inodes not supported. Filesystem does not support Project Quota")
+ }
+ quota.Size = volume.config.Size
+ quota.Inodes = volume.config.Inodes
+ }
+ if projectQuotaSupported {
+ if err := q.SetQuota(fullVolPath, quota); err != nil {
+ return nil, errors.Wrapf(err, "failed to set size quota size=%d inodes=%d for volume directory %q", volume.config.Size, volume.config.Inodes, fullVolPath)
+ }
}
}
diff --git a/libpod/util.go b/libpod/util.go
index 51fe60427..1753b4f34 100644
--- a/libpod/util.go
+++ b/libpod/util.go
@@ -55,8 +55,11 @@ func WaitForFile(path string, chWait chan error, timeout time.Duration) (bool, e
if err := watcher.Add(filepath.Dir(path)); err == nil {
inotifyEvents = watcher.Events
}
- defer watcher.Close()
- defer watcher.Remove(filepath.Dir(path))
+ defer func() {
+ if err := watcher.Close(); err != nil {
+ logrus.Errorf("Failed to close fsnotify watcher: %v", err)
+ }
+ }()
}
var timeoutChan <-chan time.Time
diff --git a/libpod/volume.go b/libpod/volume.go
index bffafdc15..ab461a37f 100644
--- a/libpod/volume.go
+++ b/libpod/volume.go
@@ -52,6 +52,9 @@ type VolumeConfig struct {
Size uint64 `json:"size"`
// Inodes maximum of the volume.
Inodes uint64 `json:"inodes"`
+ // DisableQuota indicates that the volume should completely disable using any
+ // quota tracking.
+ DisableQuota bool `json:"disableQuota,omitempty"`
}
// VolumeState holds the volume's mutable state.
diff --git a/libpod/volume_internal.go b/libpod/volume_internal.go
index 9850c2ea1..e0ebb729d 100644
--- a/libpod/volume_internal.go
+++ b/libpod/volume_internal.go
@@ -52,6 +52,9 @@ func (v *Volume) needsMount() bool {
if _, ok := v.config.Options["SIZE"]; ok {
index++
}
+ if _, ok := v.config.Options["NOQUOTA"]; ok {
+ index++
+ }
// when uid or gid is set there is also the "o" option
// set so we have to ignore this one as well
if index > 0 {
diff --git a/pkg/api/handlers/compat/containers.go b/pkg/api/handlers/compat/containers.go
index 4830ef4b7..1c339730e 100644
--- a/pkg/api/handlers/compat/containers.go
+++ b/pkg/api/handlers/compat/containers.go
@@ -293,9 +293,10 @@ func LibpodToContainer(l *libpod.Container, sz bool) (*handlers.Container, error
stateStr = "created"
}
- if state == define.ContainerStateConfigured || state == define.ContainerStateCreated {
+ switch state {
+ case define.ContainerStateConfigured, define.ContainerStateCreated:
status = "Created"
- } else if state == define.ContainerStateStopped || state == define.ContainerStateExited {
+ case define.ContainerStateStopped, define.ContainerStateExited:
exitCode, _, err := l.ExitCode()
if err != nil {
return nil, err
@@ -305,7 +306,7 @@ func LibpodToContainer(l *libpod.Container, sz bool) (*handlers.Container, error
return nil, err
}
status = fmt.Sprintf("Exited (%d) %s ago", exitCode, units.HumanDuration(time.Since(finishedTime)))
- } else if state == define.ContainerStateRunning || state == define.ContainerStatePaused {
+ case define.ContainerStateRunning, define.ContainerStatePaused:
startedTime, err := l.StartedTime()
if err != nil {
return nil, err
@@ -314,11 +315,11 @@ func LibpodToContainer(l *libpod.Container, sz bool) (*handlers.Container, error
if state == define.ContainerStatePaused {
status += " (Paused)"
}
- } else if state == define.ContainerStateRemoving {
+ case define.ContainerStateRemoving:
status = "Removal In Progress"
- } else if state == define.ContainerStateStopping {
+ case define.ContainerStateStopping:
status = "Stopping"
- } else {
+ default:
status = "Unknown"
}
diff --git a/pkg/api/handlers/compat/images.go b/pkg/api/handlers/compat/images.go
index edefce010..a690cdd40 100644
--- a/pkg/api/handlers/compat/images.go
+++ b/pkg/api/handlers/compat/images.go
@@ -532,7 +532,7 @@ func ExportImages(w http.ResponseWriter, r *http.Request) {
utils.Error(w, http.StatusBadRequest, errors.Wrapf(err, "failed to parse parameters for %s", r.URL.String()))
return
}
- if len(query.Names) <= 0 {
+ if len(query.Names) == 0 {
utils.Error(w, http.StatusBadRequest, fmt.Errorf("no images to download"))
return
}
diff --git a/pkg/api/handlers/compat/images_build.go b/pkg/api/handlers/compat/images_build.go
index 1a24f1ae3..0f85aa717 100644
--- a/pkg/api/handlers/compat/images_build.go
+++ b/pkg/api/handlers/compat/images_build.go
@@ -286,7 +286,7 @@ func BuildImage(w http.ResponseWriter, r *http.Request) {
}
}
}
- secrets = append(secrets, strings.Join(modifiedOpt[:], ","))
+ secrets = append(secrets, strings.Join(modifiedOpt, ","))
}
}
}
diff --git a/pkg/api/handlers/compat/images_prune.go b/pkg/api/handlers/compat/images_prune.go
index c0be9da7d..46524fcff 100644
--- a/pkg/api/handlers/compat/images_prune.go
+++ b/pkg/api/handlers/compat/images_prune.go
@@ -58,7 +58,7 @@ func PruneImages(w http.ResponseWriter, r *http.Request) {
idr = append(idr, types.ImageDeleteResponseItem{
Deleted: p.Id,
})
- reclaimedSpace = reclaimedSpace + p.Size
+ reclaimedSpace += p.Size
}
if errorMsg.Len() > 0 {
utils.InternalServerError(w, errors.New(errorMsg.String()))
diff --git a/pkg/api/handlers/decoder.go b/pkg/api/handlers/decoder.go
index 5e8f12960..fbe03d97b 100644
--- a/pkg/api/handlers/decoder.go
+++ b/pkg/api/handlers/decoder.go
@@ -21,6 +21,7 @@ func NewAPIDecoder() *schema.Decoder {
d.RegisterConverter(map[string][]string{}, convertURLValuesString)
d.RegisterConverter(time.Time{}, convertTimeString)
d.RegisterConverter(define.ContainerStatus(0), convertContainerStatusString)
+ d.RegisterConverter(map[string]string{}, convertStringMap)
var Signal syscall.Signal
d.RegisterConverter(Signal, convertSignal)
@@ -48,6 +49,15 @@ func convertURLValuesString(query string) reflect.Value {
return reflect.ValueOf(f)
}
+func convertStringMap(query string) reflect.Value {
+ res := make(map[string]string)
+ err := json.Unmarshal([]byte(query), &res)
+ if err != nil {
+ logrus.Infof("convertStringMap: Failed to Unmarshal %s: %s", query, err.Error())
+ }
+ return reflect.ValueOf(res)
+}
+
func convertContainerStatusString(query string) reflect.Value {
result, err := define.StringToContainerStatus(query)
if err != nil {
diff --git a/pkg/api/handlers/libpod/manifests.go b/pkg/api/handlers/libpod/manifests.go
index 15d4b9f89..8dc7c57d5 100644
--- a/pkg/api/handlers/libpod/manifests.go
+++ b/pkg/api/handlers/libpod/manifests.go
@@ -7,6 +7,7 @@ import (
"io/ioutil"
"net/http"
"net/url"
+ "strconv"
"strings"
"github.com/containers/image/v5/docker/reference"
@@ -372,6 +373,15 @@ func ManifestModify(w http.ResponseWriter, r *http.Request) {
return
}
+ if tlsVerify, ok := r.URL.Query()["tlsVerify"]; ok {
+ tls, err := strconv.ParseBool(tlsVerify[len(tlsVerify)-1])
+ if err != nil {
+ utils.Error(w, http.StatusBadRequest, fmt.Errorf("tlsVerify param is not a bool: %w", err))
+ return
+ }
+ body.SkipTLSVerify = types.NewOptionalBool(!tls)
+ }
+
authconf, authfile, err := auth.GetCredentials(r)
if err != nil {
utils.Error(w, http.StatusBadRequest, err)
diff --git a/pkg/api/handlers/libpod/secrets.go b/pkg/api/handlers/libpod/secrets.go
index 8708e630c..3ea2c2ea8 100644
--- a/pkg/api/handlers/libpod/secrets.go
+++ b/pkg/api/handlers/libpod/secrets.go
@@ -1,9 +1,7 @@
package libpod
import (
- "encoding/json"
"net/http"
- "reflect"
"github.com/containers/podman/v4/libpod"
"github.com/containers/podman/v4/pkg/api/handlers/utils"
@@ -20,12 +18,6 @@ func CreateSecret(w http.ResponseWriter, r *http.Request) {
decoder = r.Context().Value(api.DecoderKey).(*schema.Decoder)
)
- decoder.RegisterConverter(map[string]string{}, func(str string) reflect.Value {
- res := make(map[string]string)
- json.Unmarshal([]byte(str), &res)
- return reflect.ValueOf(res)
- })
-
query := struct {
Name string `schema:"name"`
Driver string `schema:"driver"`
diff --git a/pkg/api/handlers/utils/handler.go b/pkg/api/handlers/utils/handler.go
index a9b6f0659..338d5a84b 100644
--- a/pkg/api/handlers/utils/handler.go
+++ b/pkg/api/handlers/utils/handler.go
@@ -150,7 +150,7 @@ func MarshalErrorJSONIsEmpty(ptr unsafe.Pointer) bool {
}
func MarshalErrorSliceJSONIsEmpty(ptr unsafe.Pointer) bool {
- return len(*((*[]error)(ptr))) <= 0
+ return len(*((*[]error)(ptr))) == 0
}
// WriteJSON writes an interface value encoded as JSON to w
diff --git a/pkg/api/server/register_manifest.go b/pkg/api/server/register_manifest.go
index 50a49bc1e..3e3a516f4 100644
--- a/pkg/api/server/register_manifest.go
+++ b/pkg/api/server/register_manifest.go
@@ -10,6 +10,82 @@ import (
func (s *APIServer) registerManifestHandlers(r *mux.Router) error {
v3 := r.PathPrefix("/v{version:[0-3][0-9A-Za-z.-]*}/libpod/manifests").Subrouter()
v4 := r.PathPrefix("/v{version:[4-9][0-9A-Za-z.-]*}/libpod/manifests").Subrouter()
+ // swagger:operation POST /libpod/manifests/{name}/push manifests ManifestPushV3Libpod
+ // ---
+ // summary: Push manifest to registry
+ // description: |
+ // Push a manifest list or image index to a registry
+ //
+ // Deprecated: As of 4.0.0 use ManifestPushLibpod instead
+ // produces:
+ // - application/json
+ // parameters:
+ // - in: path
+ // name: name
+ // type: string
+ // required: true
+ // description: the name or ID of the manifest
+ // - in: query
+ // name: destination
+ // type: string
+ // required: true
+ // description: the destination for the manifest
+ // - in: query
+ // name: all
+ // description: push all images
+ // type: boolean
+ // responses:
+ // 200:
+ // schema:
+ // $ref: "#/definitions/IDResponse"
+ // 400:
+ // $ref: "#/responses/BadParamError"
+ // 404:
+ // $ref: "#/responses/NoSuchManifest"
+ // 500:
+ // $ref: "#/responses/InternalError"
+ v3.Handle("/{name}/push", s.APIHandler(libpod.ManifestPushV3)).Methods(http.MethodPost)
+ // swagger:operation POST /libpod/manifests/{name}/registry/{destination} manifests ManifestPushLibpod
+ // ---
+ // summary: Push manifest list to registry
+ // description: |
+ // Push a manifest list or image index to the named registry
+ //
+ // As of v4.0.0
+ // produces:
+ // - application/json
+ // parameters:
+ // - in: path
+ // name: name
+ // type: string
+ // required: true
+ // description: the name or ID of the manifest list
+ // - in: path
+ // name: destination
+ // type: string
+ // required: true
+ // description: the registry for the manifest list
+ // - in: query
+ // name: all
+ // description: push all images
+ // type: boolean
+ // default: false
+ // - in: query
+ // name: tlsVerify
+ // type: boolean
+ // default: false
+ // description: skip TLS verification for registries
+ // responses:
+ // 200:
+ // schema:
+ // $ref: "#/definitions/IDResponse"
+ // 400:
+ // $ref: "#/responses/BadParamError"
+ // 404:
+ // $ref: "#/responses/NoSuchManifest"
+ // 500:
+ // $ref: "#/responses/InternalError"
+ v4.Handle("/{name:.*}/registry/{destination:.*}", s.APIHandler(libpod.ManifestPush)).Methods(http.MethodPost)
// swagger:operation POST /libpod/manifests manifests ManifestCreateLibpod
// ---
// summary: Create
@@ -116,6 +192,11 @@ func (s *APIServer) registerManifestHandlers(r *mux.Router) error {
// type: string
// required: true
// description: the name or ID of the manifest
+ // - in: query
+ // name: tlsVerify
+ // type: boolean
+ // default: false
+ // description: skip TLS verification for registries
// - in: body
// name: options
// description: options for mutating a manifest
@@ -221,81 +302,5 @@ func (s *APIServer) registerManifestHandlers(r *mux.Router) error {
// 500:
// $ref: "#/responses/InternalError"
v4.Handle("/{name:.*}", s.APIHandler(libpod.ManifestDelete)).Methods(http.MethodDelete)
- // swagger:operation POST /libpod/manifests/{name}/push manifests ManifestPushV3Libpod
- // ---
- // summary: Push manifest to registry
- // description: |
- // Push a manifest list or image index to a registry
- //
- // Deprecated: As of 4.0.0 use ManifestPushLibpod instead
- // produces:
- // - application/json
- // parameters:
- // - in: path
- // name: name
- // type: string
- // required: true
- // description: the name or ID of the manifest
- // - in: query
- // name: destination
- // type: string
- // required: true
- // description: the destination for the manifest
- // - in: query
- // name: all
- // description: push all images
- // type: boolean
- // responses:
- // 200:
- // schema:
- // $ref: "#/definitions/IDResponse"
- // 400:
- // $ref: "#/responses/BadParamError"
- // 404:
- // $ref: "#/responses/NoSuchManifest"
- // 500:
- // $ref: "#/responses/InternalError"
- v3.Handle("/{name}/push", s.APIHandler(libpod.ManifestPushV3)).Methods(http.MethodPost)
- // swagger:operation POST /libpod/manifests/{name}/registry/{destination} manifests ManifestPushLibpod
- // ---
- // summary: Push manifest list to registry
- // description: |
- // Push a manifest list or image index to the named registry
- //
- // As of v4.0.0
- // produces:
- // - application/json
- // parameters:
- // - in: path
- // name: name
- // type: string
- // required: true
- // description: the name or ID of the manifest list
- // - in: path
- // name: destination
- // type: string
- // required: true
- // description: the registry for the manifest list
- // - in: query
- // name: all
- // description: push all images
- // type: boolean
- // default: false
- // - in: query
- // name: tlsVerify
- // type: boolean
- // default: false
- // description: skip TLS verification for registries
- // responses:
- // 200:
- // schema:
- // $ref: "#/definitions/IDResponse"
- // 400:
- // $ref: "#/responses/BadParamError"
- // 404:
- // $ref: "#/responses/NoSuchManifest"
- // 500:
- // $ref: "#/responses/InternalError"
- v4.Handle("/{name:.*}/registry/{destination:.*}", s.APIHandler(libpod.ManifestPush)).Methods(http.MethodPost)
return nil
}
diff --git a/pkg/bindings/images/build.go b/pkg/bindings/images/build.go
index 1729bd922..9e0a0d798 100644
--- a/pkg/bindings/images/build.go
+++ b/pkg/bindings/images/build.go
@@ -225,10 +225,8 @@ func Build(ctx context.Context, containerFiles []string, options entities.BuildO
platform = "linux"
}
platform += "/" + options.Architecture
- } else {
- if len(platform) > 0 {
- platform += "/" + runtime.GOARCH
- }
+ } else if len(platform) > 0 {
+ platform += "/" + runtime.GOARCH
}
if len(platform) > 0 {
params.Set("platform", platform)
@@ -447,7 +445,7 @@ func Build(ctx context.Context, containerFiles []string, options entities.BuildO
}
}
}
- secretsForRemote = append(secretsForRemote, strings.Join(modifiedOpt[:], ","))
+ secretsForRemote = append(secretsForRemote, strings.Join(modifiedOpt, ","))
}
}
@@ -603,8 +601,8 @@ func nTar(excludes []string, sources ...string) (io.ReadCloser, error) {
// are required to visit all files. :(
return nil
}
-
- if d.Type().IsRegular() { // add file item
+ switch {
+ case d.Type().IsRegular(): // add file item
info, err := d.Info()
if err != nil {
return err
@@ -644,7 +642,7 @@ func nTar(excludes []string, sources ...string) (io.ReadCloser, error) {
seen[di] = name
}
return err
- } else if d.IsDir() { // add folders
+ case d.IsDir(): // add folders
info, err := d.Info()
if err != nil {
return err
@@ -658,7 +656,7 @@ func nTar(excludes []string, sources ...string) (io.ReadCloser, error) {
if lerr := tw.WriteHeader(hdr); lerr != nil {
return lerr
}
- } else if d.Type()&os.ModeSymlink != 0 { // add symlinks as it, not content
+ case d.Type()&os.ModeSymlink != 0: // add symlinks as it, not content
link, err := os.Readlink(path)
if err != nil {
return err
diff --git a/pkg/bindings/images/types.go b/pkg/bindings/images/types.go
index 75cb38a0a..8e5e7ee92 100644
--- a/pkg/bindings/images/types.go
+++ b/pkg/bindings/images/types.go
@@ -177,7 +177,7 @@ type PullOptions struct {
Variant *string
}
-//BuildOptions are optional options for building images
+// BuildOptions are optional options for building images
type BuildOptions struct {
buildahDefine.BuildOptions
}
diff --git a/pkg/bindings/manifests/manifests.go b/pkg/bindings/manifests/manifests.go
index 70b3819f5..828f4922c 100644
--- a/pkg/bindings/manifests/manifests.go
+++ b/pkg/bindings/manifests/manifests.go
@@ -2,13 +2,11 @@ package manifests
import (
"context"
- "fmt"
"io/ioutil"
"net/http"
"strconv"
"strings"
- "github.com/blang/semver"
"github.com/containers/image/v5/manifest"
imageTypes "github.com/containers/image/v5/types"
"github.com/containers/podman/v4/pkg/api/handlers"
@@ -17,7 +15,6 @@ import (
"github.com/containers/podman/v4/pkg/bindings/images"
"github.com/containers/podman/v4/pkg/domain/entities"
"github.com/containers/podman/v4/pkg/errorhandling"
- "github.com/containers/podman/v4/version"
jsoniter "github.com/json-iterator/go"
"github.com/pkg/errors"
)
@@ -95,65 +92,23 @@ func Add(ctx context.Context, name string, options *AddOptions) (string, error)
options = new(AddOptions)
}
- if bindings.ServiceVersion(ctx).GTE(semver.MustParse("4.0.0")) {
- optionsv4 := ModifyOptions{
- All: options.All,
- Annotations: options.Annotation,
- Arch: options.Arch,
- Features: options.Features,
- Images: options.Images,
- OS: options.OS,
- OSFeatures: nil,
- OSVersion: options.OSVersion,
- Variant: options.Variant,
- Username: options.Username,
- Password: options.Password,
- Authfile: options.Authfile,
- SkipTLSVerify: options.SkipTLSVerify,
- }
- optionsv4.WithOperation("update")
- return Modify(ctx, name, options.Images, &optionsv4)
- }
-
- // API Version < 4.0.0
- conn, err := bindings.GetClient(ctx)
- if err != nil {
- return "", err
- }
- opts, err := jsoniter.MarshalToString(options)
- if err != nil {
- return "", err
- }
- reader := strings.NewReader(opts)
-
- header, err := auth.MakeXRegistryAuthHeader(&imageTypes.SystemContext{AuthFilePath: options.GetAuthfile()}, options.GetUsername(), options.GetPassword())
- if err != nil {
- return "", err
- }
-
- params, err := options.ToParams()
- if err != nil {
- return "", err
- }
- // SkipTLSVerify is special. We need to delete the param added by
- // ToParams() and change the key and flip the bool
- if options.SkipTLSVerify != nil {
- params.Del("SkipTLSVerify")
- params.Set("tlsVerify", strconv.FormatBool(!options.GetSkipTLSVerify()))
- }
-
- v := version.APIVersion[version.Libpod][version.MinimalAPI]
- header.Add("API-Version",
- fmt.Sprintf("%d.%d.%d", v.Major, v.Minor, v.Patch))
-
- response, err := conn.DoRequest(ctx, reader, http.MethodPost, "/manifests/%s/add", params, header, name)
- if err != nil {
- return "", err
- }
- defer response.Body.Close()
-
- var idr handlers.IDResponse
- return idr.ID, response.Process(&idr)
+ optionsv4 := ModifyOptions{
+ All: options.All,
+ Annotations: options.Annotation,
+ Arch: options.Arch,
+ Features: options.Features,
+ Images: options.Images,
+ OS: options.OS,
+ OSFeatures: nil,
+ OSVersion: options.OSVersion,
+ Variant: options.Variant,
+ Username: options.Username,
+ Password: options.Password,
+ Authfile: options.Authfile,
+ SkipTLSVerify: options.SkipTLSVerify,
+ }
+ optionsv4.WithOperation("update")
+ return Modify(ctx, name, options.Images, &optionsv4)
}
// Remove deletes a manifest entry from a manifest list. Both name and the digest to be
@@ -185,9 +140,6 @@ func Push(ctx context.Context, name, destination string, options *images.PushOpt
if err != nil {
return "", err
}
- v := version.APIVersion[version.Libpod][version.MinimalAPI]
- header.Add("API-Version",
- fmt.Sprintf("%d.%d.%d", v.Major, v.Minor, v.Patch))
params, err := options.ToParams()
if err != nil {
@@ -200,14 +152,7 @@ func Push(ctx context.Context, name, destination string, options *images.PushOpt
params.Set("tlsVerify", strconv.FormatBool(!options.GetSkipTLSVerify()))
}
- var response *bindings.APIResponse
- if bindings.ServiceVersion(ctx).GTE(semver.MustParse("4.0.0")) {
- response, err = conn.DoRequest(ctx, nil, http.MethodPost, "/manifests/%s/registry/%s", params, header, name, destination)
- } else {
- params.Set("image", name)
- params.Set("destination", destination)
- response, err = conn.DoRequest(ctx, nil, http.MethodPost, "/manifests/%s/push", params, header, name)
- }
+ response, err := conn.DoRequest(ctx, nil, http.MethodPost, "/manifests/%s/registry/%s", params, header, name, destination)
if err != nil {
return "", err
}
diff --git a/pkg/bindings/network/network.go b/pkg/bindings/network/network.go
index 6c7777fdd..83641f677 100644
--- a/pkg/bindings/network/network.go
+++ b/pkg/bindings/network/network.go
@@ -101,7 +101,7 @@ func List(ctx context.Context, options *ListOptions) ([]types.Network, error) {
}
// Disconnect removes a container from a given network
-func Disconnect(ctx context.Context, networkName string, ContainerNameOrID string, options *DisconnectOptions) error {
+func Disconnect(ctx context.Context, networkName string, containerNameOrID string, options *DisconnectOptions) error {
if options == nil {
options = new(DisconnectOptions)
}
@@ -114,7 +114,7 @@ func Disconnect(ctx context.Context, networkName string, ContainerNameOrID strin
Container string
Force bool
}{
- Container: ContainerNameOrID,
+ Container: containerNameOrID,
}
if force := options.GetForce(); options.Changed("Force") {
disconnect.Force = force
diff --git a/pkg/bindings/test/containers_test.go b/pkg/bindings/test/containers_test.go
index bf627fdba..090dd294c 100644
--- a/pkg/bindings/test/containers_test.go
+++ b/pkg/bindings/test/containers_test.go
@@ -104,9 +104,9 @@ var _ = Describe("Podman containers ", func() {
// Pause by name
err = containers.Pause(bt.conn, name, nil)
Expect(err).To(BeNil(), "error from containers.Pause()")
- //paused := "paused"
- //_, err = containers.Wait(bt.conn, cid, &paused)
- //Expect(err).To(BeNil())
+ // paused := "paused"
+ // _, err = containers.Wait(bt.conn, cid, &paused)
+ // Expect(err).To(BeNil())
err = containers.Unpause(bt.conn, name, nil)
Expect(err).To(BeNil())
@@ -332,8 +332,8 @@ var _ = Describe("Podman containers ", func() {
// TODO for the life of me, i cannot get this to work. maybe another set
// of eyes will
// successful healthcheck
- //status := define.HealthCheckHealthy
- //for i:=0; i < 10; i++ {
+ // status := define.HealthCheckHealthy
+ // for i:=0; i < 10; i++ {
// result, err := containers.RunHealthCheck(connText, "hc")
// Expect(err).To(BeNil())
// if result.Status != define.HealthCheckHealthy {
@@ -343,18 +343,18 @@ var _ = Describe("Podman containers ", func() {
// }
// status = result.Status
// break
- //}
- //Expect(status).To(Equal(define.HealthCheckHealthy))
+ // }
+ // Expect(status).To(Equal(define.HealthCheckHealthy))
// TODO enable this when wait is working
// healthcheck on a stopped container should be a 409
- //err = containers.Stop(connText, "hc", nil)
- //Expect(err).To(BeNil())
- //_, err = containers.Wait(connText, "hc")
- //Expect(err).To(BeNil())
- //_, err = containers.RunHealthCheck(connText, "hc")
- //code, _ = bindings.CheckResponseCode(err)
- //Expect(code).To(BeNumerically("==", http.StatusConflict))
+ // err = containers.Stop(connText, "hc", nil)
+ // Expect(err).To(BeNil())
+ // _, err = containers.Wait(connText, "hc")
+ // Expect(err).To(BeNil())
+ // _, err = containers.RunHealthCheck(connText, "hc")
+ // code, _ = bindings.CheckResponseCode(err)
+ // Expect(code).To(BeNumerically("==", http.StatusConflict))
})
It("logging", func() {
@@ -490,7 +490,7 @@ var _ = Describe("Podman containers ", func() {
})
It("podman kill a running container by bogus signal", func() {
- //Killing a running container by bogus signal should fail
+ // Killing a running container by bogus signal should fail
var name = "top"
cid, err := bt.RunTopContainer(&name, nil)
Expect(err).To(BeNil())
@@ -580,7 +580,7 @@ var _ = Describe("Podman containers ", func() {
// Valid filter params container should be pruned now.
filters := map[string][]string{
- "until": {"5000000000"}, //Friday, June 11, 2128
+ "until": {"5000000000"}, // Friday, June 11, 2128
}
pruneResponse, err = containers.Prune(bt.conn, new(containers.PruneOptions).WithFilters(filters))
Expect(err).To(BeNil())
@@ -594,7 +594,7 @@ var _ = Describe("Podman containers ", func() {
Expect(err).To(BeNil())
filters := map[string][]string{
- "until": {"5000000000"}, //Friday, June 11, 2128
+ "until": {"5000000000"}, // Friday, June 11, 2128
}
c, err := containers.List(bt.conn, new(containers.ListOptions).WithFilters(filters).WithAll(true))
Expect(err).To(BeNil())
diff --git a/pkg/bindings/test/manifests_test.go b/pkg/bindings/test/manifests_test.go
index 64becda43..e6c93817d 100644
--- a/pkg/bindings/test/manifests_test.go
+++ b/pkg/bindings/test/manifests_test.go
@@ -96,7 +96,7 @@ var _ = Describe("podman manifest", func() {
Expect(err).To(HaveOccurred())
code, _ = bindings.CheckResponseCode(err)
- Expect(code).To(BeNumerically("==", http.StatusInternalServerError))
+ Expect(code).To(BeNumerically("==", http.StatusBadRequest))
})
It("remove digest", func() {
diff --git a/pkg/bindings/test/pods_test.go b/pkg/bindings/test/pods_test.go
index 1c93c5595..d47e9ee0e 100644
--- a/pkg/bindings/test/pods_test.go
+++ b/pkg/bindings/test/pods_test.go
@@ -43,13 +43,13 @@ var _ = Describe("Podman pods", func() {
})
It("inspect pod", func() {
- //Inspect an invalid pod name
+ // Inspect an invalid pod name
_, err := pods.Inspect(bt.conn, "dummyname", nil)
Expect(err).ToNot(BeNil())
code, _ := bindings.CheckResponseCode(err)
Expect(code).To(BeNumerically("==", http.StatusNotFound))
- //Inspect an valid pod name
+ // Inspect an valid pod name
response, err := pods.Inspect(bt.conn, newpod, nil)
Expect(err).To(BeNil())
Expect(response.Name).To(Equal(newpod))
@@ -57,7 +57,7 @@ var _ = Describe("Podman pods", func() {
// Test validates the list all api returns
It("list pod", func() {
- //List all the pods in the current instance
+ // List all the pods in the current instance
podSummary, err := pods.List(bt.conn, nil)
Expect(err).To(BeNil())
Expect(len(podSummary)).To(Equal(1))
diff --git a/pkg/bindings/test/volumes_test.go b/pkg/bindings/test/volumes_test.go
index c0d01439b..8ae93eed9 100644
--- a/pkg/bindings/test/volumes_test.go
+++ b/pkg/bindings/test/volumes_test.go
@@ -18,9 +18,6 @@ import (
var _ = Describe("Podman volumes", func() {
var (
- //tempdir string
- //err error
- //podmanTest *PodmanTestIntegration
bt *bindingTest
s *gexec.Session
connText context.Context
@@ -28,13 +25,6 @@ var _ = Describe("Podman volumes", func() {
)
BeforeEach(func() {
- //tempdir, err = CreateTempDirInTempDir()
- //if err != nil {
- // os.Exit(1)
- //}
- //podmanTest = PodmanTestCreate(tempdir)
- //podmanTest.Setup()
- //podmanTest.SeedImages()
bt = newBindingTest()
bt.RestoreImagesFromCache()
s = bt.startAPIService()
@@ -44,9 +34,6 @@ var _ = Describe("Podman volumes", func() {
})
AfterEach(func() {
- //podmanTest.Cleanup()
- //f := CurrentGinkgoTestDescription()
- //processTestResult(f)
s.Kill()
bt.cleanup()
})
diff --git a/pkg/domain/entities/containers.go b/pkg/domain/entities/containers.go
index ae60e5b96..1db8b9951 100644
--- a/pkg/domain/entities/containers.go
+++ b/pkg/domain/entities/containers.go
@@ -385,7 +385,7 @@ type ContainerInitReport struct {
Id string //nolint
}
-//ContainerMountOptions describes the input values for mounting containers
+// ContainerMountOptions describes the input values for mounting containers
// in the CLI
type ContainerMountOptions struct {
All bool
diff --git a/pkg/domain/entities/network.go b/pkg/domain/entities/network.go
index 134ad126a..0f901c7f1 100644
--- a/pkg/domain/entities/network.go
+++ b/pkg/domain/entities/network.go
@@ -33,7 +33,7 @@ type NetworkRmOptions struct {
Timeout *uint
}
-//NetworkRmReport describes the results of network removal
+// NetworkRmReport describes the results of network removal
type NetworkRmReport struct {
Name string
Err error
diff --git a/pkg/domain/entities/reports/prune.go b/pkg/domain/entities/reports/prune.go
index 219e35b67..497e5d606 100644
--- a/pkg/domain/entities/reports/prune.go
+++ b/pkg/domain/entities/reports/prune.go
@@ -34,7 +34,7 @@ func PruneReportsSize(r []*PruneReport) uint64 {
if v == nil {
continue
}
- size = size + v.Size
+ size += v.Size
}
return size
}
diff --git a/pkg/domain/infra/abi/containers.go b/pkg/domain/infra/abi/containers.go
index b56c36015..89b09bb1d 100644
--- a/pkg/domain/infra/abi/containers.go
+++ b/pkg/domain/infra/abi/containers.go
@@ -641,7 +641,11 @@ func (ic *ContainerEngine) ContainerRestore(ctx context.Context, namesOrIds []st
}
restoreOptions.CheckpointImageID = img.ID()
mountPoint, err := img.Mount(ctx, nil, "")
- defer img.Unmount(true)
+ defer func() {
+ if err := img.Unmount(true); err != nil {
+ logrus.Errorf("Failed to unmount image: %v", err)
+ }
+ }()
if err != nil {
return nil, err
}
diff --git a/pkg/domain/infra/abi/images.go b/pkg/domain/infra/abi/images.go
index 74478b26d..c3ec7dd8a 100644
--- a/pkg/domain/infra/abi/images.go
+++ b/pkg/domain/infra/abi/images.go
@@ -785,12 +785,19 @@ func transferRootless(source entities.ImageScpOptions, dest entities.ImageScpOpt
return cmdLoad.Run()
}
-// TransferRootful creates new podman processes using exec.Command and a new uid/gid alongside a cleared environment
+// transferRootful creates new podman processes using exec.Command and a new uid/gid alongside a cleared environment
func transferRootful(source entities.ImageScpOptions, dest entities.ImageScpOptions, podman string, parentFlags []string) error {
- basicCommand := []string{podman}
+ basicCommand := make([]string, 0, len(parentFlags)+1)
+ basicCommand = append(basicCommand, podman)
basicCommand = append(basicCommand, parentFlags...)
- saveCommand := append(basicCommand, "save")
- loadCommand := append(basicCommand, "load")
+
+ saveCommand := make([]string, 0, len(basicCommand)+4)
+ saveCommand = append(saveCommand, basicCommand...)
+ saveCommand = append(saveCommand, "save")
+
+ loadCommand := make([]string, 0, len(basicCommand)+3)
+ loadCommand = append(loadCommand, basicCommand...)
+ loadCommand = append(loadCommand, "load")
if source.Quiet {
saveCommand = append(saveCommand, "-q")
loadCommand = append(loadCommand, "-q")
diff --git a/pkg/domain/infra/abi/parse/parse.go b/pkg/domain/infra/abi/parse/parse.go
index 2d1adab74..3bac2ef99 100644
--- a/pkg/domain/infra/abi/parse/parse.go
+++ b/pkg/domain/infra/abi/parse/parse.go
@@ -73,6 +73,11 @@ func VolumeOptions(opts map[string]string) ([]libpod.VolumeCreateOption, error)
finalVal = append(finalVal, o)
// set option "GID": "$gid"
volumeOptions["GID"] = splitO[1]
+ case "noquota":
+ logrus.Debugf("Removing noquota from options and adding WithVolumeDisableQuota")
+ libpodOptions = append(libpodOptions, libpod.WithVolumeDisableQuota())
+ // set option "NOQUOTA": "true"
+ volumeOptions["NOQUOTA"] = "true"
default:
finalVal = append(finalVal, o)
}
diff --git a/pkg/domain/infra/abi/play.go b/pkg/domain/infra/abi/play.go
index 1d347ed8c..0da07bab8 100644
--- a/pkg/domain/infra/abi/play.go
+++ b/pkg/domain/infra/abi/play.go
@@ -78,7 +78,11 @@ func (ic *ContainerEngine) PlayKube(ctx context.Context, body io.Reader, options
podTemplateSpec.ObjectMeta = podYAML.ObjectMeta
podTemplateSpec.Spec = podYAML.Spec
-
+ for name, val := range podYAML.Annotations {
+ if len(val) > define.MaxKubeAnnotation {
+ return nil, errors.Errorf("invalid annotation %q=%q value length exceeds Kubernetetes max %d", name, val, define.MaxKubeAnnotation)
+ }
+ }
for name, val := range options.Annotations {
if podYAML.Annotations == nil {
podYAML.Annotations = make(map[string]string)
@@ -199,18 +203,20 @@ func (ic *ContainerEngine) playKubePod(ctx context.Context, podName string, podY
return nil, err
}
- ns, networks, netOpts, err := specgen.ParseNetworkFlag(options.Networks)
- if err != nil {
- return nil, err
- }
+ if len(options.Networks) > 0 {
+ ns, networks, netOpts, err := specgen.ParseNetworkFlag(options.Networks)
+ if err != nil {
+ return nil, err
+ }
- if (ns.IsBridge() && len(networks) == 0) || ns.IsHost() {
- return nil, errors.Errorf("invalid value passed to --network: bridge or host networking must be configured in YAML")
- }
+ if (ns.IsBridge() && len(networks) == 0) || ns.IsHost() {
+ return nil, errors.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
+ podOpt.Net.Network = ns
+ podOpt.Net.Networks = networks
+ podOpt.Net.NetworkOptions = netOpts
+ }
// FIXME This is very hard to support properly with a good ux
if len(options.StaticIPs) > *ipIndex {
@@ -435,53 +441,51 @@ func (ic *ContainerEngine) playKubePod(ctx context.Context, podName string, podY
initContainers = append(initContainers, ctr)
}
for _, container := range podYAML.Spec.Containers {
- if !strings.Contains("infra", container.Name) {
- // Error out if the same name is used for more than one container
- if _, ok := ctrNames[container.Name]; ok {
- return nil, errors.Errorf("the pod %q is invalid; duplicate container name %q detected", podName, container.Name)
- }
- ctrNames[container.Name] = ""
- pulledImage, labels, err := ic.getImageAndLabelInfo(ctx, cwd, annotations, writer, container, options)
- if err != nil {
- return nil, err
- }
+ // Error out if the same name is used for more than one container
+ if _, ok := ctrNames[container.Name]; ok {
+ return nil, errors.Errorf("the pod %q is invalid; duplicate container name %q detected", podName, container.Name)
+ }
+ ctrNames[container.Name] = ""
+ pulledImage, labels, err := ic.getImageAndLabelInfo(ctx, cwd, annotations, writer, container, options)
+ if err != nil {
+ return nil, err
+ }
- for k, v := range podSpec.PodSpecGen.Labels { // add podYAML labels
- labels[k] = v
- }
+ for k, v := range podSpec.PodSpecGen.Labels { // add podYAML labels
+ labels[k] = v
+ }
- specgenOpts := kube.CtrSpecGenOptions{
- Annotations: annotations,
- Container: container,
- Image: pulledImage,
- Volumes: volumes,
- PodID: pod.ID(),
- PodName: podName,
- PodInfraID: podInfraID,
- ConfigMaps: configMaps,
- SeccompPaths: seccompPaths,
- RestartPolicy: ctrRestartPolicy,
- NetNSIsHost: p.NetNS.IsHost(),
- SecretsManager: secretsManager,
- LogDriver: options.LogDriver,
- LogOptions: options.LogOptions,
- Labels: labels,
- }
- specGen, err := kube.ToSpecGen(ctx, &specgenOpts)
- if err != nil {
- return nil, err
- }
- specGen.RawImageName = container.Image
- rtSpec, spec, opts, err := generate.MakeContainer(ctx, ic.Libpod, specGen, false, nil)
- if err != nil {
- return nil, err
- }
- ctr, err := generate.ExecuteCreate(ctx, ic.Libpod, rtSpec, spec, false, opts...)
- if err != nil {
- return nil, err
- }
- containers = append(containers, ctr)
+ specgenOpts := kube.CtrSpecGenOptions{
+ Annotations: annotations,
+ Container: container,
+ Image: pulledImage,
+ Volumes: volumes,
+ PodID: pod.ID(),
+ PodName: podName,
+ PodInfraID: podInfraID,
+ ConfigMaps: configMaps,
+ SeccompPaths: seccompPaths,
+ RestartPolicy: ctrRestartPolicy,
+ NetNSIsHost: p.NetNS.IsHost(),
+ SecretsManager: secretsManager,
+ LogDriver: options.LogDriver,
+ LogOptions: options.LogOptions,
+ Labels: labels,
+ }
+ specGen, err := kube.ToSpecGen(ctx, &specgenOpts)
+ if err != nil {
+ return nil, err
+ }
+ specGen.RawImageName = container.Image
+ rtSpec, spec, opts, err := generate.MakeContainer(ctx, ic.Libpod, specGen, false, nil)
+ if err != nil {
+ return nil, err
+ }
+ ctr, err := generate.ExecuteCreate(ctx, ic.Libpod, rtSpec, spec, false, opts...)
+ if err != nil {
+ return nil, err
}
+ containers = append(containers, ctr)
}
if options.Start != types.OptionalBoolFalse {
@@ -770,7 +774,7 @@ func getBuildFile(imageName string, cwd string) (string, error) {
logrus.Error(err.Error())
}
- _, err = os.Stat(filepath.Join(dockerfilePath))
+ _, err = os.Stat(dockerfilePath)
if err == nil {
logrus.Debugf("Building %s with %s", imageName, dockerfilePath)
return dockerfilePath, nil
diff --git a/pkg/domain/infra/abi/system.go b/pkg/domain/infra/abi/system.go
index 4361821d5..8e96e4154 100644
--- a/pkg/domain/infra/abi/system.go
+++ b/pkg/domain/infra/abi/system.go
@@ -150,7 +150,7 @@ func (ic *ContainerEngine) SystemPrune(ctx context.Context, options entities.Sys
if err != nil {
return nil, err
}
- reclaimedSpace = reclaimedSpace + reports.PruneReportsSize(containerPruneReports)
+ reclaimedSpace += reports.PruneReportsSize(containerPruneReports)
systemPruneReport.ContainerPruneReports = append(systemPruneReport.ContainerPruneReports, containerPruneReports...)
imagePruneOptions := entities.ImagePruneOptions{
All: options.All,
@@ -158,7 +158,7 @@ func (ic *ContainerEngine) SystemPrune(ctx context.Context, options entities.Sys
}
imageEngine := ImageEngine{Libpod: ic.Libpod}
imagePruneReports, err := imageEngine.Prune(ctx, imagePruneOptions)
- reclaimedSpace = reclaimedSpace + reports.PruneReportsSize(imagePruneReports)
+ reclaimedSpace += reports.PruneReportsSize(imagePruneReports)
if err != nil {
return nil, err
@@ -178,7 +178,7 @@ func (ic *ContainerEngine) SystemPrune(ctx context.Context, options entities.Sys
if len(volumePruneReport) > 0 {
found = true
}
- reclaimedSpace = reclaimedSpace + reports.PruneReportsSize(volumePruneReport)
+ reclaimedSpace += reports.PruneReportsSize(volumePruneReport)
systemPruneReport.VolumePruneReports = append(systemPruneReport.VolumePruneReports, volumePruneReport...)
}
}
diff --git a/pkg/domain/infra/abi/trust.go b/pkg/domain/infra/abi/trust.go
index d53fe16d1..58f099bb6 100644
--- a/pkg/domain/infra/abi/trust.go
+++ b/pkg/domain/infra/abi/trust.go
@@ -142,15 +142,15 @@ func getPolicyShowOutput(policyContentStruct trust.PolicyContent, systemRegistri
Type: trustTypeDescription(repoval[0].Type),
}
// TODO - keyarr is not used and I don't know its intent; commenting out for now for someone to fix later
- //keyarr := []string{}
+ // keyarr := []string{}
uids := []string{}
for _, repoele := range repoval {
if len(repoele.KeyPath) > 0 {
- //keyarr = append(keyarr, repoele.KeyPath)
+ // keyarr = append(keyarr, repoele.KeyPath)
uids = append(uids, trust.GetGPGIdFromKeyPath(repoele.KeyPath)...)
}
if len(repoele.KeyData) > 0 {
- //keyarr = append(keyarr, string(repoele.KeyData))
+ // keyarr = append(keyarr, string(repoele.KeyData))
uids = append(uids, trust.GetGPGIdFromKeyData(repoele.KeyData)...)
}
}
diff --git a/pkg/hooks/monitor_test.go b/pkg/hooks/monitor_test.go
index dc67eaf83..eed02e033 100644
--- a/pkg/hooks/monitor_test.go
+++ b/pkg/hooks/monitor_test.go
@@ -226,7 +226,7 @@ func TestMonitorTwoDirGood(t *testing.T) {
assert.Equal(t, primaryInjected, config.Hooks) // masked by primary
})
- primaryPath2 := filepath.Join(primaryDir, "0a.json") //0a because it will be before a.json alphabetically
+ primaryPath2 := filepath.Join(primaryDir, "0a.json") // 0a because it will be before a.json alphabetically
t.Run("bad-primary-new-addition", func(t *testing.T) {
err = ioutil.WriteFile(primaryPath2, []byte("{\"version\": \"-1\"}"), 0644)
diff --git a/pkg/k8s.io/api/core/v1/types.go b/pkg/k8s.io/api/core/v1/types.go
index a488e5f28..48f353cc6 100644
--- a/pkg/k8s.io/api/core/v1/types.go
+++ b/pkg/k8s.io/api/core/v1/types.go
@@ -1514,7 +1514,7 @@ const (
// by the node selector terms.
// +structType=atomic
type NodeSelector struct {
- //Required. A list of node selector terms. The terms are ORed.
+ // Required. A list of node selector terms. The terms are ORed.
NodeSelectorTerms []NodeSelectorTerm `json:"nodeSelectorTerms"`
}
@@ -3040,7 +3040,7 @@ type ServiceSpec struct {
SessionAffinityConfig *SessionAffinityConfig `json:"sessionAffinityConfig,omitempty"`
// TopologyKeys is tombstoned to show why 16 is reserved protobuf tag.
- //TopologyKeys []string `json:"topologyKeys,omitempty"`
+ // TopologyKeys []string `json:"topologyKeys,omitempty"`
// IPFamily is tombstoned to show why 15 is a reserved protobuf tag.
// IPFamily *IPFamily `json:"ipFamily,omitempty"`
diff --git a/pkg/k8s.io/apimachinery/pkg/api/resource/amount.go b/pkg/k8s.io/apimachinery/pkg/api/resource/amount.go
index a8866a43e..9f76f9154 100644
--- a/pkg/k8s.io/apimachinery/pkg/api/resource/amount.go
+++ b/pkg/k8s.io/apimachinery/pkg/api/resource/amount.go
@@ -231,13 +231,13 @@ func (a int64Amount) AsCanonicalBytes(out []byte) (result []byte, exponent int32
if !ok {
return infDecAmount{a.AsDec()}.AsCanonicalBytes(out)
}
- exponent = exponent - 1
+ exponent--
case 2, -1:
amount, ok = int64MultiplyScale100(amount)
if !ok {
return infDecAmount{a.AsDec()}.AsCanonicalBytes(out)
}
- exponent = exponent - 2
+ exponent -= 2
}
return strconv.AppendInt(out, amount, 10), exponent
}
diff --git a/pkg/k8s.io/apimachinery/pkg/api/resource/math.go b/pkg/k8s.io/apimachinery/pkg/api/resource/math.go
index 7b4fa5a36..9d03f5c05 100644
--- a/pkg/k8s.io/apimachinery/pkg/api/resource/math.go
+++ b/pkg/k8s.io/apimachinery/pkg/api/resource/math.go
@@ -171,7 +171,7 @@ func negativeScaleInt64(base int64, scale Scale) (result int64, exact bool) {
if !fraction && value%10 != 0 {
fraction = true
}
- value = value / 10
+ value /= 10
if value == 0 {
if fraction {
if base > 0 {
@@ -265,18 +265,18 @@ func removeInt64Factors(value int64, base int64) (result int64, times int32) {
case 10:
for result >= 10 && result%10 == 0 {
times++
- result = result / 10
+ result /= 10
}
// allow the compiler to optimize the common cases
case 1024:
for result >= 1024 && result%1024 == 0 {
times++
- result = result / 1024
+ result /= 1024
}
default:
for result >= base && result%base == 0 {
times++
- result = result / base
+ result /= base
}
}
if negative {
diff --git a/pkg/k8s.io/apimachinery/pkg/apis/meta/v1/types.go b/pkg/k8s.io/apimachinery/pkg/apis/meta/v1/types.go
index 697817774..39073c06b 100644
--- a/pkg/k8s.io/apimachinery/pkg/apis/meta/v1/types.go
+++ b/pkg/k8s.io/apimachinery/pkg/apis/meta/v1/types.go
@@ -1156,7 +1156,7 @@ type ManagedFieldsEntry struct {
Time *Time `json:"time,omitempty"`
// Fields is tombstoned to show why 5 is a reserved protobuf tag.
- //Fields *Fields `json:"fields,omitempty"`
+ // Fields *Fields `json:"fields,omitempty"`
// FieldsType is the discriminator for the different fields format and version.
// There is currently only one possible value: "FieldsV1"
diff --git a/pkg/lookup/lookup.go b/pkg/lookup/lookup.go
index 0601e829d..b8ac3046e 100644
--- a/pkg/lookup/lookup.go
+++ b/pkg/lookup/lookup.go
@@ -61,7 +61,7 @@ func GetUserGroupInfo(containerMount, containerUser string, override *Overrides)
defaultExecUser = override.DefaultUser
} else {
// Define a default container user
- //defaultExecUser = &user.ExecUser{
+ // defaultExecUser = &user.ExecUser{
// Uid: 0,
// Gid: 0,
// Home: "/",
diff --git a/pkg/machine/config.go b/pkg/machine/config.go
index 1103933cd..9a0ce757a 100644
--- a/pkg/machine/config.go
+++ b/pkg/machine/config.go
@@ -4,6 +4,8 @@
package machine
import (
+ errors2 "errors"
+ "io/ioutil"
"net"
"net/url"
"os"
@@ -12,6 +14,7 @@ import (
"github.com/containers/storage/pkg/homedir"
"github.com/pkg/errors"
+ "github.com/sirupsen/logrus"
)
type InitOptions struct {
@@ -68,7 +71,7 @@ type Download struct {
Artifact string
CompressionType string
Format string
- ImageName string `json:"image_name"`
+ ImageName string
LocalPath string
LocalUncompressedFile string
Sha256sum string
@@ -95,7 +98,10 @@ type ListResponse struct {
}
type SetOptions struct {
- Rootful bool
+ CPUs *uint64
+ DiskSize *uint64
+ Memory *uint64
+ Rootful *bool
}
type SSHOptions struct {
@@ -117,8 +123,9 @@ type InspectOptions struct{}
type VM interface {
Init(opts InitOptions) (bool, error)
+ Inspect() (*InspectInfo, error)
Remove(name string, opts RemoveOptions) (string, func() error, error)
- Set(name string, opts SetOptions) error
+ Set(name string, opts SetOptions) ([]error, error)
SSH(name string, opts SSHOptions) error
Start(name string, opts StartOptions) error
State(bypass bool) (Status, error)
@@ -130,12 +137,18 @@ type DistributionDownload interface {
Get() *Download
}
type InspectInfo struct {
- State Status
- VM
+ ConfigPath VMFile
+ Created time.Time
+ Image ImageConfig
+ LastUp time.Time
+ Name string
+ Resources ResourceConfig
+ SSHConfig SSHConfig
+ State Status
}
func (rc RemoteConnectionType) MakeSSHURL(host, path, port, userName string) url.URL {
- //TODO Should this function have input verification?
+ // TODO Should this function have input verification?
userInfo := url.User(userName)
uri := url.URL{
Scheme: "ssh",
@@ -183,3 +196,121 @@ func GetConfDir(vmType string) (string, error) {
mkdirErr := os.MkdirAll(confDir, 0755)
return confDir, mkdirErr
}
+
+// ResourceConfig describes physical attributes of the machine
+type ResourceConfig struct {
+ // CPUs to be assigned to the VM
+ CPUs uint64
+ // Disk size in gigabytes assigned to the vm
+ DiskSize uint64
+ // Memory in megabytes assigned to the vm
+ Memory uint64
+}
+
+const maxSocketPathLength int = 103
+
+type VMFile struct {
+ // Path is the fully qualified path to a file
+ Path string
+ // Symlink is a shortened version of Path by using
+ // a symlink
+ Symlink *string `json:"symlink,omitempty"`
+}
+
+// GetPath returns the working path for a machinefile. it returns
+// the symlink unless one does not exist
+func (m *VMFile) GetPath() string {
+ if m.Symlink == nil {
+ return m.Path
+ }
+ return *m.Symlink
+}
+
+// Delete removes the machinefile symlink (if it exists) and
+// the actual path
+func (m *VMFile) Delete() error {
+ if m.Symlink != nil {
+ if err := os.Remove(*m.Symlink); err != nil && !errors2.Is(err, os.ErrNotExist) {
+ logrus.Errorf("unable to remove symlink %q", *m.Symlink)
+ }
+ }
+ if err := os.Remove(m.Path); err != nil && !errors2.Is(err, os.ErrNotExist) {
+ return err
+ }
+ return nil
+}
+
+// Read the contents of a given file and return in []bytes
+func (m *VMFile) Read() ([]byte, error) {
+ return ioutil.ReadFile(m.GetPath())
+}
+
+// NewMachineFile is a constructor for VMFile
+func NewMachineFile(path string, symlink *string) (*VMFile, error) {
+ if len(path) < 1 {
+ return nil, errors2.New("invalid machine file path")
+ }
+ if symlink != nil && len(*symlink) < 1 {
+ return nil, errors2.New("invalid symlink path")
+ }
+ mf := VMFile{Path: path}
+ if symlink != nil && len(path) > maxSocketPathLength {
+ if err := mf.makeSymlink(symlink); err != nil && !errors2.Is(err, os.ErrExist) {
+ return nil, err
+ }
+ }
+ return &mf, nil
+}
+
+// makeSymlink for macOS creates a symlink in $HOME/.podman/
+// for a machinefile like a socket
+func (m *VMFile) makeSymlink(symlink *string) error {
+ homedir, err := os.UserHomeDir()
+ if err != nil {
+ return err
+ }
+ sl := filepath.Join(homedir, ".podman", *symlink)
+ // make the symlink dir and throw away if it already exists
+ if err := os.MkdirAll(filepath.Dir(sl), 0700); err != nil && !errors2.Is(err, os.ErrNotExist) {
+ return err
+ }
+ m.Symlink = &sl
+ return os.Symlink(m.Path, sl)
+}
+
+type Mount struct {
+ ReadOnly bool
+ Source string
+ Tag string
+ Target string
+ Type string
+}
+
+// ImageConfig describes the bootable image for the VM
+type ImageConfig struct {
+ // IgnitionFile is the path to the filesystem where the
+ // ignition file was written (if needs one)
+ IgnitionFile VMFile `json:"IgnitionFilePath"`
+ // ImageStream is the update stream for the image
+ ImageStream string
+ // ImageFile is the fq path to
+ ImagePath VMFile `json:"ImagePath"`
+}
+
+// HostUser describes the host user
+type HostUser struct {
+ // Whether this machine should run in a rootful or rootless manner
+ Rootful bool
+ // UID is the numerical id of the user that called machine
+ UID int
+}
+
+// SSHConfig contains remote access information for SSH
+type SSHConfig struct {
+ // IdentityPath is the fq path to the ssh priv key
+ IdentityPath string
+ // SSH port for user networking
+ Port int
+ // RemoteUsername of the vm user
+ RemoteUsername string
+}
diff --git a/pkg/machine/e2e/config.go b/pkg/machine/e2e/config.go
index 7d75ca6bc..c17b840d3 100644
--- a/pkg/machine/e2e/config.go
+++ b/pkg/machine/e2e/config.go
@@ -131,7 +131,7 @@ func (m *machineTestBuilder) setTimeout(timeout time.Duration) *machineTestBuild
func (mb *machineTestBuilder) toQemuInspectInfo() ([]qemuMachineInspectInfo, int, error) {
args := []string{"machine", "inspect"}
args = append(args, mb.names...)
- session, err := runWrapper(mb.podmanBinary, args, defaultTimeout)
+ session, err := runWrapper(mb.podmanBinary, args, defaultTimeout, true)
if err != nil {
return nil, -1, err
}
@@ -140,11 +140,15 @@ func (mb *machineTestBuilder) toQemuInspectInfo() ([]qemuMachineInspectInfo, int
return mii, session.ExitCode(), err
}
+func (m *machineTestBuilder) runWithoutWait() (*machineSession, error) {
+ return runWrapper(m.podmanBinary, m.cmd, m.timeout, false)
+}
+
func (m *machineTestBuilder) run() (*machineSession, error) {
- return runWrapper(m.podmanBinary, m.cmd, m.timeout)
+ return runWrapper(m.podmanBinary, m.cmd, m.timeout, true)
}
-func runWrapper(podmanBinary string, cmdArgs []string, timeout time.Duration) (*machineSession, error) {
+func runWrapper(podmanBinary string, cmdArgs []string, timeout time.Duration, wait bool) (*machineSession, error) {
if len(os.Getenv("DEBUG")) > 0 {
cmdArgs = append([]string{"--log-level=debug"}, cmdArgs...)
}
@@ -156,8 +160,10 @@ func runWrapper(podmanBinary string, cmdArgs []string, timeout time.Duration) (*
return nil, err
}
ms := machineSession{session}
- ms.waitWithTimeout(timeout)
- fmt.Println("output:", ms.outputToString())
+ if wait {
+ ms.waitWithTimeout(timeout)
+ fmt.Println("output:", ms.outputToString())
+ }
return &ms, nil
}
diff --git a/pkg/machine/e2e/config_init.go b/pkg/machine/e2e/config_init.go
index 55218221d..2340a1133 100644
--- a/pkg/machine/e2e/config_init.go
+++ b/pkg/machine/e2e/config_init.go
@@ -12,7 +12,7 @@ type initMachine struct {
--image-path string Path to qcow image (default "testing")
-m, --memory uint Memory in MB (default 2048)
--now Start machine now
- --rootful Whether this machine should prefer rootful container exectution
+ --rootful Whether this machine should prefer rootful container execution
--timezone string Set timezone (default "local")
-v, --volume stringArray Volumes to mount, source:target
--volume-driver string Optional volume driver
diff --git a/pkg/machine/e2e/config_set.go b/pkg/machine/e2e/config_set.go
new file mode 100644
index 000000000..b310ab1b9
--- /dev/null
+++ b/pkg/machine/e2e/config_set.go
@@ -0,0 +1,43 @@
+package e2e
+
+import (
+ "strconv"
+)
+
+type setMachine struct {
+ cpus *uint
+ diskSize *uint
+ memory *uint
+
+ cmd []string
+}
+
+func (i *setMachine) buildCmd(m *machineTestBuilder) []string {
+ cmd := []string{"machine", "set"}
+ if i.cpus != nil {
+ cmd = append(cmd, "--cpus", strconv.Itoa(int(*i.cpus)))
+ }
+ if i.diskSize != nil {
+ cmd = append(cmd, "--disk-size", strconv.Itoa(int(*i.diskSize)))
+ }
+ if i.memory != nil {
+ cmd = append(cmd, "--memory", strconv.Itoa(int(*i.memory)))
+ }
+ cmd = append(cmd, m.name)
+ i.cmd = cmd
+ return cmd
+}
+
+func (i *setMachine) withCPUs(num uint) *setMachine {
+ i.cpus = &num
+ return i
+}
+func (i *setMachine) withDiskSize(size uint) *setMachine {
+ i.diskSize = &size
+ return i
+}
+
+func (i *setMachine) withMemory(num uint) *setMachine {
+ i.memory = &num
+ return i
+}
diff --git a/pkg/machine/e2e/init_test.go b/pkg/machine/e2e/init_test.go
index 309d460a9..304122738 100644
--- a/pkg/machine/e2e/init_test.go
+++ b/pkg/machine/e2e/init_test.go
@@ -28,13 +28,13 @@ var _ = Describe("podman machine init", func() {
reallyLongName := "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"
session, err := mb.setName(reallyLongName).setCmd(&i).run()
Expect(err).To(BeNil())
- Expect(session.ExitCode()).To(Equal(125))
+ Expect(session).To(Exit(125))
})
It("simple init", func() {
i := new(initMachine)
session, err := mb.setCmd(i.withImagePath(mb.imagePath)).run()
Expect(err).To(BeNil())
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).To(Exit(0))
inspectBefore, ec, err := mb.toQemuInspectInfo()
Expect(err).To(BeNil())
@@ -52,7 +52,7 @@ var _ = Describe("podman machine init", func() {
i := initMachine{}
session, err := mb.setCmd(i.withImagePath(mb.imagePath)).run()
Expect(err).To(BeNil())
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).To(Exit(0))
inspectBefore, ec, err := mb.toQemuInspectInfo()
Expect(ec).To(BeZero())
diff --git a/pkg/machine/e2e/inspect_test.go b/pkg/machine/e2e/inspect_test.go
index 30d810b8f..e282dd21d 100644
--- a/pkg/machine/e2e/inspect_test.go
+++ b/pkg/machine/e2e/inspect_test.go
@@ -7,6 +7,7 @@ import (
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
+ . "github.com/onsi/gomega/gexec"
)
var _ = Describe("podman machine stop", func() {
@@ -27,24 +28,24 @@ var _ = Describe("podman machine stop", func() {
reallyLongName := "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"
session, err := mb.setName(reallyLongName).setCmd(&i).run()
Expect(err).To(BeNil())
- Expect(session.ExitCode()).To(Equal(125))
+ Expect(session).To(Exit(125))
})
It("inspect two machines", func() {
i := new(initMachine)
foo1, err := mb.setName("foo1").setCmd(i.withImagePath(mb.imagePath)).run()
Expect(err).To(BeNil())
- Expect(foo1.ExitCode()).To(Equal(0))
+ Expect(foo1).To(Exit(0))
ii := new(initMachine)
foo2, err := mb.setName("foo2").setCmd(ii.withImagePath(mb.imagePath)).run()
Expect(err).To(BeNil())
- Expect(foo2.ExitCode()).To(Equal(0))
+ Expect(foo2).To(Exit(0))
inspect := new(inspectMachine)
inspectSession, err := mb.setName("foo1").setCmd(inspect).run()
Expect(err).To(BeNil())
- Expect(inspectSession.ExitCode()).To(Equal(0))
+ Expect(inspectSession).To(Exit(0))
type fakeInfos struct {
Status string
diff --git a/pkg/machine/e2e/list_test.go b/pkg/machine/e2e/list_test.go
index e7a439945..0ce9063f9 100644
--- a/pkg/machine/e2e/list_test.go
+++ b/pkg/machine/e2e/list_test.go
@@ -70,6 +70,33 @@ var _ = Describe("podman machine list", func() {
Expect(util.StringInSlice(name1, listNames)).To(BeTrue())
Expect(util.StringInSlice(name2, listNames)).To(BeTrue())
})
+
+ It("list machine: check if running while starting", func() {
+ i := new(initMachine)
+ session, err := mb.setCmd(i.withImagePath(mb.imagePath)).run()
+ Expect(err).To(BeNil())
+ Expect(session).To(Exit(0))
+ s := new(startMachine)
+ startSession, err := mb.setCmd(s).runWithoutWait()
+ Expect(err).To(BeNil())
+ l := new(listMachine)
+ for { // needs to be infinite because we need to check if running when inspect returns to avoid race conditions.
+ listSession, err := mb.setCmd(l).run()
+ Expect(listSession).To(Exit(0))
+ Expect(err).To(BeNil())
+ if startSession.ExitCode() == -1 {
+ Expect(listSession.outputToString()).NotTo(ContainSubstring("Currently running"))
+ } else {
+ break
+ }
+ }
+ Expect(startSession).To(Exit(0))
+ listSession, err := mb.setCmd(l).run()
+ Expect(listSession).To(Exit(0))
+ Expect(err).To(BeNil())
+ Expect(listSession.outputToString()).To(ContainSubstring("Currently running"))
+ Expect(listSession.outputToString()).NotTo(ContainSubstring("Less than a second ago")) // check to make sure time created is accurate
+ })
})
func stripAsterisk(sl []string) {
diff --git a/pkg/machine/e2e/machine_test.go b/pkg/machine/e2e/machine_test.go
index 46fe18069..2b3b60b2b 100644
--- a/pkg/machine/e2e/machine_test.go
+++ b/pkg/machine/e2e/machine_test.go
@@ -116,7 +116,7 @@ func teardown(origHomeDir string, testDir string, mb *machineTestBuilder) {
s := new(stopMachine)
for _, name := range mb.names {
if _, err := mb.setName(name).setCmd(s).run(); err != nil {
- fmt.Printf("error occured rm'ing machine: %q\n", err)
+ fmt.Printf("error occurred rm'ing machine: %q\n", err)
}
}
if err := os.RemoveAll(testDir); err != nil {
diff --git a/pkg/machine/e2e/rm_test.go b/pkg/machine/e2e/rm_test.go
index 011da5dde..43b8c594c 100644
--- a/pkg/machine/e2e/rm_test.go
+++ b/pkg/machine/e2e/rm_test.go
@@ -3,6 +3,7 @@ package e2e
import (
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
+ . "github.com/onsi/gomega/gexec"
)
var _ = Describe("podman machine rm", func() {
@@ -23,14 +24,14 @@ var _ = Describe("podman machine rm", func() {
reallyLongName := "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"
session, err := mb.setName(reallyLongName).setCmd(&i).run()
Expect(err).To(BeNil())
- Expect(session.ExitCode()).To(Equal(125))
+ Expect(session).To(Exit(125))
})
It("Remove machine", func() {
i := new(initMachine)
session, err := mb.setCmd(i.withImagePath(mb.imagePath)).run()
Expect(err).To(BeNil())
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).To(Exit(0))
rm := rmMachine{}
_, err = mb.setCmd(rm.withForce()).run()
Expect(err).To(BeNil())
@@ -46,18 +47,18 @@ var _ = Describe("podman machine rm", func() {
i := new(initMachine)
session, err := mb.setCmd(i.withImagePath(mb.imagePath).withNow()).run()
Expect(err).To(BeNil())
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).To(Exit(0))
rm := new(rmMachine)
// Removing a running machine should fail
stop, err := mb.setCmd(rm).run()
Expect(err).To(BeNil())
- Expect(stop.ExitCode()).To(Equal(125))
+ Expect(stop).To(Exit(125))
// Removing again with force
stopAgain, err := mb.setCmd(rm.withForce()).run()
Expect(err).To(BeNil())
- Expect(stopAgain.ExitCode()).To(BeZero())
+ Expect(stopAgain).To(Exit(0))
// Inspect to be dead sure
_, ec, err := mb.toQemuInspectInfo()
diff --git a/pkg/machine/e2e/set_test.go b/pkg/machine/e2e/set_test.go
new file mode 100644
index 000000000..9af29c560
--- /dev/null
+++ b/pkg/machine/e2e/set_test.go
@@ -0,0 +1,134 @@
+package e2e
+
+import (
+ . "github.com/onsi/ginkgo"
+ . "github.com/onsi/gomega"
+ . "github.com/onsi/gomega/gexec"
+)
+
+var _ = Describe("podman machine set", func() {
+ var (
+ mb *machineTestBuilder
+ testDir string
+ )
+
+ BeforeEach(func() {
+ testDir, mb = setup()
+ })
+ AfterEach(func() {
+ teardown(originalHomeDir, testDir, mb)
+ })
+
+ It("set machine cpus", func() {
+ name := randomString(12)
+ i := new(initMachine)
+ session, err := mb.setName(name).setCmd(i.withImagePath(mb.imagePath)).run()
+ Expect(err).To(BeNil())
+ Expect(session).To(Exit(0))
+
+ set := setMachine{}
+ setSession, err := mb.setName(name).setCmd(set.withCPUs(2)).run()
+ Expect(err).To(BeNil())
+ Expect(setSession).To(Exit(0))
+
+ s := new(startMachine)
+ startSession, err := mb.setCmd(s).run()
+ Expect(err).To(BeNil())
+ Expect(startSession).To(Exit(0))
+
+ ssh2 := sshMachine{}
+ sshSession2, err := mb.setName(name).setCmd(ssh2.withSSHComand([]string{"lscpu", "|", "grep", "\"CPU(s):\"", "|", "head", "-1"})).run()
+ Expect(err).To(BeNil())
+ Expect(sshSession2).To(Exit(0))
+ Expect(sshSession2.outputToString()).To(ContainSubstring("2"))
+
+ // Setting a running machine results in 125
+ runner, err := mb.setName(name).setCmd(set.withCPUs(4)).run()
+ Expect(err).To(BeNil())
+ Expect(runner).To(Exit(125))
+ })
+
+ It("increase machine disk size", func() {
+ name := randomString(12)
+ i := new(initMachine)
+ session, err := mb.setName(name).setCmd(i.withImagePath(mb.imagePath)).run()
+ Expect(err).To(BeNil())
+ Expect(session).To(Exit(0))
+
+ set := setMachine{}
+ setSession, err := mb.setName(name).setCmd(set.withDiskSize(102)).run()
+ Expect(err).To(BeNil())
+ Expect(setSession).To(Exit(0))
+
+ // shrinking disk size iss verboten
+ shrink, err := mb.setName(name).setCmd(set.withDiskSize(5)).run()
+ Expect(err).To(BeNil())
+ Expect(shrink).To(Exit(125))
+
+ s := new(startMachine)
+ startSession, err := mb.setCmd(s).run()
+ Expect(err).To(BeNil())
+ Expect(startSession).To(Exit(0))
+
+ ssh2 := sshMachine{}
+ sshSession2, err := mb.setName(name).setCmd(ssh2.withSSHComand([]string{"sudo", "fdisk", "-l", "|", "grep", "Disk"})).run()
+ Expect(err).To(BeNil())
+ Expect(sshSession2).To(Exit(0))
+ Expect(sshSession2.outputToString()).To(ContainSubstring("102 GiB"))
+ })
+
+ It("set machine ram", func() {
+ name := randomString(12)
+ i := new(initMachine)
+ session, err := mb.setName(name).setCmd(i.withImagePath(mb.imagePath)).run()
+ Expect(err).To(BeNil())
+ Expect(session).To(Exit(0))
+
+ set := setMachine{}
+ setSession, err := mb.setName(name).setCmd(set.withMemory(4000)).run()
+ Expect(err).To(BeNil())
+ Expect(setSession).To(Exit(0))
+
+ s := new(startMachine)
+ startSession, err := mb.setCmd(s).run()
+ Expect(err).To(BeNil())
+ Expect(startSession).To(Exit(0))
+
+ ssh2 := sshMachine{}
+ sshSession2, err := mb.setName(name).setCmd(ssh2.withSSHComand([]string{"cat", "/proc/meminfo", "|", "numfmt", "--field", "2", "--from-unit=Ki", "--to-unit=Mi", "|", "sed", "'s/ kB/M/g'", "|", "grep", "MemTotal"})).run()
+ Expect(err).To(BeNil())
+ Expect(sshSession2).To(Exit(0))
+ Expect(sshSession2.outputToString()).To(ContainSubstring("3824"))
+ })
+
+ It("no settings should change if no flags", func() {
+ name := randomString(12)
+ i := new(initMachine)
+ session, err := mb.setName(name).setCmd(i.withImagePath(mb.imagePath)).run()
+ Expect(err).To(BeNil())
+ Expect(session).To(Exit(0))
+
+ set := setMachine{}
+ setSession, err := mb.setName(name).setCmd(&set).run()
+ Expect(err).To(BeNil())
+ Expect(setSession).To(Exit(0))
+
+ s := new(startMachine)
+ startSession, err := mb.setCmd(s).run()
+ Expect(err).To(BeNil())
+ Expect(startSession).To(Exit(0))
+
+ ssh2 := sshMachine{}
+ sshSession2, err := mb.setName(name).setCmd(ssh2.withSSHComand([]string{"lscpu", "|", "grep", "\"CPU(s):\"", "|", "head", "-1"})).run()
+ Expect(err).To(BeNil())
+ Expect(sshSession2).To(Exit(0))
+ Expect(sshSession2.outputToString()).To(ContainSubstring("1"))
+
+ ssh3 := sshMachine{}
+ sshSession3, err := mb.setName(name).setCmd(ssh3.withSSHComand([]string{"sudo", "fdisk", "-l", "|", "grep", "Disk"})).run()
+ Expect(err).To(BeNil())
+ Expect(sshSession3).To(Exit(0))
+ Expect(sshSession3.outputToString()).To(ContainSubstring("100 GiB"))
+ })
+
+})
diff --git a/pkg/machine/e2e/ssh_test.go b/pkg/machine/e2e/ssh_test.go
index 90296fa10..155d39a64 100644
--- a/pkg/machine/e2e/ssh_test.go
+++ b/pkg/machine/e2e/ssh_test.go
@@ -3,6 +3,7 @@ package e2e
import (
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
+ . "github.com/onsi/gomega/gexec"
)
var _ = Describe("podman machine ssh", func() {
@@ -23,7 +24,7 @@ var _ = Describe("podman machine ssh", func() {
ssh := sshMachine{}
session, err := mb.setName(name).setCmd(ssh).run()
Expect(err).To(BeNil())
- Expect(session.ExitCode()).To(Equal(125))
+ Expect(session).To(Exit(125))
// TODO seems like stderr is not being returned; re-enabled when fixed
//Expect(session.outputToString()).To(ContainSubstring("not exist"))
})
@@ -33,14 +34,14 @@ var _ = Describe("podman machine ssh", func() {
i := new(initMachine)
session, err := mb.setName(name).setCmd(i.withImagePath(mb.imagePath)).run()
Expect(err).To(BeNil())
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).To(Exit(0))
ssh := sshMachine{}
sshSession, err := mb.setName(name).setCmd(ssh).run()
Expect(err).To(BeNil())
// TODO seems like stderr is not being returned; re-enabled when fixed
//Expect(sshSession.outputToString()).To(ContainSubstring("is not running"))
- Expect(sshSession.ExitCode()).To(Equal(125))
+ Expect(sshSession).To(Exit(125))
})
It("ssh to running machine and check os-type", func() {
@@ -48,12 +49,12 @@ var _ = Describe("podman machine ssh", func() {
i := new(initMachine)
session, err := mb.setName(name).setCmd(i.withImagePath(mb.imagePath).withNow()).run()
Expect(err).To(BeNil())
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).To(Exit(0))
ssh := sshMachine{}
sshSession, err := mb.setName(name).setCmd(ssh.withSSHComand([]string{"cat", "/etc/os-release"})).run()
Expect(err).To(BeNil())
- Expect(sshSession.ExitCode()).To(Equal(0))
+ Expect(sshSession).To(Exit(0))
Expect(sshSession.outputToString()).To(ContainSubstring("Fedora CoreOS"))
})
})
diff --git a/pkg/machine/e2e/start_test.go b/pkg/machine/e2e/start_test.go
index 1cda0e8f1..1de66eb9a 100644
--- a/pkg/machine/e2e/start_test.go
+++ b/pkg/machine/e2e/start_test.go
@@ -4,6 +4,7 @@ import (
"github.com/containers/podman/v4/pkg/machine"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
+ . "github.com/onsi/gomega/gexec"
)
var _ = Describe("podman machine start", func() {
@@ -22,11 +23,11 @@ var _ = Describe("podman machine start", func() {
i := new(initMachine)
session, err := mb.setCmd(i.withImagePath(mb.imagePath)).run()
Expect(err).To(BeNil())
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).To(Exit(0))
s := new(startMachine)
startSession, err := mb.setCmd(s).run()
Expect(err).To(BeNil())
- Expect(startSession.ExitCode()).To(Equal(0))
+ Expect(startSession).To(Exit(0))
info, ec, err := mb.toQemuInspectInfo()
Expect(err).To(BeNil())
diff --git a/pkg/machine/e2e/stop_test.go b/pkg/machine/e2e/stop_test.go
index 5dee6a345..0c27045a6 100644
--- a/pkg/machine/e2e/stop_test.go
+++ b/pkg/machine/e2e/stop_test.go
@@ -3,6 +3,7 @@ package e2e
import (
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
+ . "github.com/onsi/gomega/gexec"
)
var _ = Describe("podman machine stop", func() {
@@ -23,24 +24,24 @@ var _ = Describe("podman machine stop", func() {
reallyLongName := "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"
session, err := mb.setName(reallyLongName).setCmd(&i).run()
Expect(err).To(BeNil())
- Expect(session.ExitCode()).To(Equal(125))
+ Expect(session).To(Exit(125))
})
It("Stop running machine", func() {
i := new(initMachine)
session, err := mb.setCmd(i.withImagePath(mb.imagePath).withNow()).run()
Expect(err).To(BeNil())
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).To(Exit(0))
stop := new(stopMachine)
// Removing a running machine should fail
stopSession, err := mb.setCmd(stop).run()
Expect(err).To(BeNil())
- Expect(stopSession.ExitCode()).To(Equal(0))
+ Expect(stopSession).To(Exit(0))
// Stopping it again should not result in an error
stopAgain, err := mb.setCmd(stop).run()
Expect(err).To(BeNil())
- Expect(stopAgain.ExitCode()).To(BeZero())
+ Expect(stopAgain).To(Exit((0)))
})
})
diff --git a/pkg/machine/fedora.go b/pkg/machine/fedora.go
index bed45c6da..14a173da6 100644
--- a/pkg/machine/fedora.go
+++ b/pkg/machine/fedora.go
@@ -21,6 +21,8 @@ const (
githubURL = "http://github.com/fedora-cloud/docker-brew-fedora/"
)
+var fedoraxzRegex = regexp.MustCompile(`fedora[^\"]+xz`)
+
type FedoraDownload struct {
Download
}
@@ -96,12 +98,8 @@ func getFedoraDownload(releaseStream string) (string, *url.URL, int64, error) {
return "", nil, -1, err
}
- rx, err := regexp.Compile(`fedora[^\"]+xz`)
- if err != nil {
- return "", nil, -1, err
- }
- file := rx.FindString(string(body))
- if len(file) <= 0 {
+ file := fedoraxzRegex.FindString(string(body))
+ if len(file) == 0 {
return "", nil, -1, fmt.Errorf("could not locate Fedora download at %s", dirURL)
}
diff --git a/pkg/machine/qemu/config.go b/pkg/machine/qemu/config.go
index 9473eef6f..56c95e3b3 100644
--- a/pkg/machine/qemu/config.go
+++ b/pkg/machine/qemu/config.go
@@ -4,13 +4,9 @@
package qemu
import (
- "errors"
- "io/ioutil"
- "os"
- "path/filepath"
"time"
- "github.com/sirupsen/logrus"
+ "github.com/containers/podman/v4/pkg/machine"
)
const (
@@ -23,7 +19,7 @@ const (
Stable string = "stable"
// Max length of fully qualified socket path
- maxSocketPathLength int = 103
+
)
type Provider struct{}
@@ -36,7 +32,7 @@ type MachineVMV1 struct {
// The command line representation of the qemu command
CmdLine []string
// Mounts is the list of remote filesystems to mount
- Mounts []Mount
+ Mounts []machine.Mount
// IdentityPath is the fq path to the ssh priv key
IdentityPath string
// IgnitionFilePath is the fq path to the .ign file
@@ -65,27 +61,27 @@ type MachineVMV1 struct {
type MachineVM struct {
// ConfigPath is the path to the configuration file
- ConfigPath MachineFile
+ ConfigPath machine.VMFile
// The command line representation of the qemu command
CmdLine []string
// HostUser contains info about host user
- HostUser
+ machine.HostUser
// ImageConfig describes the bootable image
- ImageConfig
+ machine.ImageConfig
// Mounts is the list of remote filesystems to mount
- Mounts []Mount
+ Mounts []machine.Mount
// Name of VM
Name string
// PidFilePath is the where the PID file lives
- PidFilePath MachineFile
+ PidFilePath machine.VMFile
// QMPMonitor is the qemu monitor object for sending commands
QMPMonitor Monitor
// ReadySocket tells host when vm is booted
- ReadySocket MachineFile
+ ReadySocket machine.VMFile
// ResourceConfig is physical attrs of the VM
- ResourceConfig
+ machine.ResourceConfig
// SSHConfig for accessing the remote vm
- SSHConfig
+ machine.SSHConfig
// Starting tells us whether the machine is running or if we have just dialed it to start it
Starting bool
// Created contains the original created time instead of querying the file mod time
@@ -94,59 +90,6 @@ type MachineVM struct {
LastUp time.Time
}
-// ImageConfig describes the bootable image for the VM
-type ImageConfig struct {
- IgnitionFilePath MachineFile
- // ImageStream is the update stream for the image
- ImageStream string
- // ImagePath is the fq path to
- ImagePath MachineFile
-}
-
-// HostUser describes the host user
-type HostUser struct {
- // Whether this machine should run in a rootful or rootless manner
- Rootful bool
- // UID is the numerical id of the user that called machine
- UID int
-}
-
-// SSHConfig contains remote access information for SSH
-type SSHConfig struct {
- // IdentityPath is the fq path to the ssh priv key
- IdentityPath string
- // SSH port for user networking
- Port int
- // RemoteUsername of the vm user
- RemoteUsername string
-}
-
-// ResourceConfig describes physical attributes of the machine
-type ResourceConfig struct {
- // CPUs to be assigned to the VM
- CPUs uint64
- // Memory in megabytes assigned to the vm
- Memory uint64
- // Disk size in gigabytes assigned to the vm
- DiskSize uint64
-}
-
-type MachineFile struct {
- // Path is the fully qualified path to a file
- Path string
- // Symlink is a shortened version of Path by using
- // a symlink
- Symlink *string
-}
-
-type Mount struct {
- Type string
- Tag string
- Source string
- Target string
- ReadOnly bool
-}
-
type Monitorv1 struct {
// Address portion of the qmp monitor (/tmp/tmp.sock)
Address string
@@ -158,7 +101,7 @@ type Monitorv1 struct {
type Monitor struct {
// Address portion of the qmp monitor (/tmp/tmp.sock)
- Address MachineFile
+ Address machine.VMFile
// Network portion of the qmp monitor (unix)
Network string
// Timeout in seconds for qmp monitor transactions
@@ -170,64 +113,3 @@ var (
// qmp monitor interactions.
defaultQMPTimeout = 2 * time.Second
)
-
-// GetPath returns the working path for a machinefile. it returns
-// the symlink unless one does not exist
-func (m *MachineFile) GetPath() string {
- if m.Symlink == nil {
- return m.Path
- }
- return *m.Symlink
-}
-
-// Delete removes the machinefile symlink (if it exists) and
-// the actual path
-func (m *MachineFile) Delete() error {
- if m.Symlink != nil {
- if err := os.Remove(*m.Symlink); err != nil && !errors.Is(err, os.ErrNotExist) {
- logrus.Errorf("unable to remove symlink %q", *m.Symlink)
- }
- }
- if err := os.Remove(m.Path); err != nil && !errors.Is(err, os.ErrNotExist) {
- return err
- }
- return nil
-}
-
-// Read the contents of a given file and return in []bytes
-func (m *MachineFile) Read() ([]byte, error) {
- return ioutil.ReadFile(m.GetPath())
-}
-
-// NewMachineFile is a constructor for MachineFile
-func NewMachineFile(path string, symlink *string) (*MachineFile, error) {
- if len(path) < 1 {
- return nil, errors.New("invalid machine file path")
- }
- if symlink != nil && len(*symlink) < 1 {
- return nil, errors.New("invalid symlink path")
- }
- mf := MachineFile{Path: path}
- if symlink != nil && len(path) > maxSocketPathLength {
- if err := mf.makeSymlink(symlink); err != nil && !errors.Is(err, os.ErrExist) {
- return nil, err
- }
- }
- return &mf, nil
-}
-
-// makeSymlink for macOS creates a symlink in $HOME/.podman/
-// for a machinefile like a socket
-func (m *MachineFile) makeSymlink(symlink *string) error {
- homedir, err := os.UserHomeDir()
- if err != nil {
- return err
- }
- sl := filepath.Join(homedir, ".podman", *symlink)
- // make the symlink dir and throw away if it already exists
- if err := os.MkdirAll(filepath.Dir(sl), 0700); err != nil && !errors.Is(err, os.ErrNotExist) {
- return err
- }
- m.Symlink = &sl
- return os.Symlink(m.Path, sl)
-}
diff --git a/pkg/machine/qemu/config_test.go b/pkg/machine/qemu/config_test.go
index 264de9ae8..3f92881fa 100644
--- a/pkg/machine/qemu/config_test.go
+++ b/pkg/machine/qemu/config_test.go
@@ -6,6 +6,7 @@ import (
"reflect"
"testing"
+ "github.com/containers/podman/v4/pkg/machine"
"github.com/containers/podman/v4/test/utils"
)
@@ -37,7 +38,7 @@ func TestMachineFile_GetPath(t *testing.T) {
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
- m := &MachineFile{
+ m := &machine.VMFile{
Path: tt.fields.Path, //nolint: scopelint
Symlink: tt.fields.Symlink, //nolint: scopelint
}
@@ -67,13 +68,19 @@ func TestNewMachineFile(t *testing.T) {
p := "/var/tmp/podman/my.sock"
longp := filepath.Join(longTemp, utils.RandomString(100), "my.sock")
- os.MkdirAll(filepath.Dir(longp), 0755)
- f, _ := os.Create(longp)
- f.Close()
+ err = os.MkdirAll(filepath.Dir(longp), 0755)
+ if err != nil {
+ panic(err)
+ }
+ f, err := os.Create(longp)
+ if err != nil {
+ panic(err)
+ }
+ _ = f.Close()
sym := "my.sock"
longSym := filepath.Join(homedir, ".podman", sym)
- m := MachineFile{
+ m := machine.VMFile{
Path: p,
Symlink: nil,
}
@@ -84,7 +91,7 @@ func TestNewMachineFile(t *testing.T) {
tests := []struct {
name string
args args
- want *MachineFile
+ want *machine.VMFile
wantErr bool
}{
{
@@ -96,7 +103,7 @@ func TestNewMachineFile(t *testing.T) {
{
name: "Good with short symlink",
args: args{p, &sym},
- want: &MachineFile{p, nil},
+ want: &machine.VMFile{Path: p},
wantErr: false,
},
{
@@ -114,19 +121,20 @@ func TestNewMachineFile(t *testing.T) {
{
name: "Good with long symlink",
args: args{longp, &sym},
- want: &MachineFile{longp, &longSym},
+ want: &machine.VMFile{Path: longp, Symlink: &longSym},
wantErr: false,
},
}
for _, tt := range tests {
+ tt := tt
t.Run(tt.name, func(t *testing.T) {
- got, err := NewMachineFile(tt.args.path, tt.args.symlink) //nolint: scopelint
- if (err != nil) != tt.wantErr { //nolint: scopelint
- t.Errorf("NewMachineFile() error = %v, wantErr %v", err, tt.wantErr) //nolint: scopelint
+ got, err := machine.NewMachineFile(tt.args.path, tt.args.symlink)
+ if (err != nil) != tt.wantErr {
+ t.Errorf("NewMachineFile() error = %v, wantErr %v", err, tt.wantErr)
return
}
- if !reflect.DeepEqual(got, tt.want) { //nolint: scopelint
- t.Errorf("NewMachineFile() got = %v, want %v", got, tt.want) //nolint: scopelint
+ if !reflect.DeepEqual(got, tt.want) {
+ t.Errorf("NewMachineFile() got = %v, want %v", got, tt.want)
}
})
}
diff --git a/pkg/machine/qemu/machine.go b/pkg/machine/qemu/machine.go
index 969acb760..91e15c2af 100644
--- a/pkg/machine/qemu/machine.go
+++ b/pkg/machine/qemu/machine.go
@@ -71,12 +71,12 @@ func (p *Provider) NewMachine(opts machine.InitOptions) (machine.VM, error) {
if len(opts.Name) > 0 {
vm.Name = opts.Name
}
- ignitionFile, err := NewMachineFile(filepath.Join(vmConfigDir, vm.Name+".ign"), nil)
+ ignitionFile, err := machine.NewMachineFile(filepath.Join(vmConfigDir, vm.Name+".ign"), nil)
if err != nil {
return nil, err
}
- vm.IgnitionFilePath = *ignitionFile
- imagePath, err := NewMachineFile(opts.ImagePath, nil)
+ vm.IgnitionFile = *ignitionFile
+ imagePath, err := machine.NewMachineFile(opts.ImagePath, nil)
if err != nil {
return nil, err
}
@@ -105,14 +105,13 @@ func (p *Provider) NewMachine(opts machine.InitOptions) (machine.VM, error) {
if err != nil {
return nil, err
}
-
cmd := []string{execPath}
// Add memory
cmd = append(cmd, []string{"-m", strconv.Itoa(int(vm.Memory))}...)
// Add cpus
cmd = append(cmd, []string{"-smp", strconv.Itoa(int(vm.CPUs))}...)
// Add ignition file
- cmd = append(cmd, []string{"-fw_cfg", "name=opt/com.coreos/config,file=" + vm.IgnitionFilePath.GetPath()}...)
+ cmd = append(cmd, []string{"-fw_cfg", "name=opt/com.coreos/config,file=" + vm.IgnitionFile.GetPath()}...)
// Add qmp socket
monitor, err := NewQMPMonitor("unix", vm.Name, defaultQMPTimeout)
if err != nil {
@@ -158,9 +157,9 @@ func migrateVM(configPath string, config []byte, vm *MachineVM) error {
return err
}
- pidFilePath := MachineFile{Path: pidFile}
+ pidFilePath := machine.VMFile{Path: pidFile}
qmpMonitor := Monitor{
- Address: MachineFile{Path: old.QMPMonitor.Address},
+ Address: machine.VMFile{Path: old.QMPMonitor.Address},
Network: old.QMPMonitor.Network,
Timeout: old.QMPMonitor.Timeout,
}
@@ -169,18 +168,18 @@ func migrateVM(configPath string, config []byte, vm *MachineVM) error {
return err
}
virtualSocketPath := filepath.Join(socketPath, "podman", vm.Name+"_ready.sock")
- readySocket := MachineFile{Path: virtualSocketPath}
+ readySocket := machine.VMFile{Path: virtualSocketPath}
- vm.HostUser = HostUser{}
- vm.ImageConfig = ImageConfig{}
- vm.ResourceConfig = ResourceConfig{}
- vm.SSHConfig = SSHConfig{}
+ vm.HostUser = machine.HostUser{}
+ vm.ImageConfig = machine.ImageConfig{}
+ vm.ResourceConfig = machine.ResourceConfig{}
+ vm.SSHConfig = machine.SSHConfig{}
- ignitionFilePath, err := NewMachineFile(old.IgnitionFilePath, nil)
+ ignitionFilePath, err := machine.NewMachineFile(old.IgnitionFilePath, nil)
if err != nil {
return err
}
- imagePath, err := NewMachineFile(old.ImagePath, nil)
+ imagePath, err := machine.NewMachineFile(old.ImagePath, nil)
if err != nil {
return err
}
@@ -194,7 +193,7 @@ func migrateVM(configPath string, config []byte, vm *MachineVM) error {
vm.CmdLine = old.CmdLine
vm.DiskSize = old.DiskSize
vm.IdentityPath = old.IdentityPath
- vm.IgnitionFilePath = *ignitionFilePath
+ vm.IgnitionFile = *ignitionFilePath
vm.ImagePath = *imagePath
vm.ImageStream = old.ImageStream
vm.Memory = old.Memory
@@ -229,7 +228,7 @@ func migrateVM(configPath string, config []byte, vm *MachineVM) error {
// and returns a vm instance
func (p *Provider) LoadVMByName(name string) (machine.VM, error) {
vm := &MachineVM{Name: name}
- vm.HostUser = HostUser{UID: -1} // posix reserves -1, so use it to signify undefined
+ vm.HostUser = machine.HostUser{UID: -1} // posix reserves -1, so use it to signify undefined
if err := vm.update(); err != nil {
return nil, err
}
@@ -270,7 +269,7 @@ func (v *MachineVM) Init(opts machine.InitOptions) (bool, error) {
if err != nil {
return false, err
}
- uncompressedFile, err := NewMachineFile(dd.Get().LocalUncompressedFile, nil)
+ uncompressedFile, err := machine.NewMachineFile(dd.Get().LocalUncompressedFile, nil)
if err != nil {
return false, err
}
@@ -286,7 +285,7 @@ func (v *MachineVM) Init(opts machine.InitOptions) (bool, error) {
if err != nil {
return false, err
}
- imagePath, err := NewMachineFile(g.Get().LocalUncompressedFile, nil)
+ imagePath, err := machine.NewMachineFile(g.Get().LocalUncompressedFile, nil)
if err != nil {
return false, err
}
@@ -308,7 +307,7 @@ func (v *MachineVM) Init(opts machine.InitOptions) (bool, error) {
return false, err
}
- mounts := []Mount{}
+ mounts := []machine.Mount{}
for i, volume := range opts.Volumes {
tag := fmt.Sprintf("vol%d", i)
paths := strings.SplitN(volume, ":", 3)
@@ -332,14 +331,13 @@ func (v *MachineVM) Init(opts machine.InitOptions) (bool, error) {
}
}
}
- switch volumeType {
- case VolumeTypeVirtfs:
+ if volumeType == VolumeTypeVirtfs {
virtfsOptions := fmt.Sprintf("local,path=%s,mount_tag=%s,security_model=mapped-xattr", source, tag)
if readonly {
virtfsOptions += ",readonly"
}
v.CmdLine = append(v.CmdLine, []string{"-virtfs", virtfsOptions}...)
- mounts = append(mounts, Mount{Type: MountType9p, Tag: tag, Source: source, Target: target, ReadOnly: readonly})
+ mounts = append(mounts, machine.Mount{Type: MountType9p, Tag: tag, Source: source, Target: target, ReadOnly: readonly})
}
}
v.Mounts = mounts
@@ -391,25 +389,9 @@ func (v *MachineVM) Init(opts machine.InitOptions) (bool, error) {
if err != nil {
return false, err
}
- // Resize the disk image to input disk size
- // only if the virtualdisk size is less than
- // the given disk size
- if opts.DiskSize<<(10*3) > originalDiskSize {
- // Find the qemu executable
- cfg, err := config.Default()
- if err != nil {
- return false, err
- }
- resizePath, err := cfg.FindHelperBinary("qemu-img", true)
- if err != nil {
- return false, err
- }
- resize := exec.Command(resizePath, []string{"resize", v.getImageFile(), strconv.Itoa(int(opts.DiskSize)) + "G"}...)
- resize.Stdout = os.Stdout
- resize.Stderr = os.Stderr
- if err := resize.Run(); err != nil {
- return false, errors.Errorf("resizing image: %q", err)
- }
+
+ if err := v.resizeDisk(opts.DiskSize, originalDiskSize>>(10*3)); err != nil {
+ return false, err
}
// If the user provides an ignition file, we need to
// copy it into the conf dir
@@ -433,14 +415,14 @@ func (v *MachineVM) Init(opts machine.InitOptions) (bool, error) {
return err == nil, err
}
-func (v *MachineVM) Set(_ string, opts machine.SetOptions) error {
- if v.Rootful == opts.Rootful {
- return nil
- }
+func (v *MachineVM) Set(_ string, opts machine.SetOptions) ([]error, error) {
+ // If one setting fails to be applied, the others settings will not fail and still be applied.
+ // The setting(s) that failed to be applied will have its errors returned in setErrors
+ var setErrors []error
state, err := v.State(false)
if err != nil {
- return err
+ return setErrors, err
}
if state == machine.Running {
@@ -448,26 +430,45 @@ func (v *MachineVM) Set(_ string, opts machine.SetOptions) error {
if v.Name != machine.DefaultMachineName {
suffix = " " + v.Name
}
- return errors.Errorf("cannot change setting while the vm is running, run 'podman machine stop%s' first", suffix)
+ return setErrors, errors.Errorf("cannot change settings while the vm is running, run 'podman machine stop%s' first", suffix)
}
- changeCon, err := machine.AnyConnectionDefault(v.Name, v.Name+"-root")
- if err != nil {
- return err
+ if opts.Rootful != nil && v.Rootful != *opts.Rootful {
+ if err := v.setRootful(*opts.Rootful); err != nil {
+ setErrors = append(setErrors, errors.Wrapf(err, "failed to set rootful option"))
+ } else {
+ v.Rootful = *opts.Rootful
+ }
}
- if changeCon {
- newDefault := v.Name
- if opts.Rootful {
- newDefault += "-root"
- }
- if err := machine.ChangeDefault(newDefault); err != nil {
- return err
+ if opts.CPUs != nil && v.CPUs != *opts.CPUs {
+ v.CPUs = *opts.CPUs
+ v.editCmdLine("-smp", strconv.Itoa(int(v.CPUs)))
+ }
+
+ if opts.Memory != nil && v.Memory != *opts.Memory {
+ v.Memory = *opts.Memory
+ v.editCmdLine("-m", strconv.Itoa(int(v.Memory)))
+ }
+
+ if opts.DiskSize != nil && v.DiskSize != *opts.DiskSize {
+ if err := v.resizeDisk(*opts.DiskSize, v.DiskSize); err != nil {
+ setErrors = append(setErrors, errors.Wrapf(err, "failed to resize disk"))
+ } else {
+ v.DiskSize = *opts.DiskSize
}
}
- v.Rootful = opts.Rootful
- return v.writeConfig()
+ err = v.writeConfig()
+ if err != nil {
+ setErrors = append(setErrors, err)
+ }
+
+ if len(setErrors) > 0 {
+ return setErrors, setErrors[0]
+ }
+
+ return setErrors, nil
}
// Start executes the qemu command line and forks it
@@ -483,12 +484,11 @@ func (v *MachineVM) Start(name string, _ machine.StartOptions) error {
if err := v.writeConfig(); err != nil {
return fmt.Errorf("writing JSON file: %w", err)
}
- defer func() error {
+ defer func() {
v.Starting = false
if err := v.writeConfig(); err != nil {
- return fmt.Errorf("writing JSON file: %w", err)
+ logrus.Errorf("Writing JSON file: %v", err)
}
- return nil
}()
if v.isIncompatible() {
logrus.Errorf("machine %q is incompatible with this release of podman and needs to be recreated, starting for recovery only", v.Name)
@@ -783,7 +783,7 @@ func (v *MachineVM) Stop(_ string, _ machine.StopOptions) error {
break
}
time.Sleep(waitInternal)
- waitInternal = waitInternal * 2
+ waitInternal *= 2
}
return v.ReadySocket.Delete()
@@ -799,8 +799,7 @@ func NewQMPMonitor(network, name string, timeout time.Duration) (Monitor, error)
rtDir = "/run"
}
rtDir = filepath.Join(rtDir, "podman")
- if _, err := os.Stat(filepath.Join(rtDir)); os.IsNotExist(err) {
- // TODO 0644 is fine on linux but macos is weird
+ if _, err := os.Stat(rtDir); os.IsNotExist(err) {
if err := os.MkdirAll(rtDir, 0755); err != nil {
return Monitor{}, err
}
@@ -808,7 +807,7 @@ func NewQMPMonitor(network, name string, timeout time.Duration) (Monitor, error)
if timeout == 0 {
timeout = defaultQMPTimeout
}
- address, err := NewMachineFile(filepath.Join(rtDir, "qmp_"+name+".sock"), nil)
+ address, err := machine.NewMachineFile(filepath.Join(rtDir, "qmp_"+name+".sock"), nil)
if err != nil {
return Monitor{}, err
}
@@ -872,7 +871,7 @@ func (v *MachineVM) Remove(_ string, opts machine.RemoveOptions) (string, func()
confirmationMessage += msg + "\n"
}
- //remove socket and pid file if any: warn at low priority if things fail
+ // remove socket and pid file if any: warn at low priority if things fail
// Remove the pidfile
if err := v.PidFilePath.Delete(); err != nil {
logrus.Debugf("Error while removing pidfile: %v", err)
@@ -1065,11 +1064,11 @@ func getVMInfos() ([]*machine.ListResponse, error) {
return err
}
- if !vm.LastUp.IsZero() {
+ if !vm.LastUp.IsZero() { // this means we have already written a time to the config
listEntry.LastUp = vm.LastUp
- } else {
+ } else { // else we just created the machine AKA last up = created time
listEntry.LastUp = vm.Created
- vm.Created = time.Now()
+ vm.LastUp = listEntry.LastUp
if err := vm.writeConfig(); err != nil {
return err
}
@@ -1237,14 +1236,14 @@ func (v *MachineVM) userGlobalSocketLink() (string, error) {
return filepath.Join(filepath.Dir(path), "podman.sock"), err
}
-func (v *MachineVM) forwardSocketPath() (*MachineFile, error) {
+func (v *MachineVM) forwardSocketPath() (*machine.VMFile, error) {
sockName := "podman.sock"
path, err := machine.GetDataDir(v.Name)
if err != nil {
logrus.Errorf("Resolving data dir: %s", err.Error())
return nil, err
}
- return NewMachineFile(filepath.Join(path, sockName), &sockName)
+ return machine.NewMachineFile(filepath.Join(path, sockName), &sockName)
}
func (v *MachineVM) setConfigPath() error {
@@ -1253,7 +1252,7 @@ func (v *MachineVM) setConfigPath() error {
return err
}
- configPath, err := NewMachineFile(filepath.Join(vmConfigDir, v.Name)+".json", nil)
+ configPath, err := machine.NewMachineFile(filepath.Join(vmConfigDir, v.Name)+".json", nil)
if err != nil {
return err
}
@@ -1267,7 +1266,7 @@ func (v *MachineVM) setReadySocket() error {
if err != nil {
return err
}
- virtualSocketPath, err := NewMachineFile(filepath.Join(rtPath, "podman", readySocketName), &readySocketName)
+ virtualSocketPath, err := machine.NewMachineFile(filepath.Join(rtPath, "podman", readySocketName), &readySocketName)
if err != nil {
return err
}
@@ -1285,7 +1284,7 @@ func (v *MachineVM) setPIDSocket() error {
}
pidFileName := fmt.Sprintf("%s.pid", v.Name)
socketDir := filepath.Join(rtPath, "podman")
- pidFilePath, err := NewMachineFile(filepath.Join(socketDir, pidFileName), &pidFileName)
+ pidFilePath, err := machine.NewMachineFile(filepath.Join(socketDir, pidFileName), &pidFileName)
if err != nil {
return err
}
@@ -1462,5 +1461,85 @@ func (v *MachineVM) getImageFile() string {
// getIgnitionFile wrapper returns the path to the ignition file
func (v *MachineVM) getIgnitionFile() string {
- return v.IgnitionFilePath.GetPath()
+ return v.IgnitionFile.GetPath()
+}
+
+// Inspect returns verbose detail about the machine
+func (v *MachineVM) Inspect() (*machine.InspectInfo, error) {
+ state, err := v.State(false)
+ if err != nil {
+ return nil, err
+ }
+
+ return &machine.InspectInfo{
+ ConfigPath: v.ConfigPath,
+ Created: v.Created,
+ Image: v.ImageConfig,
+ LastUp: v.LastUp,
+ Name: v.Name,
+ Resources: v.ResourceConfig,
+ SSHConfig: v.SSHConfig,
+ State: state,
+ }, nil
+}
+
+// resizeDisk increases the size of the machine's disk in GB.
+func (v *MachineVM) resizeDisk(diskSize uint64, oldSize uint64) error {
+ // Resize the disk image to input disk size
+ // only if the virtualdisk size is less than
+ // the given disk size
+ if diskSize < oldSize {
+ return errors.Errorf("new disk size must be larger than current disk size: %vGB", oldSize)
+ }
+
+ // Find the qemu executable
+ cfg, err := config.Default()
+ if err != nil {
+ return err
+ }
+ resizePath, err := cfg.FindHelperBinary("qemu-img", true)
+ if err != nil {
+ return err
+ }
+ resize := exec.Command(resizePath, []string{"resize", v.getImageFile(), strconv.Itoa(int(diskSize)) + "G"}...)
+ resize.Stdout = os.Stdout
+ resize.Stderr = os.Stderr
+ if err := resize.Run(); err != nil {
+ return errors.Errorf("resizing image: %q", err)
+ }
+
+ return nil
+}
+
+func (v *MachineVM) setRootful(rootful bool) error {
+ changeCon, err := machine.AnyConnectionDefault(v.Name, v.Name+"-root")
+ if err != nil {
+ return err
+ }
+
+ if changeCon {
+ newDefault := v.Name
+ if rootful {
+ newDefault += "-root"
+ }
+ err := machine.ChangeDefault(newDefault)
+ if err != nil {
+ return err
+ }
+ }
+ return nil
+}
+
+func (v *MachineVM) editCmdLine(flag string, value string) {
+ found := false
+ for i, val := range v.CmdLine {
+ if val == flag {
+ found = true
+ v.CmdLine[i+1] = value
+ break
+ }
+ }
+ if !found {
+ v.CmdLine = append(v.CmdLine, []string{flag, value}...)
+ }
}
diff --git a/pkg/machine/qemu/machine_test.go b/pkg/machine/qemu/machine_test.go
new file mode 100644
index 000000000..62ca6068a
--- /dev/null
+++ b/pkg/machine/qemu/machine_test.go
@@ -0,0 +1,17 @@
+package qemu
+
+import (
+ "testing"
+
+ "github.com/stretchr/testify/require"
+)
+
+func TestEditCmd(t *testing.T) {
+ vm := new(MachineVM)
+ vm.CmdLine = []string{"command", "-flag", "value"}
+
+ vm.editCmdLine("-flag", "newvalue")
+ vm.editCmdLine("-anotherflag", "anothervalue")
+
+ require.Equal(t, vm.CmdLine, []string{"command", "-flag", "newvalue", "-anotherflag", "anothervalue"})
+}
diff --git a/pkg/machine/wsl/machine.go b/pkg/machine/wsl/machine.go
index f57dbd299..addcb7c8a 100644
--- a/pkg/machine/wsl/machine.go
+++ b/pkg/machine/wsl/machine.go
@@ -155,7 +155,7 @@ type Provider struct{}
type MachineVM struct {
// IdentityPath is the fq path to the ssh priv key
IdentityPath string
- // IgnitionFilePath is the fq path to the .ign file
+ // ImageStream is the version of fcos being used
ImageStream string
// ImagePath is the fq path to
ImagePath string
@@ -736,28 +736,34 @@ func pipeCmdPassThrough(name string, input string, arg ...string) error {
return cmd.Run()
}
-func (v *MachineVM) Set(name string, opts machine.SetOptions) error {
- if v.Rootful == opts.Rootful {
- return nil
+func (v *MachineVM) Set(_ string, opts machine.SetOptions) ([]error, error) {
+ // If one setting fails to be applied, the others settings will not fail and still be applied.
+ // The setting(s) that failed to be applied will have its errors returned in setErrors
+ var setErrors []error
+
+ if opts.Rootful != nil && v.Rootful != *opts.Rootful {
+ err := v.setRootful(*opts.Rootful)
+ if err != nil {
+ setErrors = append(setErrors, errors.Wrapf(err, "error setting rootful option"))
+ } else {
+ v.Rootful = *opts.Rootful
+ }
}
- changeCon, err := machine.AnyConnectionDefault(v.Name, v.Name+"-root")
- if err != nil {
- return err
+ if opts.CPUs != nil {
+ setErrors = append(setErrors, errors.Errorf("changing CPUs not suppored for WSL machines"))
}
- if changeCon {
- newDefault := v.Name
- if opts.Rootful {
- newDefault += "-root"
- }
- if err := machine.ChangeDefault(newDefault); err != nil {
- return err
- }
+ if opts.Memory != nil {
+ setErrors = append(setErrors, errors.Errorf("changing memory not suppored for WSL machines"))
+
}
- v.Rootful = opts.Rootful
- return v.writeConfig()
+ if opts.DiskSize != nil {
+ setErrors = append(setErrors, errors.Errorf("changing Disk Size not suppored for WSL machines"))
+ }
+
+ return setErrors, v.writeConfig()
}
func (v *MachineVM) Start(name string, _ machine.StartOptions) error {
@@ -1362,3 +1368,26 @@ func (p *Provider) IsValidVMName(name string) (bool, error) {
func (p *Provider) CheckExclusiveActiveVM() (bool, string, error) {
return false, "", nil
}
+
+func (v *MachineVM) setRootful(rootful bool) error {
+ changeCon, err := machine.AnyConnectionDefault(v.Name, v.Name+"-root")
+ if err != nil {
+ return err
+ }
+
+ if changeCon {
+ newDefault := v.Name
+ if rootful {
+ newDefault += "-root"
+ }
+ err := machine.ChangeDefault(newDefault)
+ if err != nil {
+ return err
+ }
+ }
+ return nil
+}
+
+func (v *MachineVM) Inspect() (*machine.InspectInfo, error) {
+ return nil, define.ErrNotImplemented
+}
diff --git a/pkg/namespaces/namespaces.go b/pkg/namespaces/namespaces.go
index bdea7c310..c95f8e275 100644
--- a/pkg/namespaces/namespaces.go
+++ b/pkg/namespaces/namespaces.go
@@ -375,7 +375,7 @@ func (n NetworkMode) Container() string {
return ""
}
-//UserDefined indicates user-created network
+// UserDefined indicates user-created network
func (n NetworkMode) UserDefined() string {
if n.IsUserDefined() {
return string(n)
diff --git a/pkg/specgen/container_validate.go b/pkg/specgen/container_validate.go
index e06cd9a29..355fbc368 100644
--- a/pkg/specgen/container_validate.go
+++ b/pkg/specgen/container_validate.go
@@ -122,19 +122,19 @@ func (s *SpecGenerator) Validate() error {
}
// TODO the specgen does not appear to handle this? Should it
- //switch config.Cgroup.Cgroups {
- //case "disabled":
+ // switch config.Cgroup.Cgroups {
+ // case "disabled":
// if addedResources {
// return errors.New("cannot specify resource limits when cgroups are disabled is specified")
// }
// configSpec.Linux.Resources = &spec.LinuxResources{}
- //case "enabled", "no-conmon", "":
+ // case "enabled", "no-conmon", "":
// // Do nothing
- //default:
+ // default:
// return errors.New("unrecognized option for cgroups; supported are 'default', 'disabled', 'no-conmon'")
- //}
+ // }
invalidUlimitFormatError := errors.New("invalid default ulimit definition must be form of type=soft:hard")
- //set ulimits if not rootless
+ // set ulimits if not rootless
if len(s.ContainerResourceConfig.Rlimits) < 1 && !rootless.IsRootless() {
// Containers common defines this as something like nproc=4194304:4194304
tmpnproc := containerConfig.Ulimits()
diff --git a/pkg/specgen/generate/container.go b/pkg/specgen/generate/container.go
index 81286b962..831c1d7b9 100644
--- a/pkg/specgen/generate/container.go
+++ b/pkg/specgen/generate/container.go
@@ -395,7 +395,7 @@ func ConfigToSpec(rt *libpod.Runtime, specg *specgen.SpecGenerator, contaierID s
} else {
switch nameSpaces[i] {
case "pid":
- specg.PidNS = specgen.Namespace{NSMode: specgen.Default} //default
+ specg.PidNS = specgen.Namespace{NSMode: specgen.Default} // default
case "net":
switch {
case conf.NetMode.IsBridge():
@@ -435,7 +435,7 @@ func ConfigToSpec(rt *libpod.Runtime, specg *specgen.SpecGenerator, contaierID s
specg.NetNS = specgen.Namespace{NSMode: specgen.FromPod, Value: strings.Split(string(conf.NetMode), ":")[1]}
}
case "cgroup":
- specg.CgroupNS = specgen.Namespace{NSMode: specgen.Default} //default
+ specg.CgroupNS = specgen.Namespace{NSMode: specgen.Default} // default
case "ipc":
switch conf.ShmDir {
case "/dev/shm":
@@ -443,15 +443,15 @@ func ConfigToSpec(rt *libpod.Runtime, specg *specgen.SpecGenerator, contaierID s
case "":
specg.IpcNS = specgen.Namespace{NSMode: specgen.None}
default:
- specg.IpcNS = specgen.Namespace{NSMode: specgen.Default} //default
+ specg.IpcNS = specgen.Namespace{NSMode: specgen.Default} // default
}
case "uts":
- specg.UtsNS = specgen.Namespace{NSMode: specgen.Default} //default
+ specg.UtsNS = specgen.Namespace{NSMode: specgen.Default} // default
case "user":
if conf.AddCurrentUserPasswdEntry {
specg.UserNS = specgen.Namespace{NSMode: specgen.KeepID}
} else {
- specg.UserNS = specgen.Namespace{NSMode: specgen.Default} //default
+ specg.UserNS = specgen.Namespace{NSMode: specgen.Default} // default
}
}
}
diff --git a/pkg/specgen/generate/container_create.go b/pkg/specgen/generate/container_create.go
index 50454cbab..8b9ed8ffe 100644
--- a/pkg/specgen/generate/container_create.go
+++ b/pkg/specgen/generate/container_create.go
@@ -434,20 +434,18 @@ func createContainerOptions(rt *libpod.Runtime, s *specgen.SpecGenerator, pod *l
// Security options
if len(s.SelinuxOpts) > 0 {
options = append(options, libpod.WithSecLabels(s.SelinuxOpts))
- } else {
- if pod != nil && len(compatibleOptions.SelinuxOpts) == 0 {
- // duplicate the security options from the pod
- processLabel, err := pod.ProcessLabel()
+ } else if pod != nil && len(compatibleOptions.SelinuxOpts) == 0 {
+ // duplicate the security options from the pod
+ processLabel, err := pod.ProcessLabel()
+ if err != nil {
+ return nil, err
+ }
+ if processLabel != "" {
+ selinuxOpts, err := label.DupSecOpt(processLabel)
if err != nil {
return nil, err
}
- if processLabel != "" {
- selinuxOpts, err := label.DupSecOpt(processLabel)
- if err != nil {
- return nil, err
- }
- options = append(options, libpod.WithSecLabels(selinuxOpts))
- }
+ options = append(options, libpod.WithSecLabels(selinuxOpts))
}
}
options = append(options, libpod.WithPrivileged(s.Privileged))
diff --git a/pkg/specgen/generate/kube/kube.go b/pkg/specgen/generate/kube/kube.go
index 51f9fa535..4c11e4bff 100644
--- a/pkg/specgen/generate/kube/kube.go
+++ b/pkg/specgen/generate/kube/kube.go
@@ -449,12 +449,13 @@ func setupLivenessProbe(s *specgen.SpecGenerator, containerYAML v1.Container, re
}
// configure healthcheck on the basis of Handler Actions.
- if probeHandler.Exec != nil {
+ switch {
+ case probeHandler.Exec != nil:
execString := strings.Join(probeHandler.Exec.Command, " ")
commandString = fmt.Sprintf("%s || %s", execString, failureCmd)
- } else if probeHandler.HTTPGet != nil {
+ case probeHandler.HTTPGet != nil:
commandString = fmt.Sprintf("curl %s://%s:%d/%s || %s", probeHandler.HTTPGet.Scheme, probeHandler.HTTPGet.Host, probeHandler.HTTPGet.Port.IntValue(), probeHandler.HTTPGet.Path, failureCmd)
- } else if probeHandler.TCPSocket != nil {
+ case probeHandler.TCPSocket != nil:
commandString = fmt.Sprintf("nc -z -v %s %d || %s", probeHandler.TCPSocket.Host, probeHandler.TCPSocket.Port.IntValue(), failureCmd)
}
s.HealthConfig, err = makeHealthCheck(commandString, probe.PeriodSeconds, probe.FailureThreshold, probe.TimeoutSeconds, probe.InitialDelaySeconds)
@@ -490,17 +491,17 @@ func makeHealthCheck(inCmd string, interval int32, retries int32, timeout int32,
}
if interval < 1 {
- //kubernetes interval defaults to 10 sec and cannot be less than 1
+ // kubernetes interval defaults to 10 sec and cannot be less than 1
interval = 10
}
hc.Interval = (time.Duration(interval) * time.Second)
if retries < 1 {
- //kubernetes retries defaults to 3
+ // kubernetes retries defaults to 3
retries = 3
}
hc.Retries = int(retries)
if timeout < 1 {
- //kubernetes timeout defaults to 1
+ // kubernetes timeout defaults to 1
timeout = 1
}
timeoutDuration := (time.Duration(timeout) * time.Second)
diff --git a/pkg/specgen/generate/kube/kube_test.go b/pkg/specgen/generate/kube/kube_test.go
index 0898d427d..9c52c03bb 100644
--- a/pkg/specgen/generate/kube/kube_test.go
+++ b/pkg/specgen/generate/kube/kube_test.go
@@ -5,7 +5,6 @@ import (
v1 "github.com/containers/podman/v4/pkg/k8s.io/api/core/v1"
"github.com/stretchr/testify/assert"
- //"github.com/stretchr/testify/require"
)
func testPropagation(t *testing.T, propagation v1.MountPropagationMode, expected string) {
diff --git a/pkg/specgen/generate/namespaces.go b/pkg/specgen/generate/namespaces.go
index 2362f61c4..37d561ec2 100644
--- a/pkg/specgen/generate/namespaces.go
+++ b/pkg/specgen/generate/namespaces.go
@@ -202,10 +202,8 @@ func namespaceOptions(s *specgen.SpecGenerator, rt *libpod.Runtime, pod *libpod.
if s.IDMappings != nil {
if pod == nil {
toReturn = append(toReturn, libpod.WithIDMappings(*s.IDMappings))
- } else {
- if pod.HasInfraContainer() && (len(s.IDMappings.UIDMap) > 0 || len(s.IDMappings.GIDMap) > 0) {
- return nil, errors.Wrapf(define.ErrInvalidArg, "cannot specify a new uid/gid map when entering a pod with an infra container")
- }
+ } else if pod.HasInfraContainer() && (len(s.IDMappings.UIDMap) > 0 || len(s.IDMappings.GIDMap) > 0) {
+ return nil, errors.Wrapf(define.ErrInvalidArg, "cannot specify a new uid/gid map when entering a pod with an infra container")
}
}
if s.User != "" {
@@ -482,7 +480,7 @@ func GetNamespaceOptions(ns []string, netnsIsHost bool) ([]libpod.PodCreateOptio
var options []libpod.PodCreateOption
var erroredOptions []libpod.PodCreateOption
if ns == nil {
- //set the default namespaces
+ // set the default namespaces
ns = strings.Split(specgen.DefaultKernelNamespaces, ",")
}
for _, toShare := range ns {
diff --git a/pkg/specgen/generate/oci.go b/pkg/specgen/generate/oci.go
index 95bcea8f0..b77c00f50 100644
--- a/pkg/specgen/generate/oci.go
+++ b/pkg/specgen/generate/oci.go
@@ -298,7 +298,8 @@ func SpecGenToOCI(ctx context.Context, s *specgen.SpecGenerator, rt *libpod.Runt
g.AddAnnotation(key, val)
}
- if compatibleOptions.InfraResources == nil && s.ResourceLimits != nil {
+ switch {
+ case compatibleOptions.InfraResources == nil && s.ResourceLimits != nil:
out, err := json.Marshal(s.ResourceLimits)
if err != nil {
return nil, err
@@ -307,7 +308,7 @@ func SpecGenToOCI(ctx context.Context, s *specgen.SpecGenerator, rt *libpod.Runt
if err != nil {
return nil, err
}
- } else if s.ResourceLimits != nil { // if we have predefined resource limits we need to make sure we keep the infra and container limits
+ case s.ResourceLimits != nil: // if we have predefined resource limits we need to make sure we keep the infra and container limits
originalResources, err := json.Marshal(s.ResourceLimits)
if err != nil {
return nil, err
@@ -325,7 +326,7 @@ func SpecGenToOCI(ctx context.Context, s *specgen.SpecGenerator, rt *libpod.Runt
return nil, err
}
g.Config.Linux.Resources = s.ResourceLimits
- } else {
+ default:
g.Config.Linux.Resources = compatibleOptions.InfraResources
}
// Devices
diff --git a/pkg/specgen/generate/validate.go b/pkg/specgen/generate/validate.go
index 8da3f2936..44c7818e7 100644
--- a/pkg/specgen/generate/validate.go
+++ b/pkg/specgen/generate/validate.go
@@ -47,10 +47,8 @@ func verifyContainerResourcesCgroupV1(s *specgen.SpecGenerator) ([]string, error
if !sysInfo.MemorySwappiness {
warnings = append(warnings, "Your kernel does not support memory swappiness capabilities, or the cgroup is not mounted. Memory swappiness discarded.")
memory.Swappiness = nil
- } else {
- if *memory.Swappiness > 100 {
- return warnings, errors.Errorf("invalid value: %v, valid memory swappiness range is 0-100", *memory.Swappiness)
- }
+ } else if *memory.Swappiness > 100 {
+ return warnings, errors.Errorf("invalid value: %v, valid memory swappiness range is 0-100", *memory.Swappiness)
}
}
if memory.Reservation != nil && !sysInfo.MemoryReservation {
diff --git a/pkg/specgen/winpath.go b/pkg/specgen/winpath.go
index f4249fab1..0df4ebdd7 100644
--- a/pkg/specgen/winpath.go
+++ b/pkg/specgen/winpath.go
@@ -47,11 +47,12 @@ func ConvertWinMountPath(path string) (string, error) {
path = strings.TrimPrefix(path, `\\?\`)
// Drive installed via wsl --mount
- if strings.HasPrefix(path, `\\.\`) {
+ switch {
+ case strings.HasPrefix(path, `\\.\`):
path = "/mnt/wsl/" + path[4:]
- } else if len(path) > 1 && path[1] == ':' {
+ case len(path) > 1 && path[1] == ':':
path = "/mnt/" + strings.ToLower(path[0:1]) + path[2:]
- } else {
+ default:
return path, errors.New("unsupported UNC path")
}
diff --git a/pkg/specgenutil/createparse.go b/pkg/specgenutil/createparse.go
index a51396227..fb5f9c351 100644
--- a/pkg/specgenutil/createparse.go
+++ b/pkg/specgenutil/createparse.go
@@ -24,11 +24,12 @@ func validate(c *entities.ContainerCreateOptions) error {
"ignore": "",
}
if _, ok := imageVolType[c.ImageVolume]; !ok {
- if c.IsInfra {
+ switch {
+ case c.IsInfra:
c.ImageVolume = "bind"
- } else if c.IsClone { // the image volume type will be deduced later from the container we are cloning
+ case c.IsClone: // the image volume type will be deduced later from the container we are cloning
return nil
- } else {
+ default:
return errors.Errorf("invalid image-volume type %q. Pick one of bind, tmpfs, or ignore", c.ImageVolume)
}
}
diff --git a/pkg/specgenutil/specgen.go b/pkg/specgenutil/specgen.go
index f0dfcac1a..9cb2f200b 100644
--- a/pkg/specgenutil/specgen.go
+++ b/pkg/specgenutil/specgen.go
@@ -1098,9 +1098,9 @@ var cgroupDeviceType = map[string]bool{
}
var cgroupDeviceAccess = map[string]bool{
- "r": true, //read
- "w": true, //write
- "m": true, //mknod
+ "r": true, // read
+ "w": true, // write
+ "m": true, // mknod
}
// parseLinuxResourcesDeviceAccess parses the raw string passed with the --device-access-add flag
diff --git a/pkg/systemd/dbus.go b/pkg/systemd/dbus.go
index b35f778ab..6887a466e 100644
--- a/pkg/systemd/dbus.go
+++ b/pkg/systemd/dbus.go
@@ -26,39 +26,39 @@ func IsSystemdSessionValid(uid int) bool {
if rootless.IsRootless() {
conn, err = GetLogindConnection(rootless.GetRootlessUID())
if err != nil {
- //unable to fetch systemd object for logind
+ // unable to fetch systemd object for logind
logrus.Debugf("systemd-logind: %s", err)
return false
}
object = conn.Object(dbusDest, godbus.ObjectPath(dbusPath))
if err := object.Call(dbusInterface+".GetSeat", 0, "seat0").Store(&seat0Path); err != nil {
- //unable to get seat0 path.
+ // unable to get seat0 path.
logrus.Debugf("systemd-logind: %s", err)
return false
}
seat0Obj := conn.Object(dbusDest, seat0Path)
activeSession, err := seat0Obj.GetProperty(dbusDest + ".Seat.ActiveSession")
if err != nil {
- //unable to get active sessions.
+ // unable to get active sessions.
logrus.Debugf("systemd-logind: %s", err)
return false
}
activeSessionMap, ok := activeSession.Value().([]interface{})
if !ok || len(activeSessionMap) < 2 {
- //unable to get active session map.
+ // unable to get active session map.
logrus.Debugf("systemd-logind: %s", err)
return false
}
activeSessionPath, ok := activeSessionMap[1].(godbus.ObjectPath)
if !ok {
- //unable to fetch active session path.
+ // unable to fetch active session path.
logrus.Debugf("systemd-logind: %s", err)
return false
}
activeSessionObj := conn.Object(dbusDest, activeSessionPath)
sessionUser, err := activeSessionObj.GetProperty(dbusDest + ".Session.User")
if err != nil {
- //unable to fetch session user from activeSession path.
+ // unable to fetch session user from activeSession path.
logrus.Debugf("systemd-logind: %s", err)
return false
}
@@ -75,7 +75,7 @@ func IsSystemdSessionValid(uid int) bool {
if !ok {
return false
}
- //active session found which belongs to following rootless user
+ // active session found which belongs to following rootless user
if activeUID == uint32(uid) {
return true
}
diff --git a/pkg/timetype/timestamp.go b/pkg/timetype/timestamp.go
index 2de1a005f..5e9c6a159 100644
--- a/pkg/timetype/timestamp.go
+++ b/pkg/timetype/timestamp.go
@@ -34,13 +34,14 @@ func GetTimestamp(value string, reference time.Time) (string, error) {
// if the string has a Z or a + or three dashes use parse otherwise use parseinlocation
parseInLocation := !(strings.ContainsAny(value, "zZ+") || strings.Count(value, "-") == 3)
- if strings.Contains(value, ".") { // nolint(gocritic)
+ switch {
+ case strings.Contains(value, "."):
if parseInLocation {
format = rFC3339NanoLocal
} else {
format = time.RFC3339Nano
}
- } else if strings.Contains(value, "T") {
+ case strings.Contains(value, "T"):
// we want the number of colons in the T portion of the timestamp
tcolons := strings.Count(value, ":")
// if parseInLocation is off and we have a +/- zone offset (not Z) then
@@ -68,9 +69,9 @@ func GetTimestamp(value string, reference time.Time) (string, error) {
format = time.RFC3339
}
}
- } else if parseInLocation {
+ case parseInLocation:
format = dateLocal
- } else {
+ default:
format = dateWithZone
}
diff --git a/test/apiv2/01-basic.at b/test/apiv2/01-basic.at
index 2747ccbd4..e4348a9a7 100644
--- a/test/apiv2/01-basic.at
+++ b/test/apiv2/01-basic.at
@@ -19,7 +19,7 @@ for i in /version version; do
t GET $i 200 \
.Components[0].Name="Podman Engine" \
.Components[0].Details.APIVersion~4[0-9.-]\\+ \
- .Components[0].Details.MinAPIVersion=3.1.0 \
+ .Components[0].Details.MinAPIVersion=4.0.0 \
.Components[0].Details.Os=linux \
.ApiVersion=1.40 \
.MinAPIVersion=1.24 \
diff --git a/test/e2e/attach_test.go b/test/e2e/attach_test.go
index 74e3a619a..b110f7c5b 100644
--- a/test/e2e/attach_test.go
+++ b/test/e2e/attach_test.go
@@ -22,8 +22,6 @@ var _ = Describe("Podman attach", func() {
Expect(err).To(BeNil())
podmanTest = PodmanTestCreate(tempdir)
podmanTest.Setup()
- err = podmanTest.SeedImages()
- Expect(err).To(BeNil())
})
AfterEach(func() {
diff --git a/test/e2e/benchmarks_test.go b/test/e2e/benchmarks_test.go
index 9653cee3b..746dec0a6 100644
--- a/test/e2e/benchmarks_test.go
+++ b/test/e2e/benchmarks_test.go
@@ -66,7 +66,6 @@ var _ = Describe("Podman Benchmark Suite", func() {
}
podmanTest = PodmanTestCreate(tempdir)
podmanTest.Setup()
-
timedir, err = CreateTempDirInTempDir()
if err != nil {
os.Exit(1)
diff --git a/test/e2e/build_test.go b/test/e2e/build_test.go
index 0c665687d..b5cec5fff 100644
--- a/test/e2e/build_test.go
+++ b/test/e2e/build_test.go
@@ -53,8 +53,8 @@ var _ = Describe("Podman build", func() {
inspect := podmanTest.Podman([]string{"inspect", iid})
inspect.WaitWithDefaultTimeout()
data := inspect.InspectImageJSON()
- Expect(data[0].Os).To(Equal(runtime.GOOS))
- Expect(data[0].Architecture).To(Equal(runtime.GOARCH))
+ Expect(data[0]).To(HaveField("Os", runtime.GOOS))
+ Expect(data[0]).To(HaveField("Architecture", runtime.GOARCH))
session = podmanTest.Podman([]string{"rmi", ALPINE})
session.WaitWithDefaultTimeout()
@@ -110,8 +110,8 @@ var _ = Describe("Podman build", func() {
inspect := podmanTest.Podman([]string{"inspect", "test"})
inspect.WaitWithDefaultTimeout()
data := inspect.InspectImageJSON()
- Expect(data[0].Os).To(Equal(runtime.GOOS))
- Expect(data[0].Architecture).To(Equal(runtime.GOARCH))
+ Expect(data[0]).To(HaveField("Os", runtime.GOOS))
+ Expect(data[0]).To(HaveField("Architecture", runtime.GOARCH))
st, err := os.Stat(logfile)
Expect(err).To(BeNil())
@@ -533,7 +533,10 @@ subdir**`
// make cwd as context root path
Expect(os.Chdir(contextDir)).ToNot(HaveOccurred())
- defer os.Chdir(cwd)
+ defer func() {
+ err := os.Chdir(cwd)
+ Expect(err).ToNot(HaveOccurred())
+ }()
By("Test .containerignore filtering subdirectory")
err = ioutil.WriteFile(filepath.Join(contextDir, ".containerignore"), []byte(`subdir/`), 0644)
diff --git a/test/e2e/checkpoint_image_test.go b/test/e2e/checkpoint_image_test.go
index 8274dfc80..94320a70e 100644
--- a/test/e2e/checkpoint_image_test.go
+++ b/test/e2e/checkpoint_image_test.go
@@ -28,7 +28,6 @@ var _ = Describe("Podman checkpoint", func() {
}
podmanTest = PodmanTestCreate(tempdir)
podmanTest.Setup()
- podmanTest.SeedImages()
// Check if the runtime implements checkpointing. Currently only
// runc's checkpoint/restore implementation is supported.
cmd := exec.Command(podmanTest.OCIRuntime, "checkpoint", "--help")
@@ -91,9 +90,9 @@ var _ = Describe("Podman checkpoint", func() {
inspectOut := inspect.InspectContainerToJSON()
Expect(inspectOut[0].State.Checkpointed).To(BeFalse(), ".State.Checkpointed")
Expect(inspectOut[0].State.Restored).To(BeFalse(), ".State.Restored")
- Expect(inspectOut[0].State.CheckpointPath).To(Equal(""))
- Expect(inspectOut[0].State.CheckpointLog).To(Equal(""))
- Expect(inspectOut[0].State.RestoreLog).To(Equal(""))
+ Expect(inspectOut[0].State).To(HaveField("CheckpointPath", ""))
+ Expect(inspectOut[0].State).To(HaveField("CheckpointLog", ""))
+ Expect(inspectOut[0].State).To(HaveField("RestoreLog", ""))
result := podmanTest.Podman([]string{"container", "checkpoint", "--create-image", checkpointImage, "--keep", containerID})
result.WaitWithDefaultTimeout()
diff --git a/test/e2e/checkpoint_test.go b/test/e2e/checkpoint_test.go
index 2dc99bdc9..787178cd3 100644
--- a/test/e2e/checkpoint_test.go
+++ b/test/e2e/checkpoint_test.go
@@ -41,8 +41,6 @@ var _ = Describe("Podman checkpoint", func() {
podmanTest = PodmanTestCreate(tempdir)
podmanTest.Setup()
- err = podmanTest.SeedImages()
- Expect(err).To(BeNil())
// Check if the runtime implements checkpointing. Currently only
// runc's checkpoint/restore implementation is supported.
cmd := exec.Command(podmanTest.OCIRuntime, "checkpoint", "--help")
@@ -99,9 +97,9 @@ var _ = Describe("Podman checkpoint", func() {
inspectOut := inspect.InspectContainerToJSON()
Expect(inspectOut[0].State.Checkpointed).To(BeFalse(), ".State.Checkpointed")
Expect(inspectOut[0].State.Restored).To(BeFalse(), ".State.Restored")
- Expect(inspectOut[0].State.CheckpointPath).To(Equal(""))
- Expect(inspectOut[0].State.CheckpointLog).To(Equal(""))
- Expect(inspectOut[0].State.RestoreLog).To(Equal(""))
+ Expect(inspectOut[0].State).To(HaveField("CheckpointPath", ""))
+ Expect(inspectOut[0].State).To(HaveField("CheckpointLog", ""))
+ Expect(inspectOut[0].State).To(HaveField("RestoreLog", ""))
result := podmanTest.Podman([]string{
"container",
@@ -125,7 +123,7 @@ var _ = Describe("Podman checkpoint", func() {
Expect(inspectOut[0].State.Restored).To(BeFalse(), ".State.Restored")
Expect(inspectOut[0].State.CheckpointPath).To(ContainSubstring("userdata/checkpoint"))
Expect(inspectOut[0].State.CheckpointLog).To(ContainSubstring("userdata/dump.log"))
- Expect(inspectOut[0].State.RestoreLog).To(Equal(""))
+ Expect(inspectOut[0].State).To(HaveField("RestoreLog", ""))
result = podmanTest.Podman([]string{
"container",
@@ -179,9 +177,9 @@ var _ = Describe("Podman checkpoint", func() {
inspectOut = inspect.InspectContainerToJSON()
Expect(inspectOut[0].State.Checkpointed).To(BeFalse(), ".State.Checkpointed")
Expect(inspectOut[0].State.Restored).To(BeFalse(), ".State.Restored")
- Expect(inspectOut[0].State.CheckpointPath).To(Equal(""))
- Expect(inspectOut[0].State.CheckpointLog).To(Equal(""))
- Expect(inspectOut[0].State.RestoreLog).To(Equal(""))
+ Expect(inspectOut[0].State).To(HaveField("CheckpointPath", ""))
+ Expect(inspectOut[0].State).To(HaveField("CheckpointLog", ""))
+ Expect(inspectOut[0].State).To(HaveField("RestoreLog", ""))
})
It("podman checkpoint a running container by name", func() {
diff --git a/test/e2e/commit_test.go b/test/e2e/commit_test.go
index 78b607f1e..c82e5e471 100644
--- a/test/e2e/commit_test.go
+++ b/test/e2e/commit_test.go
@@ -24,8 +24,6 @@ var _ = Describe("Podman commit", func() {
Expect(err).To(BeNil())
podmanTest = PodmanTestCreate(tempdir)
podmanTest.Setup()
- err = podmanTest.SeedImages()
- Expect(err).To(BeNil())
})
AfterEach(func() {
@@ -92,7 +90,7 @@ var _ = Describe("Podman commit", func() {
check := podmanTest.Podman([]string{"inspect", "foobar.com/test1-image:latest"})
check.WaitWithDefaultTimeout()
data := check.InspectImageJSON()
- Expect(data[0].Comment).To(Equal("testing-commit"))
+ Expect(data[0]).To(HaveField("Comment", "testing-commit"))
})
It("podman commit container with author", func() {
@@ -107,7 +105,7 @@ var _ = Describe("Podman commit", func() {
check := podmanTest.Podman([]string{"inspect", "foobar.com/test1-image:latest"})
check.WaitWithDefaultTimeout()
data := check.InspectImageJSON()
- Expect(data[0].Author).To(Equal("snoopy"))
+ Expect(data[0]).To(HaveField("Author", "snoopy"))
})
It("podman commit container with change flag", func() {
@@ -293,7 +291,7 @@ var _ = Describe("Podman commit", func() {
check := podmanTest.Podman([]string{"inspect", "foobar.com/test1-image:latest"})
check.WaitWithDefaultTimeout()
data := check.InspectImageJSON()
- Expect(data[0].ID).To(Equal(string(id)))
+ Expect(data[0]).To(HaveField("ID", string(id)))
})
It("podman commit should not commit secret", func() {
diff --git a/test/e2e/common_test.go b/test/e2e/common_test.go
index 6846a5677..a61ef8640 100644
--- a/test/e2e/common_test.go
+++ b/test/e2e/common_test.go
@@ -212,7 +212,7 @@ func PodmanTestCreateUtil(tempDir string, remote bool) *PodmanTestIntegration {
podmanRemoteBinary = os.Getenv("PODMAN_REMOTE_BINARY")
}
- conmonBinary := filepath.Join("/usr/libexec/podman/conmon")
+ conmonBinary := "/usr/libexec/podman/conmon"
altConmonBinary := "/usr/bin/conmon"
if _, err := os.Stat(conmonBinary); os.IsNotExist(err) {
conmonBinary = altConmonBinary
@@ -344,7 +344,7 @@ func imageTarPath(image string) string {
}
// e.g., registry.com/fubar:latest -> registry.com-fubar-latest.tar
- imageCacheName := strings.Replace(strings.Replace(image, ":", "-", -1), "/", "-", -1) + ".tar"
+ imageCacheName := strings.ReplaceAll(strings.ReplaceAll(image, ":", "-"), "/", "-") + ".tar"
return filepath.Join(cacheDir, imageCacheName)
}
@@ -861,9 +861,6 @@ func (p *PodmanTestIntegration) makeOptions(args []string, noEvents, noCache boo
podmanOptions := strings.Split(fmt.Sprintf("%s--root %s --runroot %s --runtime %s --conmon %s --network-config-dir %s --cgroup-manager %s --tmpdir %s --events-backend %s",
debug, p.Root, p.RunRoot, p.OCIRuntime, p.ConmonBinary, p.NetworkConfigDir, p.CgroupManager, p.TmpDir, eventsType), " ")
- if os.Getenv("HOOK_OPTION") != "" {
- podmanOptions = append(podmanOptions, os.Getenv("HOOK_OPTION"))
- }
if !p.RemoteTest {
podmanOptions = append(podmanOptions, "--network-backend", p.NetworkBackend.ToString())
diff --git a/test/e2e/container_clone_test.go b/test/e2e/container_clone_test.go
index 1ff4b3b5f..da9b511e0 100644
--- a/test/e2e/container_clone_test.go
+++ b/test/e2e/container_clone_test.go
@@ -24,7 +24,6 @@ var _ = Describe("Podman container clone", func() {
}
podmanTest = PodmanTestCreate(tempdir)
podmanTest.Setup()
- podmanTest.SeedImages()
})
AfterEach(func() {
@@ -68,8 +67,8 @@ var _ = Describe("Podman container clone", func() {
ctrInspect := podmanTest.Podman([]string{"inspect", clone.OutputToString()})
ctrInspect.WaitWithDefaultTimeout()
Expect(ctrInspect).To(Exit(0))
- Expect(ctrInspect.InspectContainerToJSON()[0].ImageName).To(Equal(fedoraMinimal))
- Expect(ctrInspect.InspectContainerToJSON()[0].Name).To(Equal("new_name"))
+ Expect(ctrInspect.InspectContainerToJSON()[0]).To(HaveField("ImageName", fedoraMinimal))
+ Expect(ctrInspect.InspectContainerToJSON()[0]).To(HaveField("Name", "new_name"))
})
It("podman container clone name test", func() {
@@ -84,7 +83,7 @@ var _ = Describe("Podman container clone", func() {
cloneInspect.WaitWithDefaultTimeout()
Expect(cloneInspect).To(Exit(0))
cloneData := cloneInspect.InspectContainerToJSON()
- Expect(cloneData[0].Name).To(Equal("testing123"))
+ Expect(cloneData[0]).To(HaveField("Name", "testing123"))
})
It("podman container clone resource limits override", func() {
@@ -104,7 +103,7 @@ var _ = Describe("Podman container clone", func() {
cloneInspect.WaitWithDefaultTimeout()
Expect(cloneInspect).To(Exit(0))
cloneData := cloneInspect.InspectContainerToJSON()
- Expect(createData[0].HostConfig.NanoCpus).To(Equal(cloneData[0].HostConfig.NanoCpus))
+ Expect(createData[0].HostConfig).To(HaveField("NanoCpus", cloneData[0].HostConfig.NanoCpus))
create = podmanTest.Podman([]string{"create", "--memory=5", ALPINE})
create.WaitWithDefaultTimeout()
@@ -122,7 +121,7 @@ var _ = Describe("Podman container clone", func() {
cloneInspect.WaitWithDefaultTimeout()
Expect(cloneInspect).To(Exit(0))
cloneData = cloneInspect.InspectContainerToJSON()
- Expect(createData[0].HostConfig.MemorySwap).To(Equal(cloneData[0].HostConfig.MemorySwap))
+ Expect(createData[0].HostConfig).To(HaveField("MemorySwap", cloneData[0].HostConfig.MemorySwap))
create = podmanTest.Podman([]string{"create", "--cpus=5", ALPINE})
create.WaitWithDefaultTimeout()
@@ -145,7 +144,7 @@ var _ = Describe("Podman container clone", func() {
Expect(cloneInspect).To(Exit(0))
cloneData = cloneInspect.InspectContainerToJSON()
Expect(createData[0].HostConfig.NanoCpus).ToNot(Equal(cloneData[0].HostConfig.NanoCpus))
- Expect(cloneData[0].HostConfig.NanoCpus).To(Equal(nanoCPUs))
+ Expect(cloneData[0].HostConfig).To(HaveField("NanoCpus", nanoCPUs))
create = podmanTest.Podman([]string{"create", ALPINE})
create.WaitWithDefaultTimeout()
@@ -158,7 +157,7 @@ var _ = Describe("Podman container clone", func() {
cloneInspect.WaitWithDefaultTimeout()
Expect(cloneInspect).To(Exit(0))
cloneData = cloneInspect.InspectContainerToJSON()
- Expect(cloneData[0].HostConfig.MemorySwappiness).To(Equal(int64(0)))
+ Expect(cloneData[0].HostConfig).To(HaveField("MemorySwappiness", int64(0)))
})
@@ -184,7 +183,7 @@ var _ = Describe("Podman container clone", func() {
Expect(checkCreate).Should(Exit(0))
createArray := checkCreate.OutputToStringArray()
- Expect(cloneArray).To(ContainElements(createArray[:]))
+ Expect(cloneArray).To(ContainElements(createArray))
ctrInspect := podmanTest.Podman([]string{"inspect", clone.OutputToString()})
ctrInspect.WaitWithDefaultTimeout()
diff --git a/test/e2e/container_create_volume_test.go b/test/e2e/container_create_volume_test.go
index 62a2541b9..6d9f13694 100644
--- a/test/e2e/container_create_volume_test.go
+++ b/test/e2e/container_create_volume_test.go
@@ -47,7 +47,7 @@ func checkDataVolumeContainer(pTest *PodmanTestIntegration, image, cont, dest, d
inspect := pTest.InspectContainer(cont)
Expect(inspect).To(HaveLen(1))
Expect(inspect[0].Mounts).To(HaveLen(1))
- Expect(inspect[0].Mounts[0].Destination).To(Equal(dest))
+ Expect(inspect[0].Mounts[0]).To(HaveField("Destination", dest))
mntName, mntSource := inspect[0].Mounts[0].Name, inspect[0].Mounts[0].Source
@@ -83,7 +83,6 @@ var _ = Describe("Podman create data volume", func() {
}
podmanTest = PodmanTestCreate(tempdir)
podmanTest.Setup()
- podmanTest.SeedImages()
})
AfterEach(func() {
diff --git a/test/e2e/container_inspect_test.go b/test/e2e/container_inspect_test.go
index f58f2de29..5aed943da 100644
--- a/test/e2e/container_inspect_test.go
+++ b/test/e2e/container_inspect_test.go
@@ -25,7 +25,6 @@ var _ = Describe("Podman container inspect", func() {
}
podmanTest = PodmanTestCreate(tempdir)
podmanTest.Setup()
- podmanTest.SeedImages()
})
AfterEach(func() {
diff --git a/test/e2e/containers_conf_test.go b/test/e2e/containers_conf_test.go
index 09cd68042..b48e1ed62 100644
--- a/test/e2e/containers_conf_test.go
+++ b/test/e2e/containers_conf_test.go
@@ -29,7 +29,6 @@ var _ = Describe("Verify podman containers.conf usage", func() {
}
podmanTest = PodmanTestCreate(tempdir)
podmanTest.Setup()
- podmanTest.SeedImages()
os.Setenv("CONTAINERS_CONF", "config/containers.conf")
if IsRemote() {
podmanTest.RestartRemoteService()
diff --git a/test/e2e/cp_test.go b/test/e2e/cp_test.go
index ede6036b9..8a65b85d3 100644
--- a/test/e2e/cp_test.go
+++ b/test/e2e/cp_test.go
@@ -31,7 +31,6 @@ var _ = Describe("Podman cp", func() {
}
podmanTest = PodmanTestCreate(tempdir)
podmanTest.Setup()
- podmanTest.SeedImages()
})
AfterEach(func() {
diff --git a/test/e2e/create_staticip_test.go b/test/e2e/create_staticip_test.go
index 4a1d926e0..6fd88753b 100644
--- a/test/e2e/create_staticip_test.go
+++ b/test/e2e/create_staticip_test.go
@@ -25,7 +25,6 @@ var _ = Describe("Podman create with --ip flag", func() {
}
podmanTest = PodmanTestCreate(tempdir)
podmanTest.Setup()
- podmanTest.SeedImages()
// Cleanup the CNI networks used by the tests
os.RemoveAll("/var/lib/cni/networks/podman")
})
diff --git a/test/e2e/create_staticmac_test.go b/test/e2e/create_staticmac_test.go
index 5fd8e3bd6..f02d9c88b 100644
--- a/test/e2e/create_staticmac_test.go
+++ b/test/e2e/create_staticmac_test.go
@@ -25,7 +25,6 @@ var _ = Describe("Podman run with --mac-address flag", func() {
}
podmanTest = PodmanTestCreate(tempdir)
podmanTest.Setup()
- podmanTest.SeedImages()
// Cleanup the CNI networks used by the tests
os.RemoveAll("/var/lib/cni/networks/podman")
})
diff --git a/test/e2e/create_test.go b/test/e2e/create_test.go
index 4c3b5604a..63544d579 100644
--- a/test/e2e/create_test.go
+++ b/test/e2e/create_test.go
@@ -27,8 +27,6 @@ var _ = Describe("Podman create", func() {
Expect(err).To(BeNil())
podmanTest = PodmanTestCreate(tempdir)
podmanTest.Setup()
- err = podmanTest.SeedImages()
- Expect(err).To(BeNil())
})
AfterEach(func() {
@@ -176,7 +174,8 @@ var _ = Describe("Podman create", func() {
// tests are passing inside a container.
mountPath := filepath.Join(podmanTest.TempDir, "secrets")
- os.Mkdir(mountPath, 0755)
+ err := os.Mkdir(mountPath, 0755)
+ Expect(err).ToNot(HaveOccurred())
session := podmanTest.Podman([]string{"create", "--log-driver", "k8s-file", "--name", "test", "--mount", fmt.Sprintf("type=bind,src=%s,target=/create/test", mountPath), ALPINE, "grep", "/create/test", "/proc/self/mountinfo"})
session.WaitWithDefaultTimeout()
Expect(session).Should(Exit(0))
@@ -212,7 +211,8 @@ var _ = Describe("Podman create", func() {
Expect(session.OutputToString()).To(ContainSubstring("shared"))
mountPath = filepath.Join(podmanTest.TempDir, "scratchpad")
- os.Mkdir(mountPath, 0755)
+ err = os.Mkdir(mountPath, 0755)
+ Expect(err).ToNot(HaveOccurred())
session = podmanTest.Podman([]string{"create", "--log-driver", "k8s-file", "--name", "test_tmpfs", "--mount", "type=tmpfs,target=/create/test", ALPINE, "grep", "/create/test", "/proc/self/mountinfo"})
session.WaitWithDefaultTimeout()
Expect(session).Should(Exit(0))
@@ -268,7 +268,7 @@ var _ = Describe("Podman create", func() {
Expect(session).Should(Exit(0))
ctrJSON := podmanTest.InspectContainer(ctrName)
- Expect(podData.ID).To(Equal(ctrJSON[0].Pod)) // Make sure the container's pod matches the pod's ID
+ Expect(podData).To(HaveField("ID", ctrJSON[0].Pod)) // Make sure the container's pod matches the pod's ID
})
It("podman run entrypoint and cmd test", func() {
@@ -281,7 +281,7 @@ var _ = Describe("Podman create", func() {
Expect(ctrJSON).To(HaveLen(1))
Expect(ctrJSON[0].Config.Cmd).To(HaveLen(1))
Expect(ctrJSON[0].Config.Cmd[0]).To(Equal("redis-server"))
- Expect(ctrJSON[0].Config.Entrypoint).To(Equal("docker-entrypoint.sh"))
+ Expect(ctrJSON[0].Config).To(HaveField("Entrypoint", "docker-entrypoint.sh"))
})
It("podman create --pull", func() {
@@ -413,8 +413,8 @@ var _ = Describe("Podman create", func() {
inspect.WaitWithDefaultTimeout()
data := inspect.InspectContainerToJSON()
Expect(data).To(HaveLen(1))
- Expect(data[0].HostConfig.RestartPolicy.Name).To(Equal("on-failure"))
- Expect(data[0].HostConfig.RestartPolicy.MaximumRetryCount).To(Equal(uint(5)))
+ Expect(data[0].HostConfig.RestartPolicy).To(HaveField("Name", "on-failure"))
+ Expect(data[0].HostConfig.RestartPolicy).To(HaveField("MaximumRetryCount", uint(5)))
})
It("podman create with --restart-policy=always:5 fails", func() {
@@ -434,7 +434,7 @@ var _ = Describe("Podman create", func() {
inspect.WaitWithDefaultTimeout()
data := inspect.InspectContainerToJSON()
Expect(data).To(HaveLen(1))
- Expect(data[0].HostConfig.RestartPolicy.Name).To(Equal(unlessStopped))
+ Expect(data[0].HostConfig.RestartPolicy).To(HaveField("Name", unlessStopped))
})
It("podman create with -m 1000000 sets swap to 2000000", func() {
@@ -448,7 +448,7 @@ var _ = Describe("Podman create", func() {
inspect.WaitWithDefaultTimeout()
data := inspect.InspectContainerToJSON()
Expect(data).To(HaveLen(1))
- Expect(data[0].HostConfig.MemorySwap).To(Equal(int64(2 * numMem)))
+ Expect(data[0].HostConfig).To(HaveField("MemorySwap", int64(2*numMem)))
})
It("podman create --cpus 5 sets nanocpus", func() {
@@ -463,7 +463,7 @@ var _ = Describe("Podman create", func() {
inspect.WaitWithDefaultTimeout()
data := inspect.InspectContainerToJSON()
Expect(data).To(HaveLen(1))
- Expect(data[0].HostConfig.NanoCpus).To(Equal(int64(nanoCPUs)))
+ Expect(data[0].HostConfig).To(HaveField("NanoCpus", int64(nanoCPUs)))
})
It("podman create --replace", func() {
@@ -491,7 +491,7 @@ var _ = Describe("Podman create", func() {
inspect.WaitWithDefaultTimeout()
data := inspect.InspectContainerToJSON()
Expect(data).To(HaveLen(1))
- Expect(data[0].Config.StopSignal).To(Equal(uint(15)))
+ Expect(data[0].Config).To(HaveField("StopSignal", uint(15)))
})
It("podman create --tz", func() {
@@ -509,7 +509,7 @@ var _ = Describe("Podman create", func() {
inspect.WaitWithDefaultTimeout()
data := inspect.InspectContainerToJSON()
Expect(data).To(HaveLen(1))
- Expect(data[0].Config.Timezone).To(Equal("Pacific/Honolulu"))
+ Expect(data[0].Config).To(HaveField("Timezone", "Pacific/Honolulu"))
session = podmanTest.Podman([]string{"create", "--tz", "local", "--name", "lcl", ALPINE, "date"})
session.WaitWithDefaultTimeout()
@@ -517,7 +517,7 @@ var _ = Describe("Podman create", func() {
inspect.WaitWithDefaultTimeout()
data = inspect.InspectContainerToJSON()
Expect(data).To(HaveLen(1))
- Expect(data[0].Config.Timezone).To(Equal("local"))
+ Expect(data[0].Config).To(HaveField("Timezone", "local"))
})
It("podman create --umask", func() {
@@ -531,7 +531,7 @@ var _ = Describe("Podman create", func() {
inspect.WaitWithDefaultTimeout()
data := inspect.InspectContainerToJSON()
Expect(data).To(HaveLen(1))
- Expect(data[0].Config.Umask).To(Equal("0022"))
+ Expect(data[0].Config).To(HaveField("Umask", "0022"))
session = podmanTest.Podman([]string{"create", "--umask", "0002", "--name", "umask", ALPINE})
session.WaitWithDefaultTimeout()
@@ -539,7 +539,7 @@ var _ = Describe("Podman create", func() {
inspect.WaitWithDefaultTimeout()
data = inspect.InspectContainerToJSON()
Expect(data).To(HaveLen(1))
- Expect(data[0].Config.Umask).To(Equal("0002"))
+ Expect(data[0].Config).To(HaveField("Umask", "0002"))
session = podmanTest.Podman([]string{"create", "--umask", "0077", "--name", "fedora", fedoraMinimal})
session.WaitWithDefaultTimeout()
@@ -547,7 +547,7 @@ var _ = Describe("Podman create", func() {
inspect.WaitWithDefaultTimeout()
data = inspect.InspectContainerToJSON()
Expect(data).To(HaveLen(1))
- Expect(data[0].Config.Umask).To(Equal("0077"))
+ Expect(data[0].Config).To(HaveField("Umask", "0077"))
session = podmanTest.Podman([]string{"create", "--umask", "22", "--name", "umask-short", ALPINE})
session.WaitWithDefaultTimeout()
@@ -555,7 +555,7 @@ var _ = Describe("Podman create", func() {
inspect.WaitWithDefaultTimeout()
data = inspect.InspectContainerToJSON()
Expect(data).To(HaveLen(1))
- Expect(data[0].Config.Umask).To(Equal("0022"))
+ Expect(data[0].Config).To(HaveField("Umask", "0022"))
session = podmanTest.Podman([]string{"create", "--umask", "9999", "--name", "bad", ALPINE})
session.WaitWithDefaultTimeout()
@@ -689,8 +689,8 @@ var _ = Describe("Podman create", func() {
idata := setup.InspectImageJSON() // returns []inspect.ImageData
Expect(idata).To(HaveLen(1))
- Expect(idata[0].Os).To(Equal(runtime.GOOS))
- Expect(idata[0].Architecture).To(Equal("arm64"))
+ Expect(idata[0]).To(HaveField("Os", runtime.GOOS))
+ Expect(idata[0]).To(HaveField("Architecture", "arm64"))
})
It("podman create --uid/gidmap --pod conflict test", func() {
diff --git a/test/e2e/diff_test.go b/test/e2e/diff_test.go
index fb6df8f45..a1f57f41b 100644
--- a/test/e2e/diff_test.go
+++ b/test/e2e/diff_test.go
@@ -26,7 +26,6 @@ var _ = Describe("Podman diff", func() {
}
podmanTest = PodmanTestCreate(tempdir)
podmanTest.Setup()
- podmanTest.SeedImages()
})
AfterEach(func() {
diff --git a/test/e2e/events_test.go b/test/e2e/events_test.go
index 1d4560e8e..725118ab0 100644
--- a/test/e2e/events_test.go
+++ b/test/e2e/events_test.go
@@ -29,7 +29,6 @@ var _ = Describe("Podman events", func() {
}
podmanTest = PodmanTestCreate(tempdir)
podmanTest.Setup()
- podmanTest.SeedImages()
})
AfterEach(func() {
diff --git a/test/e2e/exec_test.go b/test/e2e/exec_test.go
index 3987746d0..f4ee688b7 100644
--- a/test/e2e/exec_test.go
+++ b/test/e2e/exec_test.go
@@ -27,7 +27,6 @@ var _ = Describe("Podman exec", func() {
}
podmanTest = PodmanTestCreate(tempdir)
podmanTest.Setup()
- podmanTest.SeedImages()
})
AfterEach(func() {
diff --git a/test/e2e/export_test.go b/test/e2e/export_test.go
index 78811f1b5..59cbe06ef 100644
--- a/test/e2e/export_test.go
+++ b/test/e2e/export_test.go
@@ -24,7 +24,6 @@ var _ = Describe("Podman export", func() {
}
podmanTest = PodmanTestCreate(tempdir)
podmanTest.Setup()
- podmanTest.SeedImages()
})
AfterEach(func() {
diff --git a/test/e2e/generate_kube_test.go b/test/e2e/generate_kube_test.go
index 9c99c3d93..2ca774a03 100644
--- a/test/e2e/generate_kube_test.go
+++ b/test/e2e/generate_kube_test.go
@@ -32,7 +32,6 @@ var _ = Describe("Podman generate kube", func() {
}
podmanTest = PodmanTestCreate(tempdir)
podmanTest.Setup()
- podmanTest.SeedImages()
})
AfterEach(func() {
@@ -66,16 +65,16 @@ var _ = Describe("Podman generate kube", func() {
pod := new(v1.Pod)
err := yaml.Unmarshal(kube.Out.Contents(), pod)
Expect(err).To(BeNil())
- Expect(pod.Spec.HostNetwork).To(Equal(false))
+ Expect(pod.Spec).To(HaveField("HostNetwork", false))
Expect(pod.Spec.SecurityContext).To(BeNil())
Expect(pod.Spec.DNSConfig).To(BeNil())
- Expect(pod.Spec.Containers[0].WorkingDir).To(Equal(""))
+ Expect(pod.Spec.Containers[0]).To(HaveField("WorkingDir", ""))
Expect(pod.Spec.Containers[0].Env).To(BeNil())
- Expect(pod.Name).To(Equal("top-pod"))
+ Expect(pod).To(HaveField("Name", "top-pod"))
numContainers := 0
for range pod.Spec.Containers {
- numContainers = numContainers + 1
+ numContainers++
}
Expect(numContainers).To(Equal(1))
})
@@ -165,11 +164,11 @@ var _ = Describe("Podman generate kube", func() {
pod := new(v1.Pod)
err := yaml.Unmarshal(kube.Out.Contents(), pod)
Expect(err).To(BeNil())
- Expect(pod.Spec.HostNetwork).To(Equal(false))
+ Expect(pod.Spec).To(HaveField("HostNetwork", false))
numContainers := 0
for range pod.Spec.Containers {
- numContainers = numContainers + 1
+ numContainers++
}
Expect(numContainers).To(Equal(1))
})
@@ -211,7 +210,7 @@ var _ = Describe("Podman generate kube", func() {
pod := new(v1.Pod)
err := yaml.Unmarshal(kube.Out.Contents(), pod)
Expect(err).To(BeNil())
- Expect(pod.Spec.HostNetwork).To(Equal(false))
+ Expect(pod.Spec).To(HaveField("HostNetwork", false))
numContainers := len(pod.Spec.Containers) + len(pod.Spec.InitContainers)
Expect(numContainers).To(Equal(3))
@@ -232,7 +231,7 @@ var _ = Describe("Podman generate kube", func() {
pod = new(v1.Pod)
err = yaml.Unmarshal(kube.Out.Contents(), pod)
Expect(err).To(BeNil())
- Expect(pod.Spec.HostNetwork).To(Equal(false))
+ Expect(pod.Spec).To(HaveField("HostNetwork", false))
numContainers = len(pod.Spec.Containers) + len(pod.Spec.InitContainers)
Expect(numContainers).To(Equal(2))
@@ -257,7 +256,7 @@ var _ = Describe("Podman generate kube", func() {
pod = new(v1.Pod)
err = yaml.Unmarshal(kube.Out.Contents(), pod)
Expect(err).To(BeNil())
- Expect(pod.Spec.HostNetwork).To(Equal(false))
+ Expect(pod.Spec).To(HaveField("HostNetwork", false))
numContainers = len(pod.Spec.Containers) + len(pod.Spec.InitContainers)
Expect(numContainers).To(Equal(1))
@@ -279,7 +278,7 @@ var _ = Describe("Podman generate kube", func() {
pod := new(v1.Pod)
err := yaml.Unmarshal(kube.Out.Contents(), pod)
Expect(err).To(BeNil())
- Expect(pod.Spec.HostNetwork).To(Equal(true))
+ Expect(pod.Spec).To(HaveField("HostNetwork", true))
})
It("podman generate kube on container with host network", func() {
@@ -294,7 +293,7 @@ var _ = Describe("Podman generate kube", func() {
pod := new(v1.Pod)
err := yaml.Unmarshal(kube.Out.Contents(), pod)
Expect(err).To(BeNil())
- Expect(pod.Spec.HostNetwork).To(Equal(true))
+ Expect(pod.Spec).To(HaveField("HostNetwork", true))
})
It("podman generate kube on pod with hostAliases", func() {
@@ -325,8 +324,8 @@ var _ = Describe("Podman generate kube", func() {
err := yaml.Unmarshal(kube.Out.Contents(), pod)
Expect(err).To(BeNil())
Expect(pod.Spec.HostAliases).To(HaveLen(2))
- Expect(pod.Spec.HostAliases[0].IP).To(Equal(testIP))
- Expect(pod.Spec.HostAliases[1].IP).To(Equal(testIP))
+ Expect(pod.Spec.HostAliases[0]).To(HaveField("IP", testIP))
+ Expect(pod.Spec.HostAliases[1]).To(HaveField("IP", testIP))
})
It("podman generate service kube on pod", func() {
@@ -347,7 +346,7 @@ var _ = Describe("Podman generate kube", func() {
Expect(err).To(BeNil())
Expect(svc.Spec.Ports).To(HaveLen(1))
Expect(svc.Spec.Ports[0].TargetPort.IntValue()).To(Equal(4000))
- Expect(svc.Spec.Ports[0].Protocol).To(Equal(v1.ProtocolUDP))
+ Expect(svc.Spec.Ports[0]).To(HaveField("Protocol", v1.ProtocolUDP))
pod := new(v1.Pod)
err = yaml.Unmarshal([]byte(arr[1]), pod)
@@ -478,11 +477,11 @@ var _ = Describe("Podman generate kube", func() {
// for k8s
Expect(port.Protocol).To(BeEmpty())
if port.HostPort == 4000 {
- foundPort4000 = foundPort4000 + 1
+ foundPort4000++
} else if port.HostPort == 5000 {
- foundPort5000 = foundPort5000 + 1
+ foundPort5000++
} else {
- foundOtherPort = foundOtherPort + 1
+ foundOtherPort++
}
}
}
@@ -506,7 +505,7 @@ var _ = Describe("Podman generate kube", func() {
containers := pod.Spec.Containers
Expect(containers).To(HaveLen(1))
Expect(containers[0].Ports).To(HaveLen(1))
- Expect(containers[0].Ports[0].Protocol).To(Equal(v1.ProtocolUDP))
+ Expect(containers[0].Ports[0]).To(HaveField("Protocol", v1.ProtocolUDP))
})
It("podman generate and reimport kube on pod", func() {
@@ -776,8 +775,9 @@ var _ = Describe("Podman generate kube", func() {
Expect(pod.Spec.DNSConfig.Nameservers).To(ContainElement("8.8.8.8"))
Expect(pod.Spec.DNSConfig.Searches).To(ContainElement("foobar.com"))
Expect(len(pod.Spec.DNSConfig.Options)).To(BeNumerically(">", 0))
- Expect(pod.Spec.DNSConfig.Options[0].Name).To(Equal("color"))
- Expect(*pod.Spec.DNSConfig.Options[0].Value).To(Equal("blue"))
+ Expect(pod.Spec.DNSConfig.Options[0]).To(HaveField("Name", "color"))
+ s := "blue"
+ Expect(pod.Spec.DNSConfig.Options[0]).To(HaveField("Value", &s))
})
It("podman generate kube multiple container dns servers and options are cumulative", func() {
@@ -819,8 +819,9 @@ var _ = Describe("Podman generate kube", func() {
Expect(pod.Spec.DNSConfig.Nameservers).To(ContainElement("8.8.8.8"))
Expect(pod.Spec.DNSConfig.Searches).To(ContainElement("foobar.com"))
Expect(len(pod.Spec.DNSConfig.Options)).To(BeNumerically(">", 0))
- Expect(pod.Spec.DNSConfig.Options[0].Name).To(Equal("color"))
- Expect(*pod.Spec.DNSConfig.Options[0].Value).To(Equal("blue"))
+ Expect(pod.Spec.DNSConfig.Options[0]).To(HaveField("Name", "color"))
+ s := "blue"
+ Expect(pod.Spec.DNSConfig.Options[0]).To(HaveField("Value", &s))
})
It("podman generate kube - set entrypoint as command", func() {
@@ -841,8 +842,8 @@ var _ = Describe("Podman generate kube", func() {
containers := pod.Spec.Containers
Expect(containers).To(HaveLen(1))
- Expect(containers[0].Command).To(Equal([]string{"/bin/sleep"}))
- Expect(containers[0].Args).To(Equal([]string{"10s"}))
+ Expect(containers[0]).To(HaveField("Command", []string{"/bin/sleep"}))
+ Expect(containers[0]).To(HaveField("Args", []string{"10s"}))
})
It("podman generate kube - use command from image unless explicitly set in the podman command", func() {
@@ -881,7 +882,7 @@ var _ = Describe("Podman generate kube", func() {
containers = pod.Spec.Containers
Expect(containers).To(HaveLen(1))
- Expect(containers[0].Command).To(Equal(cmd))
+ Expect(containers[0]).To(HaveField("Command", cmd))
})
It("podman generate kube - use entrypoint from image unless --entrypoint is set", func() {
@@ -916,7 +917,7 @@ ENTRYPOINT ["sleep"]`
containers := pod.Spec.Containers
Expect(containers).To(HaveLen(1))
- Expect(containers[0].Args).To(Equal([]string{"10s"}))
+ Expect(containers[0]).To(HaveField("Args", []string{"10s"}))
session = podmanTest.Podman([]string{"create", "--pod", "new:testpod-2", "--entrypoint", "echo", image, "hello"})
session.WaitWithDefaultTimeout()
@@ -934,8 +935,8 @@ ENTRYPOINT ["sleep"]`
containers = pod.Spec.Containers
Expect(containers).To(HaveLen(1))
- Expect(containers[0].Command).To(Equal([]string{"echo"}))
- Expect(containers[0].Args).To(Equal([]string{"hello"}))
+ Expect(containers[0]).To(HaveField("Command", []string{"echo"}))
+ Expect(containers[0]).To(HaveField("Args", []string{"hello"}))
})
It("podman generate kube - --privileged container", func() {
@@ -1018,7 +1019,7 @@ USER test1`
pvc := new(v1.PersistentVolumeClaim)
err := yaml.Unmarshal(kube.Out.Contents(), pvc)
Expect(err).To(BeNil())
- Expect(pvc.Name).To(Equal(vol))
+ Expect(pvc).To(HaveField("Name", vol))
Expect(pvc.Spec.AccessModes[0]).To(Equal(v1.ReadWriteOnce))
Expect(pvc.Spec.Resources.Requests.Storage().String()).To(Equal("1Gi"))
})
@@ -1040,7 +1041,7 @@ USER test1`
pvc := new(v1.PersistentVolumeClaim)
err := yaml.Unmarshal(kube.Out.Contents(), pvc)
Expect(err).To(BeNil())
- Expect(pvc.Name).To(Equal(vol))
+ Expect(pvc).To(HaveField("Name", vol))
Expect(pvc.Spec.AccessModes[0]).To(Equal(v1.ReadWriteOnce))
Expect(pvc.Spec.Resources.Requests.Storage().String()).To(Equal("1Gi"))
@@ -1092,8 +1093,8 @@ USER test1`
pod := new(v1.Pod)
err := yaml.Unmarshal(kube.Out.Contents(), pod)
Expect(err).To(BeNil())
- Expect(pod.Spec.Containers[0].WorkingDir).To(Equal(""))
- Expect(pod.Spec.Containers[1].WorkingDir).To(Equal("/root"))
+ Expect(pod.Spec.Containers[0]).To(HaveField("WorkingDir", ""))
+ Expect(pod.Spec.Containers[1]).To(HaveField("WorkingDir", "/root"))
for _, ctr := range []string{"top1", "top2"} {
Expect(pod.Annotations).To(HaveKeyWithValue("io.containers.autoupdate/"+ctr, "registry"))
diff --git a/test/e2e/generate_systemd_test.go b/test/e2e/generate_systemd_test.go
index e4b854332..08e8fbc8c 100644
--- a/test/e2e/generate_systemd_test.go
+++ b/test/e2e/generate_systemd_test.go
@@ -24,7 +24,6 @@ var _ = Describe("Podman generate systemd", func() {
}
podmanTest = PodmanTestCreate(tempdir)
podmanTest.Setup()
- podmanTest.SeedImages()
})
AfterEach(func() {
@@ -581,6 +580,7 @@ var _ = Describe("Podman generate systemd", func() {
})
It("podman generate systemd --new create command with double curly braces", func() {
+ SkipIfInContainer("journald inside a container doesn't work")
// Regression test for #9034
session := podmanTest.Podman([]string{"create", "--name", "foo", "--log-driver=journald", "--log-opt=tag={{.Name}}", ALPINE})
session.WaitWithDefaultTimeout()
diff --git a/test/e2e/healthcheck_run_test.go b/test/e2e/healthcheck_run_test.go
index 23f1a1dbf..add739988 100644
--- a/test/e2e/healthcheck_run_test.go
+++ b/test/e2e/healthcheck_run_test.go
@@ -28,14 +28,13 @@ var _ = Describe("Podman healthcheck run", func() {
}
podmanTest = PodmanTestCreate(tempdir)
podmanTest.Setup()
- podmanTest.SeedImages()
})
AfterEach(func() {
podmanTest.Cleanup()
f := CurrentGinkgoTestDescription()
timedResult := fmt.Sprintf("Test: %s completed in %f seconds", f.TestText, f.Duration.Seconds())
- GinkgoWriter.Write([]byte(timedResult))
+ _, _ = GinkgoWriter.Write([]byte(timedResult))
})
@@ -168,7 +167,7 @@ var _ = Describe("Podman healthcheck run", func() {
session.WaitWithDefaultTimeout()
Expect(session).Should(Exit(0))
inspect := podmanTest.InspectContainer("hc")
- Expect(inspect[0].State.Health.Status).To(Equal("starting"))
+ Expect(inspect[0].State.Health).To(HaveField("Status", "starting"))
})
It("podman healthcheck failed checks in start-period should not change status", func() {
@@ -189,9 +188,9 @@ var _ = Describe("Podman healthcheck run", func() {
Expect(hc).Should(Exit(1))
inspect := podmanTest.InspectContainer("hc")
- Expect(inspect[0].State.Health.Status).To(Equal("starting"))
+ Expect(inspect[0].State.Health).To(HaveField("Status", "starting"))
// test old podman compat (see #11645)
- Expect(inspect[0].State.Healthcheck().Status).To(Equal("starting"))
+ Expect(inspect[0].State.Healthcheck()).To(HaveField("Status", "starting"))
})
It("podman healthcheck failed checks must reach retries before unhealthy ", func() {
@@ -204,16 +203,16 @@ var _ = Describe("Podman healthcheck run", func() {
Expect(hc).Should(Exit(1))
inspect := podmanTest.InspectContainer("hc")
- Expect(inspect[0].State.Health.Status).To(Equal("starting"))
+ Expect(inspect[0].State.Health).To(HaveField("Status", "starting"))
hc = podmanTest.Podman([]string{"healthcheck", "run", "hc"})
hc.WaitWithDefaultTimeout()
Expect(hc).Should(Exit(1))
inspect = podmanTest.InspectContainer("hc")
- Expect(inspect[0].State.Health.Status).To(Equal(define.HealthCheckUnhealthy))
+ Expect(inspect[0].State.Health).To(HaveField("Status", define.HealthCheckUnhealthy))
// test old podman compat (see #11645)
- Expect(inspect[0].State.Healthcheck().Status).To(Equal(define.HealthCheckUnhealthy))
+ Expect(inspect[0].State.Healthcheck()).To(HaveField("Status", define.HealthCheckUnhealthy))
})
It("podman healthcheck good check results in healthy even in start-period", func() {
@@ -226,7 +225,7 @@ var _ = Describe("Podman healthcheck run", func() {
Expect(hc).Should(Exit(0))
inspect := podmanTest.InspectContainer("hc")
- Expect(inspect[0].State.Health.Status).To(Equal(define.HealthCheckHealthy))
+ Expect(inspect[0].State.Health).To(HaveField("Status", define.HealthCheckHealthy))
})
It("podman healthcheck unhealthy but valid arguments check", func() {
@@ -249,14 +248,14 @@ var _ = Describe("Podman healthcheck run", func() {
Expect(hc).Should(Exit(1))
inspect := podmanTest.InspectContainer("hc")
- Expect(inspect[0].State.Health.Status).To(Equal("starting"))
+ Expect(inspect[0].State.Health).To(HaveField("Status", "starting"))
hc = podmanTest.Podman([]string{"healthcheck", "run", "hc"})
hc.WaitWithDefaultTimeout()
Expect(hc).Should(Exit(1))
inspect = podmanTest.InspectContainer("hc")
- Expect(inspect[0].State.Health.Status).To(Equal(define.HealthCheckUnhealthy))
+ Expect(inspect[0].State.Health).To(HaveField("Status", define.HealthCheckUnhealthy))
foo := podmanTest.Podman([]string{"exec", "hc", "touch", "/foo"})
foo.WaitWithDefaultTimeout()
@@ -267,7 +266,7 @@ var _ = Describe("Podman healthcheck run", func() {
Expect(hc).Should(Exit(0))
inspect = podmanTest.InspectContainer("hc")
- Expect(inspect[0].State.Health.Status).To(Equal(define.HealthCheckHealthy))
+ Expect(inspect[0].State.Health).To(HaveField("Status", define.HealthCheckHealthy))
// Test podman ps --filter heath is working (#11687)
ps := podmanTest.Podman([]string{"ps", "--filter", "health=healthy"})
@@ -328,6 +327,6 @@ HEALTHCHECK CMD ls -l / 2>&1`, ALPINE)
// Check to make sure a default time interval value was added
Expect(inspect[0].Config.Healthcheck.Interval).To(BeNumerically("==", 30000000000))
// Check to make sure characters were not coerced to utf8
- Expect(inspect[0].Config.Healthcheck.Test).To(Equal([]string{"CMD-SHELL", "ls -l / 2>&1"}))
+ Expect(inspect[0].Config.Healthcheck).To(HaveField("Test", []string{"CMD-SHELL", "ls -l / 2>&1"}))
})
})
diff --git a/test/e2e/history_test.go b/test/e2e/history_test.go
index 92e0e1b08..d637fd9af 100644
--- a/test/e2e/history_test.go
+++ b/test/e2e/history_test.go
@@ -23,7 +23,6 @@ var _ = Describe("Podman history", func() {
}
podmanTest = PodmanTestCreate(tempdir)
podmanTest.Setup()
- podmanTest.SeedImages()
})
AfterEach(func() {
diff --git a/test/e2e/hooks/checkhook.json b/test/e2e/hooks/checkhook.json
deleted file mode 100644
index 5a9bc86d1..000000000
--- a/test/e2e/hooks/checkhook.json
+++ /dev/null
@@ -1,5 +0,0 @@
-{
- "cmd" : [".*"],
- "hook" : "/tmp/checkhook.sh",
- "stage" : [ "prestart" ]
-}
diff --git a/test/e2e/hooks/checkhook.sh b/test/e2e/hooks/checkhook.sh
deleted file mode 100755
index 8b755cb40..000000000
--- a/test/e2e/hooks/checkhook.sh
+++ /dev/null
@@ -1,4 +0,0 @@
-#!/bin/sh
-echo $@ >> /run/hookscheck
-read line
-echo $line >> /run/hookscheck
diff --git a/test/e2e/image_scp_test.go b/test/e2e/image_scp_test.go
index 5abdf74f8..2ad3cc75e 100644
--- a/test/e2e/image_scp_test.go
+++ b/test/e2e/image_scp_test.go
@@ -75,7 +75,7 @@ var _ = Describe("podman image scp", func() {
cfg, err := config.ReadCustomConfig()
Expect(err).ShouldNot(HaveOccurred())
- Expect(cfg.Engine.ActiveService).To(Equal("QA"))
+ Expect(cfg.Engine).To(HaveField("ActiveService", "QA"))
Expect(cfg.Engine.ServiceDestinations).To(HaveKeyWithValue("QA",
config.Destination{
URI: "ssh://root@server.fubar.com:2222/run/podman/podman.sock",
diff --git a/test/e2e/image_sign_test.go b/test/e2e/image_sign_test.go
index dbf697bb0..3c819a7d2 100644
--- a/test/e2e/image_sign_test.go
+++ b/test/e2e/image_sign_test.go
@@ -28,8 +28,6 @@ var _ = Describe("Podman image sign", func() {
}
podmanTest = PodmanTestCreate(tempdir)
podmanTest.Setup()
- podmanTest.SeedImages()
-
tempGNUPGHOME := filepath.Join(podmanTest.TempDir, "tmpGPG")
err := os.Mkdir(tempGNUPGHOME, os.ModePerm)
Expect(err).To(BeNil())
diff --git a/test/e2e/images_test.go b/test/e2e/images_test.go
index d34c911ad..2473ec59e 100644
--- a/test/e2e/images_test.go
+++ b/test/e2e/images_test.go
@@ -27,7 +27,6 @@ var _ = Describe("Podman images", func() {
}
podmanTest = PodmanTestCreate(tempdir)
podmanTest.Setup()
- podmanTest.SeedImages()
})
AfterEach(func() {
@@ -438,7 +437,7 @@ RUN > file2
Expect(result).Should(Exit(0))
Expect(result.OutputToStringArray()).To(HaveLen(1))
- //check if really abc is removed
+ // check if really abc is removed
result = podmanTest.Podman([]string{"image", "list", "--filter", "label=abc"})
Expect(result.OutputToStringArray()).To(BeEmpty())
@@ -459,7 +458,7 @@ RUN > file2
Expect(result).Should(Exit(0))
Expect(result.OutputToStringArray()).To(HaveLen(1))
- //check if really abc is removed
+ // check if really abc is removed
result = podmanTest.Podman([]string{"image", "list", "--filter", "label=abc"})
Expect(result.OutputToStringArray()).To(BeEmpty())
diff --git a/test/e2e/import_test.go b/test/e2e/import_test.go
index f62df23d9..e6995f0e6 100644
--- a/test/e2e/import_test.go
+++ b/test/e2e/import_test.go
@@ -24,7 +24,6 @@ var _ = Describe("Podman import", func() {
}
podmanTest = PodmanTestCreate(tempdir)
podmanTest.Setup()
- podmanTest.SeedImages()
})
AfterEach(func() {
diff --git a/test/e2e/init_test.go b/test/e2e/init_test.go
index c4c090daf..ccc102fa3 100644
--- a/test/e2e/init_test.go
+++ b/test/e2e/init_test.go
@@ -23,7 +23,6 @@ var _ = Describe("Podman init", func() {
}
podmanTest = PodmanTestCreate(tempdir)
podmanTest.Setup()
- podmanTest.SeedImages()
})
AfterEach(func() {
@@ -57,7 +56,7 @@ var _ = Describe("Podman init", func() {
result.WaitWithDefaultTimeout()
Expect(result).Should(Exit(0))
conData := result.InspectContainerToJSON()
- Expect(conData[0].State.Status).To(Equal("initialized"))
+ Expect(conData[0].State).To(HaveField("Status", "initialized"))
})
It("podman init single container by name", func() {
@@ -72,7 +71,7 @@ var _ = Describe("Podman init", func() {
result.WaitWithDefaultTimeout()
Expect(result).Should(Exit(0))
conData := result.InspectContainerToJSON()
- Expect(conData[0].State.Status).To(Equal("initialized"))
+ Expect(conData[0].State).To(HaveField("Status", "initialized"))
})
It("podman init latest container", func() {
@@ -87,7 +86,7 @@ var _ = Describe("Podman init", func() {
result.WaitWithDefaultTimeout()
Expect(result).Should(Exit(0))
conData := result.InspectContainerToJSON()
- Expect(conData[0].State.Status).To(Equal("initialized"))
+ Expect(conData[0].State).To(HaveField("Status", "initialized"))
})
It("podman init all three containers, one running", func() {
@@ -107,17 +106,17 @@ var _ = Describe("Podman init", func() {
result.WaitWithDefaultTimeout()
Expect(result).Should(Exit(0))
conData := result.InspectContainerToJSON()
- Expect(conData[0].State.Status).To(Equal("initialized"))
+ Expect(conData[0].State).To(HaveField("Status", "initialized"))
result2 := podmanTest.Podman([]string{"inspect", "test2"})
result2.WaitWithDefaultTimeout()
Expect(result2).Should(Exit(0))
conData2 := result2.InspectContainerToJSON()
- Expect(conData2[0].State.Status).To(Equal("initialized"))
+ Expect(conData2[0].State).To(HaveField("Status", "initialized"))
result3 := podmanTest.Podman([]string{"inspect", "test3"})
result3.WaitWithDefaultTimeout()
Expect(result3).Should(Exit(0))
conData3 := result3.InspectContainerToJSON()
- Expect(conData3[0].State.Status).To(Equal("running"))
+ Expect(conData3[0].State).To(HaveField("Status", "running"))
})
It("podman init running container errors", func() {
diff --git a/test/e2e/inspect_test.go b/test/e2e/inspect_test.go
index bb5a3a6ad..6fe850f0b 100644
--- a/test/e2e/inspect_test.go
+++ b/test/e2e/inspect_test.go
@@ -24,7 +24,6 @@ var _ = Describe("Podman inspect", func() {
}
podmanTest = PodmanTestCreate(tempdir)
podmanTest.Setup()
- podmanTest.SeedImages()
})
AfterEach(func() {
@@ -189,7 +188,7 @@ var _ = Describe("Podman inspect", func() {
imageData := session.InspectImageJSON()
Expect(imageData[0].HealthCheck.Timeout).To(BeNumerically("==", 3000000000))
Expect(imageData[0].HealthCheck.Interval).To(BeNumerically("==", 60000000000))
- Expect(imageData[0].HealthCheck.Test).To(Equal([]string{"CMD-SHELL", "curl -f http://localhost/ || exit 1"}))
+ Expect(imageData[0].HealthCheck).To(HaveField("Test", []string{"CMD-SHELL", "curl -f http://localhost/ || exit 1"}))
})
It("podman inspect --latest with no container fails", func() {
@@ -217,7 +216,7 @@ var _ = Describe("Podman inspect", func() {
imageJSON := imageInspect.InspectImageJSON()
Expect(imageJSON).To(HaveLen(1))
- Expect(baseJSON[0].ID).To(Equal(imageJSON[0].ID))
+ Expect(baseJSON[0]).To(HaveField("ID", imageJSON[0].ID))
})
It("podman [image, container] inspect on container", func() {
@@ -242,7 +241,7 @@ var _ = Describe("Podman inspect", func() {
imageInspect.WaitWithDefaultTimeout()
Expect(imageInspect).To(ExitWithError())
- Expect(baseJSON[0].ID).To(Equal(ctrJSON[0].ID))
+ Expect(baseJSON[0]).To(HaveField("ID", ctrJSON[0].ID))
})
It("podman inspect always produces a valid array", func() {
@@ -264,7 +263,7 @@ var _ = Describe("Podman inspect", func() {
Expect(baseInspect).To(ExitWithError())
baseJSON := baseInspect.InspectContainerToJSON()
Expect(baseJSON).To(HaveLen(1))
- Expect(baseJSON[0].Name).To(Equal(ctrName))
+ Expect(baseJSON[0]).To(HaveField("Name", ctrName))
})
It("podman inspect container + image with same name gives container", func() {
@@ -283,7 +282,7 @@ var _ = Describe("Podman inspect", func() {
Expect(baseInspect).Should(Exit(0))
baseJSON := baseInspect.InspectContainerToJSON()
Expect(baseJSON).To(HaveLen(1))
- Expect(baseJSON[0].Name).To(Equal(ctrName))
+ Expect(baseJSON[0]).To(HaveField("Name", ctrName))
})
It("podman inspect - HostConfig.SecurityOpt ", func() {
@@ -307,7 +306,7 @@ var _ = Describe("Podman inspect", func() {
Expect(baseInspect).Should(Exit(0))
baseJSON := baseInspect.InspectContainerToJSON()
Expect(baseJSON).To(HaveLen(1))
- Expect(baseJSON[0].HostConfig.SecurityOpt).To(Equal([]string{"label=type:spc_t,label=level:s0", "seccomp=unconfined"}))
+ Expect(baseJSON[0].HostConfig).To(HaveField("SecurityOpt", []string{"label=type:spc_t,label=level:s0", "seccomp=unconfined"}))
})
It("podman inspect pod", func() {
@@ -321,7 +320,7 @@ var _ = Describe("Podman inspect", func() {
Expect(inspect).Should(Exit(0))
Expect(inspect.OutputToString()).To(BeValidJSON())
podData := inspect.InspectPodArrToJSON()
- Expect(podData[0].Name).To(Equal(podName))
+ Expect(podData[0]).To(HaveField("Name", podName))
})
It("podman inspect pod with type", func() {
@@ -335,7 +334,7 @@ var _ = Describe("Podman inspect", func() {
Expect(inspect).Should(Exit(0))
Expect(inspect.OutputToString()).To(BeValidJSON())
podData := inspect.InspectPodArrToJSON()
- Expect(podData[0].Name).To(Equal(podName))
+ Expect(podData[0]).To(HaveField("Name", podName))
})
It("podman inspect latest pod", func() {
@@ -350,7 +349,7 @@ var _ = Describe("Podman inspect", func() {
Expect(inspect).Should(Exit(0))
Expect(inspect.OutputToString()).To(BeValidJSON())
podData := inspect.InspectPodArrToJSON()
- Expect(podData[0].Name).To(Equal(podName))
+ Expect(podData[0]).To(HaveField("Name", podName))
})
It("podman inspect latest defaults to latest container", func() {
SkipIfRemote("--latest flag n/a")
@@ -371,7 +370,7 @@ var _ = Describe("Podman inspect", func() {
Expect(inspect).Should(Exit(0))
Expect(inspect.OutputToString()).To(BeValidJSON())
containerData := inspect.InspectContainerToJSON()
- Expect(containerData[0].Name).To(Equal(infra))
+ Expect(containerData[0]).To(HaveField("Name", infra))
})
It("podman inspect network", func() {
diff --git a/test/e2e/libpod_suite_remote_test.go b/test/e2e/libpod_suite_remote_test.go
index 9ad2bf7b9..19affbc6d 100644
--- a/test/e2e/libpod_suite_remote_test.go
+++ b/test/e2e/libpod_suite_remote_test.go
@@ -16,6 +16,7 @@ import (
"time"
"github.com/containers/podman/v4/pkg/rootless"
+ . "github.com/onsi/gomega"
)
func IsRemote() bool {
@@ -57,7 +58,8 @@ func (p *PodmanTestIntegration) setDefaultRegistriesConfigEnv() {
func (p *PodmanTestIntegration) setRegistriesConfigEnv(b []byte) {
outfile := filepath.Join(p.TempDir, "registries.conf")
os.Setenv("CONTAINERS_REGISTRIES_CONF", outfile)
- ioutil.WriteFile(outfile, b, 0644)
+ err := ioutil.WriteFile(outfile, b, 0644)
+ Expect(err).ToNot(HaveOccurred())
}
func resetRegistriesConfigEnv() {
@@ -71,7 +73,8 @@ func PodmanTestCreate(tempDir string) *PodmanTestIntegration {
func (p *PodmanTestIntegration) StartRemoteService() {
if os.Geteuid() == 0 {
- os.MkdirAll("/run/podman", 0755)
+ err := os.MkdirAll("/run/podman", 0755)
+ Expect(err).ToNot(HaveOccurred())
}
args := []string{}
@@ -88,7 +91,8 @@ func (p *PodmanTestIntegration) StartRemoteService() {
command.Stdout = os.Stdout
command.Stderr = os.Stderr
fmt.Printf("Running: %s %s\n", p.PodmanBinary, strings.Join(podmanOptions, " "))
- command.Start()
+ err := command.Start()
+ Expect(err).ToNot(HaveOccurred())
command.SysProcAttr = &syscall.SysProcAttr{Setpgid: true}
p.RemoteCommand = command
p.RemoteSession = command.Process
@@ -134,9 +138,6 @@ func getRemoteOptions(p *PodmanTestIntegration, args []string) []string {
networkDir := p.NetworkConfigDir
podmanOptions := strings.Split(fmt.Sprintf("--root %s --runroot %s --runtime %s --conmon %s --network-config-dir %s --cgroup-manager %s",
p.Root, p.RunRoot, p.OCIRuntime, p.ConmonBinary, networkDir, p.CgroupManager), " ")
- if os.Getenv("HOOK_OPTION") != "" {
- podmanOptions = append(podmanOptions, os.Getenv("HOOK_OPTION"))
- }
if p.NetworkBackend.ToString() == "netavark" {
podmanOptions = append(podmanOptions, "--network-backend", "netavark")
}
@@ -145,11 +146,6 @@ func getRemoteOptions(p *PodmanTestIntegration, args []string) []string {
return podmanOptions
}
-// SeedImages restores all the artifacts into the main store for remote tests
-func (p *PodmanTestIntegration) SeedImages() error {
- return nil
-}
-
// RestoreArtifact puts the cached image into our test store
func (p *PodmanTestIntegration) RestoreArtifact(image string) error {
tarball := imageTarPath(image)
@@ -159,8 +155,12 @@ func (p *PodmanTestIntegration) RestoreArtifact(image string) error {
podmanOptions := getRemoteOptions(p, args)
command := exec.Command(p.PodmanBinary, podmanOptions...)
fmt.Printf("Running: %s %s\n", p.PodmanBinary, strings.Join(podmanOptions, " "))
- command.Start()
- command.Wait()
+ if err := command.Start(); err != nil {
+ return err
+ }
+ if err := command.Wait(); err != nil {
+ return err
+ }
}
return nil
}
diff --git a/test/e2e/libpod_suite_test.go b/test/e2e/libpod_suite_test.go
index cf81a0348..a633bd3d7 100644
--- a/test/e2e/libpod_suite_test.go
+++ b/test/e2e/libpod_suite_test.go
@@ -10,6 +10,7 @@ import (
"path/filepath"
"github.com/containers/podman/v4/pkg/rootless"
+ . "github.com/onsi/gomega"
)
func IsRemote() bool {
@@ -40,13 +41,15 @@ func (p *PodmanTestIntegration) PodmanExtraFiles(args []string, extraFiles []*os
func (p *PodmanTestIntegration) setDefaultRegistriesConfigEnv() {
defaultFile := filepath.Join(INTEGRATION_ROOT, "test/registries.conf")
- os.Setenv("CONTAINERS_REGISTRIES_CONF", defaultFile)
+ err := os.Setenv("CONTAINERS_REGISTRIES_CONF", defaultFile)
+ Expect(err).ToNot(HaveOccurred())
}
func (p *PodmanTestIntegration) setRegistriesConfigEnv(b []byte) {
outfile := filepath.Join(p.TempDir, "registries.conf")
os.Setenv("CONTAINERS_REGISTRIES_CONF", outfile)
- ioutil.WriteFile(outfile, b, 0644)
+ err := ioutil.WriteFile(outfile, b, 0644)
+ Expect(err).ToNot(HaveOccurred())
}
func resetRegistriesConfigEnv() {
@@ -70,11 +73,6 @@ func (p *PodmanTestIntegration) RestoreArtifact(image string) error {
func (p *PodmanTestIntegration) StopRemoteService() {}
-// SeedImages is a no-op for localized testing
-func (p *PodmanTestIntegration) SeedImages() error {
- return nil
-}
-
// We don't support running API service when local
func (p *PodmanTestIntegration) StartRemoteService() {
}
diff --git a/test/e2e/load_test.go b/test/e2e/load_test.go
index 8e9f0ad13..1e3f9089a 100644
--- a/test/e2e/load_test.go
+++ b/test/e2e/load_test.go
@@ -64,7 +64,7 @@ var _ = Describe("Podman load", func() {
compress := SystemExec("gzip", []string{outfile})
Expect(compress).Should(Exit(0))
- outfile = outfile + ".gz"
+ outfile += ".gz"
rmi := podmanTest.Podman([]string{"rmi", ALPINE})
rmi.WaitWithDefaultTimeout()
diff --git a/test/e2e/login_logout_test.go b/test/e2e/login_logout_test.go
index 001779cdf..bce8b78c6 100644
--- a/test/e2e/login_logout_test.go
+++ b/test/e2e/login_logout_test.go
@@ -36,7 +36,8 @@ var _ = Describe("Podman login and logout", func() {
podmanTest = PodmanTestCreate(tempdir)
authPath = filepath.Join(podmanTest.TempDir, "auth")
- os.Mkdir(authPath, os.ModePerm)
+ err := os.Mkdir(authPath, os.ModePerm)
+ Expect(err).ToNot(HaveOccurred())
if IsCommandAvailable("getenforce") {
ge := SystemExec("getenforce", []string{})
@@ -55,11 +56,14 @@ var _ = Describe("Podman login and logout", func() {
session.WaitWithDefaultTimeout()
Expect(session).Should(Exit(0))
- f, _ := os.Create(filepath.Join(authPath, "htpasswd"))
+ f, err := os.Create(filepath.Join(authPath, "htpasswd"))
+ Expect(err).ToNot(HaveOccurred())
defer f.Close()
- f.WriteString(session.OutputToString())
- f.Sync()
+ _, err = f.WriteString(session.OutputToString())
+ Expect(err).ToNot(HaveOccurred())
+ err = f.Sync()
+ Expect(err).ToNot(HaveOccurred())
port := GetPort()
server = strings.Join([]string{"localhost", strconv.Itoa(port)}, ":")
@@ -68,7 +72,8 @@ var _ = Describe("Podman login and logout", func() {
testImg = strings.Join([]string{server, "test-alpine"}, "/")
certDirPath = filepath.Join(os.Getenv("HOME"), ".config/containers/certs.d", server)
- os.MkdirAll(certDirPath, os.ModePerm)
+ err = os.MkdirAll(certDirPath, os.ModePerm)
+ Expect(err).ToNot(HaveOccurred())
cwd, _ := os.Getwd()
certPath = filepath.Join(cwd, "../", "certs")
@@ -207,7 +212,8 @@ var _ = Describe("Podman login and logout", func() {
})
It("podman login and logout with --cert-dir", func() {
certDir := filepath.Join(podmanTest.TempDir, "certs")
- os.MkdirAll(certDir, os.ModePerm)
+ err := os.MkdirAll(certDir, os.ModePerm)
+ Expect(err).ToNot(HaveOccurred())
setup := SystemExec("cp", []string{filepath.Join(certPath, "domain.crt"), filepath.Join(certDir, "ca.crt")})
setup.WaitWithDefaultTimeout()
@@ -226,7 +232,8 @@ var _ = Describe("Podman login and logout", func() {
})
It("podman login and logout with multi registry", func() {
certDir := filepath.Join(os.Getenv("HOME"), ".config/containers/certs.d", "localhost:9001")
- os.MkdirAll(certDir, os.ModePerm)
+ err = os.MkdirAll(certDir, os.ModePerm)
+ Expect(err).ToNot(HaveOccurred())
cwd, _ := os.Getwd()
certPath = filepath.Join(cwd, "../", "certs")
diff --git a/test/e2e/logs_test.go b/test/e2e/logs_test.go
index 934a306ce..4e6dcb8af 100644
--- a/test/e2e/logs_test.go
+++ b/test/e2e/logs_test.go
@@ -37,9 +37,6 @@ var _ = Describe("Podman logs", func() {
}
podmanTest = PodmanTestCreate(tempdir)
podmanTest.Setup()
- if err := podmanTest.SeedImages(); err != nil {
- os.Exit(1)
- }
})
AfterEach(func() {
diff --git a/test/e2e/manifest_test.go b/test/e2e/manifest_test.go
index 230864891..92b8bc2e1 100644
--- a/test/e2e/manifest_test.go
+++ b/test/e2e/manifest_test.go
@@ -36,7 +36,6 @@ var _ = Describe("Podman manifest", func() {
}
podmanTest = PodmanTestCreate(tempdir)
podmanTest.Setup()
- podmanTest.SeedImages()
})
AfterEach(func() {
diff --git a/test/e2e/mount_rootless_test.go b/test/e2e/mount_rootless_test.go
index 30d7ce8a9..994a5899b 100644
--- a/test/e2e/mount_rootless_test.go
+++ b/test/e2e/mount_rootless_test.go
@@ -25,7 +25,6 @@ var _ = Describe("Podman mount", func() {
}
podmanTest = PodmanTestCreate(tempdir)
podmanTest.Setup()
- podmanTest.SeedImages()
})
AfterEach(func() {
diff --git a/test/e2e/namespace_test.go b/test/e2e/namespace_test.go
index c3e0e2d23..0000a2327 100644
--- a/test/e2e/namespace_test.go
+++ b/test/e2e/namespace_test.go
@@ -23,7 +23,6 @@ var _ = Describe("Podman namespaces", func() {
}
podmanTest = PodmanTestCreate(tempdir)
podmanTest.Setup()
- podmanTest.SeedImages()
})
AfterEach(func() {
@@ -51,7 +50,7 @@ var _ = Describe("Podman namespaces", func() {
numCtrs := 0
for _, outputLine := range output {
if outputLine != "" {
- numCtrs = numCtrs + 1
+ numCtrs++
}
}
Expect(numCtrs).To(Equal(0))
diff --git a/test/e2e/network_create_test.go b/test/e2e/network_create_test.go
index 82b99bd68..69966b07e 100644
--- a/test/e2e/network_create_test.go
+++ b/test/e2e/network_create_test.go
@@ -32,7 +32,6 @@ var _ = Describe("Podman network create", func() {
}
podmanTest = PodmanTestCreate(tempdir)
podmanTest.Setup()
- podmanTest.SeedImages()
})
AfterEach(func() {
@@ -59,7 +58,7 @@ var _ = Describe("Podman network create", func() {
Expect(err).To(BeNil())
Expect(results).To(HaveLen(1))
result := results[0]
- Expect(result.Name).To(Equal(netName))
+ Expect(result).To(HaveField("Name", netName))
Expect(result.Subnets).To(HaveLen(1))
Expect(result.Subnets[0].Subnet.String()).To(Equal("10.11.12.0/24"))
Expect(result.Subnets[0].Gateway.String()).To(Equal("10.11.12.1"))
@@ -102,7 +101,7 @@ var _ = Describe("Podman network create", func() {
Expect(err).To(BeNil())
Expect(results).To(HaveLen(1))
result := results[0]
- Expect(result.Name).To(Equal(netName))
+ Expect(result).To(HaveField("Name", netName))
Expect(result.Subnets).To(HaveLen(1))
Expect(result.Subnets[0].Gateway.String()).To(Equal("fd00:1:2:3::1"))
Expect(result.Subnets[0].Subnet.String()).To(Equal("fd00:1:2:3::/64"))
@@ -141,7 +140,7 @@ var _ = Describe("Podman network create", func() {
Expect(err).To(BeNil())
Expect(results).To(HaveLen(1))
result := results[0]
- Expect(result.Name).To(Equal(netName))
+ Expect(result).To(HaveField("Name", netName))
Expect(result.Subnets).To(HaveLen(2))
Expect(result.Subnets[0].Subnet.IP).ToNot(BeNil())
Expect(result.Subnets[1].Subnet.IP).ToNot(BeNil())
@@ -173,7 +172,7 @@ var _ = Describe("Podman network create", func() {
Expect(err).To(BeNil())
Expect(results).To(HaveLen(1))
result = results[0]
- Expect(result.Name).To(Equal(netName2))
+ Expect(result).To(HaveField("Name", netName2))
Expect(result.Subnets).To(HaveLen(2))
Expect(result.Subnets[0].Subnet.IP).ToNot(BeNil())
Expect(result.Subnets[1].Subnet.IP).ToNot(BeNil())
diff --git a/test/e2e/network_test.go b/test/e2e/network_test.go
index 89a9005f5..c67a4baed 100644
--- a/test/e2e/network_test.go
+++ b/test/e2e/network_test.go
@@ -293,8 +293,8 @@ var _ = Describe("Podman network", func() {
Expect(conData[0].NetworkSettings.Networks).To(HaveLen(1))
net, ok := conData[0].NetworkSettings.Networks[netName]
Expect(ok).To(BeTrue())
- Expect(net.NetworkID).To(Equal(netName))
- Expect(net.IPPrefixLen).To(Equal(24))
+ Expect(net).To(HaveField("NetworkID", netName))
+ Expect(net).To(HaveField("IPPrefixLen", 24))
Expect(net.IPAddress).To(HavePrefix("10.50.50."))
// Necessary to ensure the CNI network is removed cleanly
@@ -329,10 +329,10 @@ var _ = Describe("Podman network", func() {
Expect(conData[0].NetworkSettings.Networks).To(HaveLen(2))
net1, ok := conData[0].NetworkSettings.Networks[netName1]
Expect(ok).To(BeTrue())
- Expect(net1.NetworkID).To(Equal(netName1))
+ Expect(net1).To(HaveField("NetworkID", netName1))
net2, ok := conData[0].NetworkSettings.Networks[netName2]
Expect(ok).To(BeTrue())
- Expect(net2.NetworkID).To(Equal(netName2))
+ Expect(net2).To(HaveField("NetworkID", netName2))
// Necessary to ensure the CNI network is removed cleanly
rmAll := podmanTest.Podman([]string{"rm", "-t", "0", "-f", ctrName})
@@ -366,13 +366,13 @@ var _ = Describe("Podman network", func() {
Expect(conData[0].NetworkSettings.Networks).To(HaveLen(2))
net1, ok := conData[0].NetworkSettings.Networks[netName1]
Expect(ok).To(BeTrue())
- Expect(net1.NetworkID).To(Equal(netName1))
- Expect(net1.IPPrefixLen).To(Equal(25))
+ Expect(net1).To(HaveField("NetworkID", netName1))
+ Expect(net1).To(HaveField("IPPrefixLen", 25))
Expect(net1.IPAddress).To(HavePrefix("10.50.51."))
net2, ok := conData[0].NetworkSettings.Networks[netName2]
Expect(ok).To(BeTrue())
- Expect(net2.NetworkID).To(Equal(netName2))
- Expect(net2.IPPrefixLen).To(Equal(26))
+ Expect(net2).To(HaveField("NetworkID", netName2))
+ Expect(net2).To(HaveField("IPPrefixLen", 26))
Expect(net2.IPAddress).To(HavePrefix("10.50.51."))
// Necessary to ensure the CNI network is removed cleanly
@@ -601,7 +601,7 @@ var _ = Describe("Podman network", func() {
Expect(err).To(BeNil())
Expect(results).To(HaveLen(1))
result := results[0]
- Expect(result.NetworkInterface).To(Equal(""))
+ Expect(result).To(HaveField("NetworkInterface", ""))
Expect(result.IPAMOptions).To(HaveKeyWithValue("driver", "dhcp"))
nc = podmanTest.Podman([]string{"network", "rm", net})
@@ -628,8 +628,8 @@ var _ = Describe("Podman network", func() {
Expect(results).To(HaveLen(1))
result := results[0]
- Expect(result.Driver).To(Equal("macvlan"))
- Expect(result.NetworkInterface).To(Equal("lo"))
+ Expect(result).To(HaveField("Driver", "macvlan"))
+ Expect(result).To(HaveField("NetworkInterface", "lo"))
Expect(result.IPAMOptions).To(HaveKeyWithValue("driver", "dhcp"))
Expect(result.Subnets).To(HaveLen(0))
@@ -672,8 +672,8 @@ var _ = Describe("Podman network", func() {
result := results[0]
Expect(result.Options).To(HaveKeyWithValue("mtu", "1500"))
- Expect(result.Driver).To(Equal("macvlan"))
- Expect(result.NetworkInterface).To(Equal("lo"))
+ Expect(result).To(HaveField("Driver", "macvlan"))
+ Expect(result).To(HaveField("NetworkInterface", "lo"))
Expect(result.IPAMOptions).To(HaveKeyWithValue("driver", "host-local"))
Expect(result.Subnets).To(HaveLen(1))
diff --git a/test/e2e/pause_test.go b/test/e2e/pause_test.go
index 66638d71c..402719de2 100644
--- a/test/e2e/pause_test.go
+++ b/test/e2e/pause_test.go
@@ -45,7 +45,6 @@ var _ = Describe("Podman pause", func() {
podmanTest = PodmanTestCreate(tempdir)
podmanTest.Setup()
- podmanTest.SeedImages()
})
AfterEach(func() {
diff --git a/test/e2e/play_build_test.go b/test/e2e/play_build_test.go
index 96785c569..914144ae6 100644
--- a/test/e2e/play_build_test.go
+++ b/test/e2e/play_build_test.go
@@ -29,7 +29,6 @@ var _ = Describe("Podman play kube with build", func() {
}
podmanTest = PodmanTestCreate(tempdir)
podmanTest.Setup()
- podmanTest.SeedImages()
})
AfterEach(func() {
diff --git a/test/e2e/play_kube_test.go b/test/e2e/play_kube_test.go
index 4dd05c755..0e91db04c 100644
--- a/test/e2e/play_kube_test.go
+++ b/test/e2e/play_kube_test.go
@@ -1206,8 +1206,6 @@ var _ = Describe("Podman play kube", func() {
}
podmanTest = PodmanTestCreate(tempdir)
podmanTest.Setup()
- podmanTest.SeedImages()
-
kubeYaml = filepath.Join(podmanTest.TempDir, "kube.yaml")
})
@@ -2220,7 +2218,7 @@ spec:
Expect(ctr[0].Config.WorkingDir).To(ContainSubstring("/etc"))
Expect(ctr[0].Config.Labels).To(HaveKeyWithValue("key1", ContainSubstring("value1")))
Expect(ctr[0].Config.Labels).To(HaveKeyWithValue("key1", ContainSubstring("value1")))
- Expect(ctr[0].Config.StopSignal).To(Equal(uint(51)))
+ Expect(ctr[0].Config).To(HaveField("StopSignal", uint(51)))
})
// Deployment related tests
@@ -2528,7 +2526,7 @@ VOLUME %s`, ALPINE, hostPathDir+"/")
// only one will be mounted. Host path volumes take precedence.
ctrJSON := inspect.InspectContainerToJSON()
Expect(ctrJSON[0].Mounts).To(HaveLen(1))
- Expect(ctrJSON[0].Mounts[0].Type).To(Equal("bind"))
+ Expect(ctrJSON[0].Mounts[0]).To(HaveField("Type", "bind"))
})
@@ -2744,6 +2742,7 @@ MemoryReservation: {{ .HostConfig.MemoryReservation }}`})
})
It("podman play kube applies log driver to containers", func() {
+ SkipIfInContainer("journald inside a container doesn't work")
pod := getPod()
err := generateKubeYaml("pod", pod, kubeYaml)
Expect(err).To(BeNil())
@@ -2779,11 +2778,7 @@ MemoryReservation: {{ .HostConfig.MemoryReservation }}`})
})
It("podman play kube test with HostNetwork", func() {
- if !strings.Contains(podmanTest.OCIRuntime, "crun") {
- Skip("Test only works on crun")
- }
-
- pod := getPod(withHostNetwork())
+ pod := getPod(withHostNetwork(), withCtr(getCtr(withCmd([]string{"readlink", "/proc/self/ns/net"}), withArg(nil))))
err := generateKubeYaml("pod", pod, kubeYaml)
Expect(err).To(BeNil())
@@ -2795,6 +2790,17 @@ MemoryReservation: {{ .HostConfig.MemoryReservation }}`})
inspect.WaitWithDefaultTimeout()
Expect(inspect).Should(Exit(0))
Expect(inspect.OutputToString()).To(Equal("true"))
+
+ ns := SystemExec("readlink", []string{"/proc/self/ns/net"})
+ ns.WaitWithDefaultTimeout()
+ Expect(ns).Should(Exit(0))
+ netns := ns.OutputToString()
+ Expect(netns).ToNot(BeEmpty())
+
+ logs := podmanTest.Podman([]string{"logs", getCtrNameInPod(pod)})
+ logs.WaitWithDefaultTimeout()
+ Expect(logs).Should(Exit(0))
+ Expect(logs.OutputToString()).To(Equal(netns))
})
It("podman play kube persistentVolumeClaim", func() {
@@ -2995,7 +3001,7 @@ invalid kube kind
It("podman play kube with auto update annotations for all containers", func() {
ctr01Name := "ctr01"
- ctr02Name := "ctr02"
+ ctr02Name := "infra"
podName := "foo"
autoUpdateRegistry := "io.containers.autoupdate"
autoUpdateRegistryValue := "registry"
diff --git a/test/e2e/pod_create_test.go b/test/e2e/pod_create_test.go
index 8def80213..dedb1caeb 100644
--- a/test/e2e/pod_create_test.go
+++ b/test/e2e/pod_create_test.go
@@ -35,7 +35,6 @@ var _ = Describe("Podman pod create", func() {
}
podmanTest = PodmanTestCreate(tempdir)
podmanTest.Setup()
- podmanTest.SeedImages()
})
AfterEach(func() {
@@ -279,7 +278,7 @@ var _ = Describe("Podman pod create", func() {
ctrInspect.WaitWithDefaultTimeout()
Expect(ctrInspect).Should(Exit(0))
ctrJSON := ctrInspect.InspectContainerToJSON()
- Expect(ctrJSON[0].NetworkSettings.IPAddress).To(Equal(ip))
+ Expect(ctrJSON[0].NetworkSettings).To(HaveField("IPAddress", ip))
})
It("podman create pod with IP address and no infra should fail", func() {
@@ -336,7 +335,7 @@ var _ = Describe("Podman pod create", func() {
check := podmanTest.Podman([]string{"pod", "inspect", "abc"})
check.WaitWithDefaultTimeout()
data := check.InspectPodToJSON()
- Expect(data.ID).To(Equal(string(id)))
+ Expect(data).To(HaveField("ID", string(id)))
})
It("podman pod create --replace", func() {
@@ -551,8 +550,8 @@ ENTRYPOINT ["sleep","99999"]
podInspect.WaitWithDefaultTimeout()
Expect(podInspect).Should(Exit(0))
podJSON := podInspect.InspectPodToJSON()
- Expect(podJSON.CPUPeriod).To(Equal(period))
- Expect(podJSON.CPUQuota).To(Equal(quota))
+ Expect(podJSON).To(HaveField("CPUPeriod", period))
+ Expect(podJSON).To(HaveField("CPUQuota", quota))
})
It("podman pod create --cpuset-cpus", func() {
@@ -573,7 +572,7 @@ ENTRYPOINT ["sleep","99999"]
podInspect.WaitWithDefaultTimeout()
Expect(podInspect).Should(Exit(0))
podJSON := podInspect.InspectPodToJSON()
- Expect(podJSON.CPUSetCPUs).To(Equal(in))
+ Expect(podJSON).To(HaveField("CPUSetCPUs", in))
})
It("podman pod create --pid", func() {
@@ -587,7 +586,7 @@ ENTRYPOINT ["sleep","99999"]
podInspect.WaitWithDefaultTimeout()
Expect(podInspect).Should(Exit(0))
podJSON := podInspect.InspectPodToJSON()
- Expect(podJSON.InfraConfig.PidNS).To(Equal(ns))
+ Expect(podJSON.InfraConfig).To(HaveField("PidNS", ns))
podName = "pidPod2"
ns = "pod"
@@ -607,7 +606,7 @@ ENTRYPOINT ["sleep","99999"]
podInspect.WaitWithDefaultTimeout()
Expect(podInspect).Should(Exit(0))
podJSON = podInspect.InspectPodToJSON()
- Expect(podJSON.InfraConfig.PidNS).To(Equal("host"))
+ Expect(podJSON.InfraConfig).To(HaveField("PidNS", "host"))
podName = "pidPod4"
ns = "private"
@@ -620,7 +619,7 @@ ENTRYPOINT ["sleep","99999"]
podInspect.WaitWithDefaultTimeout()
Expect(podInspect).Should(Exit(0))
podJSON = podInspect.InspectPodToJSON()
- Expect(podJSON.InfraConfig.PidNS).To(Equal("private"))
+ Expect(podJSON.InfraConfig).To(HaveField("PidNS", "private"))
podName = "pidPod5"
ns = "container:randomfakeid"
@@ -856,7 +855,7 @@ ENTRYPOINT ["sleep","99999"]
podInspect.WaitWithDefaultTimeout()
Expect(podInspect).Should(Exit(0))
data := podInspect.InspectPodToJSON()
- Expect(data.Mounts[0].Name).To(Equal(volName))
+ Expect(data.Mounts[0]).To(HaveField("Name", volName))
ctrName := "testCtr"
ctrCreate := podmanTest.Podman([]string{"create", "--pod", podName, "--name", ctrName, ALPINE})
ctrCreate.WaitWithDefaultTimeout()
@@ -865,7 +864,7 @@ ENTRYPOINT ["sleep","99999"]
ctrInspect.WaitWithDefaultTimeout()
Expect(ctrInspect).Should(Exit(0))
ctrData := ctrInspect.InspectContainerToJSON()
- Expect(ctrData[0].Mounts[0].Name).To(Equal(volName))
+ Expect(ctrData[0].Mounts[0]).To(HaveField("Name", volName))
ctr2 := podmanTest.Podman([]string{"run", "--pod", podName, ALPINE, "sh", "-c", "echo hello >> " + "/tmp1/test"})
ctr2.WaitWithDefaultTimeout()
@@ -934,7 +933,7 @@ ENTRYPOINT ["sleep","99999"]
ctrInspect.WaitWithDefaultTimeout()
Expect(ctrInspect).Should(Exit(0))
data := ctrInspect.InspectContainerToJSON()
- Expect(data[0].Mounts[0].Name).To(Equal(volName))
+ Expect(data[0].Mounts[0]).To(HaveField("Name", volName))
podName := "testPod"
podCreate := podmanTest.Podman([]string{"pod", "create", "--volumes-from", ctrName, "--name", podName})
podCreate.WaitWithDefaultTimeout()
@@ -943,7 +942,7 @@ ENTRYPOINT ["sleep","99999"]
podInspect.WaitWithDefaultTimeout()
Expect(podInspect).Should(Exit(0))
podData := podInspect.InspectPodToJSON()
- Expect(podData.Mounts[0].Name).To(Equal(volName))
+ Expect(podData.Mounts[0]).To(HaveField("Name", volName))
ctr2 := podmanTest.Podman([]string{"run", "--pod", podName, ALPINE, "sh", "-c", "echo hello >> " + "/tmp1/test"})
ctr2.WaitWithDefaultTimeout()
@@ -986,7 +985,7 @@ ENTRYPOINT ["sleep","99999"]
Expect(ctrCreate).Should(Exit(0))
ctrInspect := podmanTest.InspectContainer(ctrCreate.OutputToString())
- Expect(ctrInspect[0].HostConfig.SecurityOpt).To(Equal([]string{"label=type:spc_t", "seccomp=unconfined"}))
+ Expect(ctrInspect[0].HostConfig).To(HaveField("SecurityOpt", []string{"label=type:spc_t", "seccomp=unconfined"}))
podCreate = podmanTest.Podman([]string{"pod", "create", "--security-opt", "label=disable"})
podCreate.WaitWithDefaultTimeout()
@@ -1012,7 +1011,7 @@ ENTRYPOINT ["sleep","99999"]
Expect(ctrCreate).Should(Exit(0))
ctrInspect := podmanTest.InspectContainer(ctrCreate.OutputToString())
- Expect(ctrInspect[0].HostConfig.SecurityOpt).To(Equal([]string{"seccomp=unconfined"}))
+ Expect(ctrInspect[0].HostConfig).To(HaveField("SecurityOpt", []string{"seccomp=unconfined"}))
})
It("podman pod create --security-opt apparmor test", func() {
@@ -1028,7 +1027,7 @@ ENTRYPOINT ["sleep","99999"]
Expect(ctrCreate).Should(Exit(0))
inspect := podmanTest.InspectContainer(ctrCreate.OutputToString())
- Expect(inspect[0].AppArmorProfile).To(Equal(apparmor.Profile))
+ Expect(inspect[0]).To(HaveField("AppArmorProfile", apparmor.Profile))
})
@@ -1090,7 +1089,7 @@ ENTRYPOINT ["sleep","99999"]
if podmanTest.CgroupManager == "cgroupfs" || !rootless.IsRootless() {
Expect(inspect[0].HostConfig.CgroupParent).To(HaveLen(0))
} else if podmanTest.CgroupManager == "systemd" {
- Expect(inspect[0].HostConfig.CgroupParent).To(Equal("user.slice"))
+ Expect(inspect[0].HostConfig).To(HaveField("CgroupParent", "user.slice"))
}
podCreate2 := podmanTest.Podman([]string{"pod", "create", "--share", "cgroup,ipc,net,uts", "--share-parent=false", "--infra-name", "cgroupCtr"})
diff --git a/test/e2e/pod_infra_container_test.go b/test/e2e/pod_infra_container_test.go
index 2b56502b0..ab204992c 100644
--- a/test/e2e/pod_infra_container_test.go
+++ b/test/e2e/pod_infra_container_test.go
@@ -24,7 +24,6 @@ var _ = Describe("Podman pod create", func() {
}
podmanTest = PodmanTestCreate(tempdir)
podmanTest.Setup()
- podmanTest.SeedImages()
})
AfterEach(func() {
diff --git a/test/e2e/pod_initcontainers_test.go b/test/e2e/pod_initcontainers_test.go
index a99e24908..ec429f568 100644
--- a/test/e2e/pod_initcontainers_test.go
+++ b/test/e2e/pod_initcontainers_test.go
@@ -26,7 +26,6 @@ var _ = Describe("Podman init containers", func() {
}
podmanTest = PodmanTestCreate(tempdir)
podmanTest.Setup()
- podmanTest.SeedImages()
})
AfterEach(func() {
@@ -66,7 +65,7 @@ var _ = Describe("Podman init containers", func() {
inspect.WaitWithDefaultTimeout()
Expect(inspect).Should(Exit(0))
data := inspect.InspectPodToJSON()
- Expect(data.State).To(Equal(define.PodStateRunning))
+ Expect(data).To(HaveField("State", define.PodStateRunning))
})
It("podman create init container should fail in running pod", func() {
@@ -114,7 +113,7 @@ var _ = Describe("Podman init containers", func() {
check := podmanTest.Podman([]string{"container", "exists", initContainerID})
check.WaitWithDefaultTimeout()
// Container was rm'd
- //Expect(check).Should(Exit(1))
+ // Expect(check).Should(Exit(1))
Expect(check.ExitCode()).To(Equal(1), "I dont understand why the other way does not work")
// Lets double check with a stop and start
stopPod := podmanTest.Podman([]string{"pod", "stop", "foobar"})
diff --git a/test/e2e/pod_inspect_test.go b/test/e2e/pod_inspect_test.go
index 19a2772fd..351317cc5 100644
--- a/test/e2e/pod_inspect_test.go
+++ b/test/e2e/pod_inspect_test.go
@@ -25,7 +25,6 @@ var _ = Describe("Podman pod inspect", func() {
}
podmanTest = PodmanTestCreate(tempdir)
podmanTest.Setup()
- podmanTest.SeedImages()
})
AfterEach(func() {
@@ -58,7 +57,7 @@ var _ = Describe("Podman pod inspect", func() {
Expect(inspect).Should(Exit(0))
Expect(inspect.OutputToString()).To(BeValidJSON())
podData := inspect.InspectPodToJSON()
- Expect(podData.ID).To(Equal(podid))
+ Expect(podData).To(HaveField("ID", podid))
})
It("podman pod inspect (CreateCommand)", func() {
@@ -98,7 +97,7 @@ var _ = Describe("Podman pod inspect", func() {
Expect(err).To(BeNil())
Expect(inspectJSON.InfraConfig).To(Not(BeNil()))
Expect(inspectJSON.InfraConfig.PortBindings["80/tcp"]).To(HaveLen(1))
- Expect(inspectJSON.InfraConfig.PortBindings["80/tcp"][0].HostPort).To(Equal("8383"))
+ Expect(inspectJSON.InfraConfig.PortBindings["80/tcp"][0]).To(HaveField("HostPort", "8383"))
})
It("podman pod inspect outputs show correct MAC", func() {
diff --git a/test/e2e/pod_kill_test.go b/test/e2e/pod_kill_test.go
index 18f9769a1..0612200d4 100644
--- a/test/e2e/pod_kill_test.go
+++ b/test/e2e/pod_kill_test.go
@@ -24,7 +24,6 @@ var _ = Describe("Podman pod kill", func() {
}
podmanTest = PodmanTestCreate(tempdir)
podmanTest.Setup()
- podmanTest.SeedImages()
})
AfterEach(func() {
diff --git a/test/e2e/pod_pause_test.go b/test/e2e/pod_pause_test.go
index 57ae75926..d78890347 100644
--- a/test/e2e/pod_pause_test.go
+++ b/test/e2e/pod_pause_test.go
@@ -26,7 +26,6 @@ var _ = Describe("Podman pod pause", func() {
}
podmanTest = PodmanTestCreate(tempdir)
podmanTest.Setup()
- podmanTest.SeedImages()
})
AfterEach(func() {
diff --git a/test/e2e/pod_pod_namespaces_test.go b/test/e2e/pod_pod_namespaces_test.go
index 667a54861..5b288898f 100644
--- a/test/e2e/pod_pod_namespaces_test.go
+++ b/test/e2e/pod_pod_namespaces_test.go
@@ -24,7 +24,6 @@ var _ = Describe("Podman pod create", func() {
}
podmanTest = PodmanTestCreate(tempdir)
podmanTest.Setup()
- podmanTest.SeedImages()
})
AfterEach(func() {
diff --git a/test/e2e/pod_prune_test.go b/test/e2e/pod_prune_test.go
index 55ecc1593..dce3e34e4 100644
--- a/test/e2e/pod_prune_test.go
+++ b/test/e2e/pod_prune_test.go
@@ -23,7 +23,6 @@ var _ = Describe("Podman pod prune", func() {
}
podmanTest = PodmanTestCreate(tempdir)
podmanTest.Setup()
- podmanTest.SeedImages()
})
AfterEach(func() {
diff --git a/test/e2e/pod_ps_test.go b/test/e2e/pod_ps_test.go
index a0a1e1438..97ca5ff94 100644
--- a/test/e2e/pod_ps_test.go
+++ b/test/e2e/pod_ps_test.go
@@ -26,7 +26,6 @@ var _ = Describe("Podman ps", func() {
}
podmanTest = PodmanTestCreate(tempdir)
podmanTest.Setup()
- podmanTest.SeedImages()
})
AfterEach(func() {
diff --git a/test/e2e/pod_restart_test.go b/test/e2e/pod_restart_test.go
index 1897104cc..fab448f92 100644
--- a/test/e2e/pod_restart_test.go
+++ b/test/e2e/pod_restart_test.go
@@ -23,7 +23,6 @@ var _ = Describe("Podman pod restart", func() {
}
podmanTest = PodmanTestCreate(tempdir)
podmanTest.Setup()
- podmanTest.SeedImages()
})
AfterEach(func() {
diff --git a/test/e2e/pod_rm_test.go b/test/e2e/pod_rm_test.go
index dbb2d6d13..a5eab7eed 100644
--- a/test/e2e/pod_rm_test.go
+++ b/test/e2e/pod_rm_test.go
@@ -28,7 +28,6 @@ var _ = Describe("Podman pod rm", func() {
}
podmanTest = PodmanTestCreate(tempdir)
podmanTest.Setup()
- podmanTest.SeedImages()
})
AfterEach(func() {
diff --git a/test/e2e/pod_start_test.go b/test/e2e/pod_start_test.go
index 2f3ef3a11..084a48636 100644
--- a/test/e2e/pod_start_test.go
+++ b/test/e2e/pod_start_test.go
@@ -27,7 +27,6 @@ var _ = Describe("Podman pod start", func() {
}
podmanTest = PodmanTestCreate(tempdir)
podmanTest.Setup()
- podmanTest.SeedImages()
})
AfterEach(func() {
diff --git a/test/e2e/pod_stats_test.go b/test/e2e/pod_stats_test.go
index 0e94406f8..8f76e6e5a 100644
--- a/test/e2e/pod_stats_test.go
+++ b/test/e2e/pod_stats_test.go
@@ -28,7 +28,6 @@ var _ = Describe("Podman pod stats", func() {
}
podmanTest = PodmanTestCreate(tempdir)
podmanTest.Setup()
- podmanTest.SeedImages()
})
AfterEach(func() {
diff --git a/test/e2e/pod_stop_test.go b/test/e2e/pod_stop_test.go
index fc78f9ed6..2fe0aa486 100644
--- a/test/e2e/pod_stop_test.go
+++ b/test/e2e/pod_stop_test.go
@@ -24,7 +24,6 @@ var _ = Describe("Podman pod stop", func() {
}
podmanTest = PodmanTestCreate(tempdir)
podmanTest.Setup()
- podmanTest.SeedImages()
})
AfterEach(func() {
diff --git a/test/e2e/pod_top_test.go b/test/e2e/pod_top_test.go
index 564170412..07028da45 100644
--- a/test/e2e/pod_top_test.go
+++ b/test/e2e/pod_top_test.go
@@ -25,7 +25,6 @@ var _ = Describe("Podman top", func() {
}
podmanTest = PodmanTestCreate(tempdir)
podmanTest.Setup()
- podmanTest.SeedImages()
})
AfterEach(func() {
diff --git a/test/e2e/port_test.go b/test/e2e/port_test.go
index d81c03e5b..03263a198 100644
--- a/test/e2e/port_test.go
+++ b/test/e2e/port_test.go
@@ -25,7 +25,6 @@ var _ = Describe("Podman port", func() {
}
podmanTest = PodmanTestCreate(tempdir)
podmanTest.Setup()
- podmanTest.SeedImages()
})
AfterEach(func() {
diff --git a/test/e2e/prune_test.go b/test/e2e/prune_test.go
index 01f987b92..75adf1724 100644
--- a/test/e2e/prune_test.go
+++ b/test/e2e/prune_test.go
@@ -35,7 +35,6 @@ var _ = Describe("Podman prune", func() {
}
podmanTest = PodmanTestCreate(tempdir)
podmanTest.Setup()
- podmanTest.SeedImages()
})
AfterEach(func() {
diff --git a/test/e2e/ps_test.go b/test/e2e/ps_test.go
index 021ebc30b..1100a5d90 100644
--- a/test/e2e/ps_test.go
+++ b/test/e2e/ps_test.go
@@ -29,7 +29,6 @@ var _ = Describe("Podman ps", func() {
}
podmanTest = PodmanTestCreate(tempdir)
podmanTest.Setup()
- podmanTest.SeedImages()
})
AfterEach(func() {
diff --git a/test/e2e/pull_test.go b/test/e2e/pull_test.go
index 231869e8c..41eb8b449 100644
--- a/test/e2e/pull_test.go
+++ b/test/e2e/pull_test.go
@@ -345,7 +345,8 @@ var _ = Describe("Podman pull", func() {
podmanTest.AddImageToRWStore(cirros)
dirpath := filepath.Join(podmanTest.TempDir, "cirros")
- os.MkdirAll(dirpath, os.ModePerm)
+ err = os.MkdirAll(dirpath, os.ModePerm)
+ Expect(err).ToNot(HaveOccurred())
imgPath := fmt.Sprintf("dir:%s", dirpath)
session := podmanTest.Podman([]string{"push", "cirros", imgPath})
@@ -368,7 +369,8 @@ var _ = Describe("Podman pull", func() {
podmanTest.AddImageToRWStore(cirros)
dirpath := filepath.Join(podmanTest.TempDir, "cirros")
- os.MkdirAll(dirpath, os.ModePerm)
+ err = os.MkdirAll(dirpath, os.ModePerm)
+ Expect(err).ToNot(HaveOccurred())
imgPath := fmt.Sprintf("oci:%s", dirpath)
session := podmanTest.Podman([]string{"push", "cirros", imgPath})
@@ -387,7 +389,8 @@ var _ = Describe("Podman pull", func() {
})
It("podman pull check quiet", func() {
- podmanTest.RestoreArtifact(ALPINE)
+ err := podmanTest.RestoreArtifact(ALPINE)
+ Expect(err).ToNot(HaveOccurred())
setup := podmanTest.Podman([]string{"images", ALPINE, "-q", "--no-trunc"})
setup.WaitWithDefaultTimeout()
Expect(setup).Should(Exit(0))
@@ -428,8 +431,10 @@ var _ = Describe("Podman pull", func() {
// We already tested pulling, so we can save some energy and
// just restore local artifacts and tag them.
- podmanTest.RestoreArtifact(ALPINE)
- podmanTest.RestoreArtifact(BB)
+ err := podmanTest.RestoreArtifact(ALPINE)
+ Expect(err).ToNot(HaveOccurred())
+ err = podmanTest.RestoreArtifact(BB)
+ Expect(err).ToNot(HaveOccurred())
// What we want is at least two images which have the same name
// and are prefixed with two different unqualified-search
@@ -514,7 +519,7 @@ var _ = Describe("Podman pull", func() {
Expect(data).To(HaveLen(1))
Expect(data[0].RepoTags).To(HaveLen(1))
Expect(data[0].RepoTags[0]).To(Equal(t.tag1))
- Expect(data[0].ID).To(Equal(image1))
+ Expect(data[0]).To(HaveField("ID", image1))
}
})
@@ -541,8 +546,8 @@ var _ = Describe("Podman pull", func() {
data := setup.InspectImageJSON() // returns []inspect.ImageData
Expect(data).To(HaveLen(1))
- Expect(data[0].Os).To(Equal(runtime.GOOS))
- Expect(data[0].Architecture).To(Equal("arm64"))
+ Expect(data[0]).To(HaveField("Os", runtime.GOOS))
+ Expect(data[0]).To(HaveField("Architecture", "arm64"))
})
It("podman pull --arch", func() {
@@ -568,7 +573,7 @@ var _ = Describe("Podman pull", func() {
data := setup.InspectImageJSON() // returns []inspect.ImageData
Expect(data).To(HaveLen(1))
- Expect(data[0].Os).To(Equal(runtime.GOOS))
- Expect(data[0].Architecture).To(Equal("arm64"))
+ Expect(data[0]).To(HaveField("Os", runtime.GOOS))
+ Expect(data[0]).To(HaveField("Architecture", "arm64"))
})
})
diff --git a/test/e2e/push_test.go b/test/e2e/push_test.go
index 3b571ab20..0288bf915 100644
--- a/test/e2e/push_test.go
+++ b/test/e2e/push_test.go
@@ -101,7 +101,8 @@ var _ = Describe("Podman push", func() {
Skip("No registry image for ppc64le")
}
if rootless.IsRootless() {
- podmanTest.RestoreArtifact(registry)
+ err := podmanTest.RestoreArtifact(registry)
+ Expect(err).ToNot(HaveOccurred())
}
lock := GetPortLock("5000")
defer lock.Unlock()
@@ -132,8 +133,10 @@ var _ = Describe("Podman push", func() {
Skip("No registry image for ppc64le")
}
authPath := filepath.Join(podmanTest.TempDir, "auth")
- os.Mkdir(authPath, os.ModePerm)
- os.MkdirAll("/etc/containers/certs.d/localhost:5000", os.ModePerm)
+ err = os.Mkdir(authPath, os.ModePerm)
+ Expect(err).ToNot(HaveOccurred())
+ err = os.MkdirAll("/etc/containers/certs.d/localhost:5000", os.ModePerm)
+ Expect(err).ToNot(HaveOccurred())
defer os.RemoveAll("/etc/containers/certs.d/localhost:5000")
cwd, _ := os.Getwd()
@@ -157,11 +160,14 @@ var _ = Describe("Podman push", func() {
session.WaitWithDefaultTimeout()
Expect(session).Should(Exit(0))
- f, _ := os.Create(filepath.Join(authPath, "htpasswd"))
+ f, err := os.Create(filepath.Join(authPath, "htpasswd"))
+ Expect(err).ToNot(HaveOccurred())
defer f.Close()
- f.WriteString(session.OutputToString())
- f.Sync()
+ _, err = f.WriteString(session.OutputToString())
+ Expect(err).ToNot(HaveOccurred())
+ err = f.Sync()
+ Expect(err).ToNot(HaveOccurred())
session = podmanTest.Podman([]string{"run", "-d", "-p", "5000:5000", "--name", "registry", "-v",
strings.Join([]string{authPath, "/auth"}, ":"), "-e", "REGISTRY_AUTH=htpasswd", "-e",
diff --git a/test/e2e/rename_test.go b/test/e2e/rename_test.go
index ef90c3f22..341490d9c 100644
--- a/test/e2e/rename_test.go
+++ b/test/e2e/rename_test.go
@@ -24,7 +24,6 @@ var _ = Describe("podman rename", func() {
}
podmanTest = PodmanTestCreate(tempdir)
podmanTest.Setup()
- podmanTest.SeedImages()
})
AfterEach(func() {
diff --git a/test/e2e/restart_test.go b/test/e2e/restart_test.go
index b8c74d395..b3052623b 100644
--- a/test/e2e/restart_test.go
+++ b/test/e2e/restart_test.go
@@ -24,7 +24,6 @@ var _ = Describe("Podman restart", func() {
}
podmanTest = PodmanTestCreate(tempdir)
podmanTest.Setup()
- podmanTest.SeedImages()
})
AfterEach(func() {
diff --git a/test/e2e/rm_test.go b/test/e2e/rm_test.go
index f836540b4..7dbe5fed8 100644
--- a/test/e2e/rm_test.go
+++ b/test/e2e/rm_test.go
@@ -24,7 +24,6 @@ var _ = Describe("Podman rm", func() {
}
podmanTest = PodmanTestCreate(tempdir)
podmanTest.Setup()
- podmanTest.SeedImages()
})
AfterEach(func() {
diff --git a/test/e2e/run_aardvark_test.go b/test/e2e/run_aardvark_test.go
index 7b4598423..25eb8b538 100644
--- a/test/e2e/run_aardvark_test.go
+++ b/test/e2e/run_aardvark_test.go
@@ -25,7 +25,6 @@ var _ = Describe("Podman run networking", func() {
}
podmanTest = PodmanTestCreate(tempdir)
podmanTest.Setup()
- podmanTest.SeedImages()
SkipIfCNI(podmanTest)
})
diff --git a/test/e2e/run_apparmor_test.go b/test/e2e/run_apparmor_test.go
index 64a01deb7..18d011e6d 100644
--- a/test/e2e/run_apparmor_test.go
+++ b/test/e2e/run_apparmor_test.go
@@ -42,7 +42,6 @@ var _ = Describe("Podman run", func() {
}
podmanTest = PodmanTestCreate(tempdir)
podmanTest.Setup()
- podmanTest.SeedImages()
})
AfterEach(func() {
@@ -61,7 +60,7 @@ var _ = Describe("Podman run", func() {
cid := session.OutputToString()
// Verify that apparmor.Profile is being set
inspect := podmanTest.InspectContainer(cid)
- Expect(inspect[0].AppArmorProfile).To(Equal(apparmor.Profile))
+ Expect(inspect[0]).To(HaveField("AppArmorProfile", apparmor.Profile))
})
It("podman run no apparmor --privileged", func() {
@@ -73,7 +72,7 @@ var _ = Describe("Podman run", func() {
cid := session.OutputToString()
// Verify that apparmor.Profile is being set
inspect := podmanTest.InspectContainer(cid)
- Expect(inspect[0].AppArmorProfile).To(Equal(""))
+ Expect(inspect[0]).To(HaveField("AppArmorProfile", ""))
})
It("podman run no apparmor --security-opt=apparmor.Profile --privileged", func() {
@@ -85,7 +84,7 @@ var _ = Describe("Podman run", func() {
cid := session.OutputToString()
// Verify that apparmor.Profile is being set
inspect := podmanTest.InspectContainer(cid)
- Expect(inspect[0].AppArmorProfile).To(Equal(apparmor.Profile))
+ Expect(inspect[0]).To(HaveField("AppArmorProfile", apparmor.Profile))
})
It("podman run apparmor aa-test-profile", func() {
@@ -116,7 +115,7 @@ profile aa-test-profile flags=(attach_disconnected,mediate_deleted) {
cid := session.OutputToString()
// Verify that apparmor.Profile is being set
inspect := podmanTest.InspectContainer(cid)
- Expect(inspect[0].AppArmorProfile).To(Equal("aa-test-profile"))
+ Expect(inspect[0]).To(HaveField("AppArmorProfile", "aa-test-profile"))
})
It("podman run apparmor invalid", func() {
@@ -135,7 +134,7 @@ profile aa-test-profile flags=(attach_disconnected,mediate_deleted) {
cid := session.OutputToString()
// Verify that apparmor.Profile is being set
inspect := podmanTest.InspectContainer(cid)
- Expect(inspect[0].AppArmorProfile).To(Equal("unconfined"))
+ Expect(inspect[0]).To(HaveField("AppArmorProfile", "unconfined"))
})
It("podman run apparmor disabled --security-opt apparmor fails", func() {
@@ -156,7 +155,7 @@ profile aa-test-profile flags=(attach_disconnected,mediate_deleted) {
cid := session.OutputToString()
// Verify that apparmor.Profile is being set
inspect := podmanTest.InspectContainer(cid)
- Expect(inspect[0].AppArmorProfile).To(Equal(""))
+ Expect(inspect[0]).To(HaveField("AppArmorProfile", ""))
})
It("podman run apparmor disabled unconfined", func() {
@@ -169,6 +168,6 @@ profile aa-test-profile flags=(attach_disconnected,mediate_deleted) {
cid := session.OutputToString()
// Verify that apparmor.Profile is being set
inspect := podmanTest.InspectContainer(cid)
- Expect(inspect[0].AppArmorProfile).To(Equal(""))
+ Expect(inspect[0]).To(HaveField("AppArmorProfile", ""))
})
})
diff --git a/test/e2e/run_cgroup_parent_test.go b/test/e2e/run_cgroup_parent_test.go
index 0aba367f3..24cae43b1 100644
--- a/test/e2e/run_cgroup_parent_test.go
+++ b/test/e2e/run_cgroup_parent_test.go
@@ -30,7 +30,6 @@ var _ = Describe("Podman run with --cgroup-parent", func() {
}
podmanTest = PodmanTestCreate(tempdir)
podmanTest.Setup()
- podmanTest.SeedImages()
})
AfterEach(func() {
@@ -84,12 +83,12 @@ var _ = Describe("Podman run with --cgroup-parent", func() {
exec.WaitWithDefaultTimeout()
Expect(exec).Should(Exit(0))
- containerCgroup := strings.TrimRight(strings.Replace(exec.OutputToString(), "0::", "", -1), "\n")
+ containerCgroup := strings.TrimRight(strings.ReplaceAll(exec.OutputToString(), "0::", ""), "\n")
// Move the container process to a sub cgroup
content, err := ioutil.ReadFile(filepath.Join(cgroupRoot, containerCgroup, "cgroup.procs"))
Expect(err).To(BeNil())
- oldSubCgroupPath := filepath.Join(filepath.Join(cgroupRoot, containerCgroup, "old-container"))
+ oldSubCgroupPath := filepath.Join(cgroupRoot, containerCgroup, "old-container")
err = os.MkdirAll(oldSubCgroupPath, 0755)
Expect(err).To(BeNil())
err = ioutil.WriteFile(filepath.Join(oldSubCgroupPath, "cgroup.procs"), content, 0644)
@@ -102,7 +101,7 @@ var _ = Describe("Podman run with --cgroup-parent", func() {
run = podmanTest.Podman([]string{"--cgroup-manager=cgroupfs", "run", "--rm", "--cgroupns=host", fmt.Sprintf("--cgroup-parent=%s", newCgroup), fedoraMinimal, "cat", "/proc/self/cgroup"})
run.WaitWithDefaultTimeout()
Expect(run).Should(Exit(0))
- cgroupEffective := strings.TrimRight(strings.Replace(run.OutputToString(), "0::", "", -1), "\n")
+ cgroupEffective := strings.TrimRight(strings.ReplaceAll(run.OutputToString(), "0::", ""), "\n")
Expect(newCgroup).To(Equal(filepath.Dir(cgroupEffective)))
})
diff --git a/test/e2e/run_cleanup_test.go b/test/e2e/run_cleanup_test.go
index 2282ef913..ea2caf907 100644
--- a/test/e2e/run_cleanup_test.go
+++ b/test/e2e/run_cleanup_test.go
@@ -23,7 +23,8 @@ var _ = Describe("Podman run exit", func() {
}
podmanTest = PodmanTestCreate(tempdir)
podmanTest.Setup()
- podmanTest.RestoreArtifact(ALPINE)
+ err = podmanTest.RestoreArtifact(ALPINE)
+ Expect(err).ToNot(HaveOccurred())
})
AfterEach(func() {
diff --git a/test/e2e/run_cpu_test.go b/test/e2e/run_cpu_test.go
index fda0a7c24..b21be5729 100644
--- a/test/e2e/run_cpu_test.go
+++ b/test/e2e/run_cpu_test.go
@@ -33,7 +33,6 @@ var _ = Describe("Podman run cpu", func() {
podmanTest = PodmanTestCreate(tempdir)
podmanTest.Setup()
- podmanTest.SeedImages()
})
AfterEach(func() {
diff --git a/test/e2e/run_device_test.go b/test/e2e/run_device_test.go
index 479837dda..c46afdaca 100644
--- a/test/e2e/run_device_test.go
+++ b/test/e2e/run_device_test.go
@@ -24,7 +24,6 @@ var _ = Describe("Podman run device", func() {
}
podmanTest = PodmanTestCreate(tempdir)
podmanTest.Setup()
- podmanTest.SeedImages()
})
AfterEach(func() {
diff --git a/test/e2e/run_dns_test.go b/test/e2e/run_dns_test.go
index 7561a2e85..61177b4c7 100644
--- a/test/e2e/run_dns_test.go
+++ b/test/e2e/run_dns_test.go
@@ -23,7 +23,6 @@ var _ = Describe("Podman run dns", func() {
}
podmanTest = PodmanTestCreate(tempdir)
podmanTest.Setup()
- podmanTest.SeedImages()
})
AfterEach(func() {
diff --git a/test/e2e/run_entrypoint_test.go b/test/e2e/run_entrypoint_test.go
index fde43dfec..9f35b9e7e 100644
--- a/test/e2e/run_entrypoint_test.go
+++ b/test/e2e/run_entrypoint_test.go
@@ -23,7 +23,6 @@ var _ = Describe("Podman run entrypoint", func() {
}
podmanTest = PodmanTestCreate(tempdir)
podmanTest.Setup()
- podmanTest.SeedImages()
})
AfterEach(func() {
diff --git a/test/e2e/run_env_test.go b/test/e2e/run_env_test.go
index f4c44c23b..bab52efc5 100644
--- a/test/e2e/run_env_test.go
+++ b/test/e2e/run_env_test.go
@@ -23,7 +23,6 @@ var _ = Describe("Podman run", func() {
}
podmanTest = PodmanTestCreate(tempdir)
podmanTest.Setup()
- podmanTest.SeedImages()
})
AfterEach(func() {
diff --git a/test/e2e/run_exit_test.go b/test/e2e/run_exit_test.go
index aa9a4295c..0663e4d9a 100644
--- a/test/e2e/run_exit_test.go
+++ b/test/e2e/run_exit_test.go
@@ -25,7 +25,6 @@ var _ = Describe("Podman run exit", func() {
}
podmanTest = PodmanTestCreate(tempdir)
podmanTest.Setup()
- podmanTest.SeedImages()
})
AfterEach(func() {
diff --git a/test/e2e/run_memory_test.go b/test/e2e/run_memory_test.go
index d6a67da57..083020f08 100644
--- a/test/e2e/run_memory_test.go
+++ b/test/e2e/run_memory_test.go
@@ -26,7 +26,6 @@ var _ = Describe("Podman run memory", func() {
}
podmanTest = PodmanTestCreate(tempdir)
podmanTest.Setup()
- podmanTest.SeedImages()
})
AfterEach(func() {
diff --git a/test/e2e/run_networking_test.go b/test/e2e/run_networking_test.go
index 49c387227..c9990b70f 100644
--- a/test/e2e/run_networking_test.go
+++ b/test/e2e/run_networking_test.go
@@ -32,7 +32,6 @@ var _ = Describe("Podman run networking", func() {
}
podmanTest = PodmanTestCreate(tempdir)
podmanTest.Setup()
- podmanTest.SeedImages()
})
AfterEach(func() {
@@ -99,7 +98,7 @@ var _ = Describe("Podman run networking", func() {
Expect(inspectOut[0].NetworkSettings.Ports).To(HaveLen(1))
Expect(inspectOut[0].NetworkSettings.Ports["80/tcp"]).To(HaveLen(1))
Expect(inspectOut[0].NetworkSettings.Ports["80/tcp"][0].HostPort).To(Not(Equal("80")))
- Expect(inspectOut[0].NetworkSettings.Ports["80/tcp"][0].HostIP).To(Equal(""))
+ Expect(inspectOut[0].NetworkSettings.Ports["80/tcp"][0]).To(HaveField("HostIP", ""))
})
It("podman run -p 80-82 -p 8090:8090", func() {
@@ -111,16 +110,16 @@ var _ = Describe("Podman run networking", func() {
Expect(inspectOut[0].NetworkSettings.Ports).To(HaveLen(4))
Expect(inspectOut[0].NetworkSettings.Ports["80/tcp"]).To(HaveLen(1))
Expect(inspectOut[0].NetworkSettings.Ports["80/tcp"][0].HostPort).To(Not(Equal("80")))
- Expect(inspectOut[0].NetworkSettings.Ports["80/tcp"][0].HostIP).To(Equal(""))
+ Expect(inspectOut[0].NetworkSettings.Ports["80/tcp"][0]).To(HaveField("HostIP", ""))
Expect(inspectOut[0].NetworkSettings.Ports["81/tcp"]).To(HaveLen(1))
Expect(inspectOut[0].NetworkSettings.Ports["81/tcp"][0].HostPort).To(Not(Equal("81")))
- Expect(inspectOut[0].NetworkSettings.Ports["81/tcp"][0].HostIP).To(Equal(""))
+ Expect(inspectOut[0].NetworkSettings.Ports["81/tcp"][0]).To(HaveField("HostIP", ""))
Expect(inspectOut[0].NetworkSettings.Ports["82/tcp"]).To(HaveLen(1))
Expect(inspectOut[0].NetworkSettings.Ports["82/tcp"][0].HostPort).To(Not(Equal("82")))
- Expect(inspectOut[0].NetworkSettings.Ports["82/tcp"][0].HostIP).To(Equal(""))
+ Expect(inspectOut[0].NetworkSettings.Ports["82/tcp"][0]).To(HaveField("HostIP", ""))
Expect(inspectOut[0].NetworkSettings.Ports["8090/tcp"]).To(HaveLen(1))
- Expect(inspectOut[0].NetworkSettings.Ports["8090/tcp"][0].HostPort).To(Equal("8090"))
- Expect(inspectOut[0].NetworkSettings.Ports["8090/tcp"][0].HostIP).To(Equal(""))
+ Expect(inspectOut[0].NetworkSettings.Ports["8090/tcp"][0]).To(HaveField("HostPort", "8090"))
+ Expect(inspectOut[0].NetworkSettings.Ports["8090/tcp"][0]).To(HaveField("HostIP", ""))
})
It("podman run -p 80-81 -p 8180-8181", func() {
@@ -132,16 +131,16 @@ var _ = Describe("Podman run networking", func() {
Expect(inspectOut[0].NetworkSettings.Ports).To(HaveLen(4))
Expect(inspectOut[0].NetworkSettings.Ports["80/tcp"]).To(HaveLen(1))
Expect(inspectOut[0].NetworkSettings.Ports["80/tcp"][0].HostPort).To(Not(Equal("80")))
- Expect(inspectOut[0].NetworkSettings.Ports["80/tcp"][0].HostIP).To(Equal(""))
+ Expect(inspectOut[0].NetworkSettings.Ports["80/tcp"][0]).To(HaveField("HostIP", ""))
Expect(inspectOut[0].NetworkSettings.Ports["81/tcp"]).To(HaveLen(1))
Expect(inspectOut[0].NetworkSettings.Ports["81/tcp"][0].HostPort).To(Not(Equal("81")))
- Expect(inspectOut[0].NetworkSettings.Ports["81/tcp"][0].HostIP).To(Equal(""))
+ Expect(inspectOut[0].NetworkSettings.Ports["81/tcp"][0]).To(HaveField("HostIP", ""))
Expect(inspectOut[0].NetworkSettings.Ports["8180/tcp"]).To(HaveLen(1))
Expect(inspectOut[0].NetworkSettings.Ports["8180/tcp"][0].HostPort).To(Not(Equal("8180")))
- Expect(inspectOut[0].NetworkSettings.Ports["8180/tcp"][0].HostIP).To(Equal(""))
+ Expect(inspectOut[0].NetworkSettings.Ports["8180/tcp"][0]).To(HaveField("HostIP", ""))
Expect(inspectOut[0].NetworkSettings.Ports["8181/tcp"]).To(HaveLen(1))
Expect(inspectOut[0].NetworkSettings.Ports["8181/tcp"][0].HostPort).To(Not(Equal("8181")))
- Expect(inspectOut[0].NetworkSettings.Ports["8181/tcp"][0].HostIP).To(Equal(""))
+ Expect(inspectOut[0].NetworkSettings.Ports["8181/tcp"][0]).To(HaveField("HostIP", ""))
})
It("podman run -p 80 -p 8280-8282:8280-8282", func() {
@@ -153,16 +152,16 @@ var _ = Describe("Podman run networking", func() {
Expect(inspectOut[0].NetworkSettings.Ports).To(HaveLen(4))
Expect(inspectOut[0].NetworkSettings.Ports["80/tcp"]).To(HaveLen(1))
Expect(inspectOut[0].NetworkSettings.Ports["80/tcp"][0].HostPort).To(Not(Equal("80")))
- Expect(inspectOut[0].NetworkSettings.Ports["80/tcp"][0].HostIP).To(Equal(""))
+ Expect(inspectOut[0].NetworkSettings.Ports["80/tcp"][0]).To(HaveField("HostIP", ""))
Expect(inspectOut[0].NetworkSettings.Ports["8280/tcp"]).To(HaveLen(1))
- Expect(inspectOut[0].NetworkSettings.Ports["8280/tcp"][0].HostPort).To(Equal("8280"))
- Expect(inspectOut[0].NetworkSettings.Ports["8280/tcp"][0].HostIP).To(Equal(""))
+ Expect(inspectOut[0].NetworkSettings.Ports["8280/tcp"][0]).To(HaveField("HostPort", "8280"))
+ Expect(inspectOut[0].NetworkSettings.Ports["8280/tcp"][0]).To(HaveField("HostIP", ""))
Expect(inspectOut[0].NetworkSettings.Ports["8281/tcp"]).To(HaveLen(1))
- Expect(inspectOut[0].NetworkSettings.Ports["8281/tcp"][0].HostPort).To(Equal("8281"))
- Expect(inspectOut[0].NetworkSettings.Ports["8281/tcp"][0].HostIP).To(Equal(""))
+ Expect(inspectOut[0].NetworkSettings.Ports["8281/tcp"][0]).To(HaveField("HostPort", "8281"))
+ Expect(inspectOut[0].NetworkSettings.Ports["8281/tcp"][0]).To(HaveField("HostIP", ""))
Expect(inspectOut[0].NetworkSettings.Ports["8282/tcp"]).To(HaveLen(1))
- Expect(inspectOut[0].NetworkSettings.Ports["8282/tcp"][0].HostPort).To(Equal("8282"))
- Expect(inspectOut[0].NetworkSettings.Ports["8282/tcp"][0].HostIP).To(Equal(""))
+ Expect(inspectOut[0].NetworkSettings.Ports["8282/tcp"][0]).To(HaveField("HostPort", "8282"))
+ Expect(inspectOut[0].NetworkSettings.Ports["8282/tcp"][0]).To(HaveField("HostIP", ""))
})
It("podman run -p 8380:80", func() {
@@ -173,8 +172,8 @@ var _ = Describe("Podman run networking", func() {
Expect(inspectOut).To(HaveLen(1))
Expect(inspectOut[0].NetworkSettings.Ports).To(HaveLen(1))
Expect(inspectOut[0].NetworkSettings.Ports["80/tcp"]).To(HaveLen(1))
- Expect(inspectOut[0].NetworkSettings.Ports["80/tcp"][0].HostPort).To(Equal("8380"))
- Expect(inspectOut[0].NetworkSettings.Ports["80/tcp"][0].HostIP).To(Equal(""))
+ Expect(inspectOut[0].NetworkSettings.Ports["80/tcp"][0]).To(HaveField("HostPort", "8380"))
+ Expect(inspectOut[0].NetworkSettings.Ports["80/tcp"][0]).To(HaveField("HostIP", ""))
})
It("podman run -p 8480:80/TCP", func() {
@@ -187,8 +186,8 @@ var _ = Describe("Podman run networking", func() {
Expect(inspectOut[0].NetworkSettings.Ports).To(HaveLen(1))
// "tcp" in lower characters
Expect(inspectOut[0].NetworkSettings.Ports["80/tcp"]).To(HaveLen(1))
- Expect(inspectOut[0].NetworkSettings.Ports["80/tcp"][0].HostPort).To(Equal("8480"))
- Expect(inspectOut[0].NetworkSettings.Ports["80/tcp"][0].HostIP).To(Equal(""))
+ Expect(inspectOut[0].NetworkSettings.Ports["80/tcp"][0]).To(HaveField("HostPort", "8480"))
+ Expect(inspectOut[0].NetworkSettings.Ports["80/tcp"][0]).To(HaveField("HostIP", ""))
})
It("podman run -p 80/udp", func() {
@@ -200,7 +199,7 @@ var _ = Describe("Podman run networking", func() {
Expect(inspectOut[0].NetworkSettings.Ports).To(HaveLen(1))
Expect(inspectOut[0].NetworkSettings.Ports["80/udp"]).To(HaveLen(1))
Expect(inspectOut[0].NetworkSettings.Ports["80/udp"][0].HostPort).To(Not(Equal("80")))
- Expect(inspectOut[0].NetworkSettings.Ports["80/udp"][0].HostIP).To(Equal(""))
+ Expect(inspectOut[0].NetworkSettings.Ports["80/udp"][0]).To(HaveField("HostIP", ""))
})
It("podman run -p 127.0.0.1:8580:80", func() {
@@ -211,8 +210,8 @@ var _ = Describe("Podman run networking", func() {
Expect(inspectOut).To(HaveLen(1))
Expect(inspectOut[0].NetworkSettings.Ports).To(HaveLen(1))
Expect(inspectOut[0].NetworkSettings.Ports["80/tcp"]).To(HaveLen(1))
- Expect(inspectOut[0].NetworkSettings.Ports["80/tcp"][0].HostPort).To(Equal("8580"))
- Expect(inspectOut[0].NetworkSettings.Ports["80/tcp"][0].HostIP).To(Equal("127.0.0.1"))
+ Expect(inspectOut[0].NetworkSettings.Ports["80/tcp"][0]).To(HaveField("HostPort", "8580"))
+ Expect(inspectOut[0].NetworkSettings.Ports["80/tcp"][0]).To(HaveField("HostIP", "127.0.0.1"))
})
It("podman run -p 127.0.0.1:8680:80/udp", func() {
@@ -223,8 +222,8 @@ var _ = Describe("Podman run networking", func() {
Expect(inspectOut).To(HaveLen(1))
Expect(inspectOut[0].NetworkSettings.Ports).To(HaveLen(1))
Expect(inspectOut[0].NetworkSettings.Ports["80/udp"]).To(HaveLen(1))
- Expect(inspectOut[0].NetworkSettings.Ports["80/udp"][0].HostPort).To(Equal("8680"))
- Expect(inspectOut[0].NetworkSettings.Ports["80/udp"][0].HostIP).To(Equal("127.0.0.1"))
+ Expect(inspectOut[0].NetworkSettings.Ports["80/udp"][0]).To(HaveField("HostPort", "8680"))
+ Expect(inspectOut[0].NetworkSettings.Ports["80/udp"][0]).To(HaveField("HostIP", "127.0.0.1"))
})
It("podman run -p [::1]:8780:80/udp", func() {
@@ -235,8 +234,8 @@ var _ = Describe("Podman run networking", func() {
Expect(inspectOut).To(HaveLen(1))
Expect(inspectOut[0].NetworkSettings.Ports).To(HaveLen(1))
Expect(inspectOut[0].NetworkSettings.Ports["80/udp"]).To(HaveLen(1))
- Expect(inspectOut[0].NetworkSettings.Ports["80/udp"][0].HostPort).To(Equal("8780"))
- Expect(inspectOut[0].NetworkSettings.Ports["80/udp"][0].HostIP).To(Equal("::1"))
+ Expect(inspectOut[0].NetworkSettings.Ports["80/udp"][0]).To(HaveField("HostPort", "8780"))
+ Expect(inspectOut[0].NetworkSettings.Ports["80/udp"][0]).To(HaveField("HostIP", "::1"))
})
It("podman run -p [::1]:8880:80/tcp", func() {
@@ -247,8 +246,8 @@ var _ = Describe("Podman run networking", func() {
Expect(inspectOut).To(HaveLen(1))
Expect(inspectOut[0].NetworkSettings.Ports).To(HaveLen(1))
Expect(inspectOut[0].NetworkSettings.Ports["80/tcp"]).To(HaveLen(1))
- Expect(inspectOut[0].NetworkSettings.Ports["80/tcp"][0].HostPort).To(Equal("8880"))
- Expect(inspectOut[0].NetworkSettings.Ports["80/tcp"][0].HostIP).To(Equal("::1"))
+ Expect(inspectOut[0].NetworkSettings.Ports["80/tcp"][0]).To(HaveField("HostPort", "8880"))
+ Expect(inspectOut[0].NetworkSettings.Ports["80/tcp"][0]).To(HaveField("HostIP", "::1"))
})
It("podman run --expose 80 -P", func() {
@@ -260,7 +259,7 @@ var _ = Describe("Podman run networking", func() {
Expect(inspectOut[0].NetworkSettings.Ports).To(HaveLen(1))
Expect(inspectOut[0].NetworkSettings.Ports["80/tcp"]).To(HaveLen(1))
Expect(inspectOut[0].NetworkSettings.Ports["80/tcp"][0].HostPort).To(Not(Equal("0")))
- Expect(inspectOut[0].NetworkSettings.Ports["80/tcp"][0].HostIP).To(Equal(""))
+ Expect(inspectOut[0].NetworkSettings.Ports["80/tcp"][0]).To(HaveField("HostIP", ""))
})
It("podman run --expose 80/udp -P", func() {
@@ -272,7 +271,7 @@ var _ = Describe("Podman run networking", func() {
Expect(inspectOut[0].NetworkSettings.Ports).To(HaveLen(1))
Expect(inspectOut[0].NetworkSettings.Ports["80/udp"]).To(HaveLen(1))
Expect(inspectOut[0].NetworkSettings.Ports["80/udp"][0].HostPort).To(Not(Equal("0")))
- Expect(inspectOut[0].NetworkSettings.Ports["80/udp"][0].HostIP).To(Equal(""))
+ Expect(inspectOut[0].NetworkSettings.Ports["80/udp"][0]).To(HaveField("HostIP", ""))
})
It("podman run --expose 80 -p 80", func() {
@@ -284,7 +283,7 @@ var _ = Describe("Podman run networking", func() {
Expect(inspectOut[0].NetworkSettings.Ports).To(HaveLen(1))
Expect(inspectOut[0].NetworkSettings.Ports["80/tcp"]).To(HaveLen(1))
Expect(inspectOut[0].NetworkSettings.Ports["80/tcp"][0].HostPort).To(Not(Equal("80")))
- Expect(inspectOut[0].NetworkSettings.Ports["80/tcp"][0].HostIP).To(Equal(""))
+ Expect(inspectOut[0].NetworkSettings.Ports["80/tcp"][0]).To(HaveField("HostIP", ""))
})
It("podman run --publish-all with EXPOSE port ranges in Dockerfile", func() {
@@ -332,7 +331,7 @@ EXPOSE 2004-2005/tcp`, ALPINE)
Expect(inspectOut[0].NetworkSettings.Ports).To(HaveLen(1))
Expect(inspectOut[0].NetworkSettings.Ports["8980/udp"]).To(HaveLen(1))
Expect(inspectOut[0].NetworkSettings.Ports["8980/udp"][0].HostPort).To(Not(Equal("8980")))
- Expect(inspectOut[0].NetworkSettings.Ports["8980/udp"][0].HostIP).To(Equal("127.0.0.1"))
+ Expect(inspectOut[0].NetworkSettings.Ports["8980/udp"][0]).To(HaveField("HostIP", "127.0.0.1"))
})
It("podman run -p :8181", func() {
@@ -344,7 +343,7 @@ EXPOSE 2004-2005/tcp`, ALPINE)
Expect(inspectOut[0].NetworkSettings.Ports).To(HaveLen(1))
Expect(inspectOut[0].NetworkSettings.Ports["8181/tcp"]).To(HaveLen(1))
Expect(inspectOut[0].NetworkSettings.Ports["8181/tcp"][0].HostPort).To(Not(Equal("8181")))
- Expect(inspectOut[0].NetworkSettings.Ports["8181/tcp"][0].HostIP).To(Equal(""))
+ Expect(inspectOut[0].NetworkSettings.Ports["8181/tcp"][0]).To(HaveField("HostIP", ""))
})
It("podman run -p xxx:8080 -p yyy:8080", func() {
@@ -371,8 +370,8 @@ EXPOSE 2004-2005/tcp`, ALPINE)
Expect(inspectOut).To(HaveLen(1))
Expect(inspectOut[0].NetworkSettings.Ports).To(HaveLen(1))
Expect(inspectOut[0].NetworkSettings.Ports["80/tcp"]).To(HaveLen(1))
- Expect(inspectOut[0].NetworkSettings.Ports["80/tcp"][0].HostPort).To(Equal("9280"))
- Expect(inspectOut[0].NetworkSettings.Ports["80/tcp"][0].HostIP).To(Equal(""))
+ Expect(inspectOut[0].NetworkSettings.Ports["80/tcp"][0]).To(HaveField("HostPort", "9280"))
+ Expect(inspectOut[0].NetworkSettings.Ports["80/tcp"][0]).To(HaveField("HostIP", ""))
})
It("podman run network expose host port 80 to container port", func() {
@@ -747,11 +746,12 @@ EXPOSE 2004-2005/tcp`, ALPINE)
routeAdd := func(gateway string) {
gw := net.ParseIP(gateway)
route := &netlink.Route{Dst: nil, Gw: gw}
- netlink.RouteAdd(route)
+ err = netlink.RouteAdd(route)
+ Expect(err).ToNot(HaveOccurred())
}
setupNetworkNs := func(networkNSName string) {
- ns.WithNetNSPath("/run/netns/"+networkNSName, func(_ ns.NetNS) error {
+ _ = ns.WithNetNSPath("/run/netns/"+networkNSName, func(_ ns.NetNS) error {
loopbackup()
linkup("eth0", "46:7f:45:6e:4f:c8", []string{"10.25.40.0/24", "fd04:3e42:4a4e:3381::/64"})
linkup("eth1", "56:6e:35:5d:3e:a8", []string{"10.88.0.0/16"})
@@ -763,18 +763,18 @@ EXPOSE 2004-2005/tcp`, ALPINE)
checkNetworkNsInspect := func(name string) {
inspectOut := podmanTest.InspectContainer(name)
- Expect(inspectOut[0].NetworkSettings.IPAddress).To(Equal("10.25.40.0"))
- Expect(inspectOut[0].NetworkSettings.IPPrefixLen).To(Equal(24))
+ Expect(inspectOut[0].NetworkSettings).To(HaveField("IPAddress", "10.25.40.0"))
+ Expect(inspectOut[0].NetworkSettings).To(HaveField("IPPrefixLen", 24))
Expect(len(inspectOut[0].NetworkSettings.SecondaryIPAddresses)).To(Equal(1))
- Expect(inspectOut[0].NetworkSettings.SecondaryIPAddresses[0].Addr).To(Equal("10.88.0.0"))
- Expect(inspectOut[0].NetworkSettings.SecondaryIPAddresses[0].PrefixLength).To(Equal(16))
- Expect(inspectOut[0].NetworkSettings.GlobalIPv6Address).To(Equal("fd04:3e42:4a4e:3381::"))
- Expect(inspectOut[0].NetworkSettings.GlobalIPv6PrefixLen).To(Equal(64))
+ Expect(inspectOut[0].NetworkSettings.SecondaryIPAddresses[0]).To(HaveField("Addr", "10.88.0.0"))
+ Expect(inspectOut[0].NetworkSettings.SecondaryIPAddresses[0]).To(HaveField("PrefixLength", 16))
+ Expect(inspectOut[0].NetworkSettings).To(HaveField("GlobalIPv6Address", "fd04:3e42:4a4e:3381::"))
+ Expect(inspectOut[0].NetworkSettings).To(HaveField("GlobalIPv6PrefixLen", 64))
Expect(len(inspectOut[0].NetworkSettings.SecondaryIPv6Addresses)).To(Equal(0))
- Expect(inspectOut[0].NetworkSettings.MacAddress).To(Equal("46:7f:45:6e:4f:c8"))
+ Expect(inspectOut[0].NetworkSettings).To(HaveField("MacAddress", "46:7f:45:6e:4f:c8"))
Expect(len(inspectOut[0].NetworkSettings.AdditionalMacAddresses)).To(Equal(1))
Expect(inspectOut[0].NetworkSettings.AdditionalMacAddresses[0]).To(Equal("56:6e:35:5d:3e:a8"))
- Expect(inspectOut[0].NetworkSettings.Gateway).To(Equal("10.25.40.0"))
+ Expect(inspectOut[0].NetworkSettings).To(HaveField("Gateway", "10.25.40.0"))
}
@@ -796,7 +796,7 @@ EXPOSE 2004-2005/tcp`, ALPINE)
Expect(delNetworkNamespace).Should(Exit(0))
inspectOut := podmanTest.InspectContainer(name)
- Expect(inspectOut[0].NetworkSettings.IPAddress).To(Equal(""))
+ Expect(inspectOut[0].NetworkSettings).To(HaveField("IPAddress", ""))
Expect(len(inspectOut[0].NetworkSettings.Networks)).To(Equal(0))
})
@@ -1133,6 +1133,8 @@ EXPOSE 2004-2005/tcp`, ALPINE)
})
It("podman run with ipam none driver", func() {
+ // Test fails, issue #13931
+ SkipIfNetavark(podmanTest)
net := "ipam" + stringid.GenerateNonCryptoID()
session := podmanTest.Podman([]string{"network", "create", "--ipam-driver=none", net})
session.WaitWithDefaultTimeout()
diff --git a/test/e2e/run_ns_test.go b/test/e2e/run_ns_test.go
index 23fd298d7..f99d6cf3f 100644
--- a/test/e2e/run_ns_test.go
+++ b/test/e2e/run_ns_test.go
@@ -25,7 +25,6 @@ var _ = Describe("Podman run ns", func() {
}
podmanTest = PodmanTestCreate(tempdir)
podmanTest.Setup()
- podmanTest.SeedImages()
})
AfterEach(func() {
diff --git a/test/e2e/run_passwd_test.go b/test/e2e/run_passwd_test.go
index ce6c6ffda..411e12218 100644
--- a/test/e2e/run_passwd_test.go
+++ b/test/e2e/run_passwd_test.go
@@ -24,7 +24,6 @@ var _ = Describe("Podman run passwd", func() {
}
podmanTest = PodmanTestCreate(tempdir)
podmanTest.Setup()
- podmanTest.SeedImages()
})
AfterEach(func() {
diff --git a/test/e2e/run_privileged_test.go b/test/e2e/run_privileged_test.go
index 59223c589..4f0b512c6 100644
--- a/test/e2e/run_privileged_test.go
+++ b/test/e2e/run_privileged_test.go
@@ -49,7 +49,6 @@ var _ = Describe("Podman privileged container tests", func() {
}
podmanTest = PodmanTestCreate(tempdir)
podmanTest.Setup()
- podmanTest.SeedImages()
})
AfterEach(func() {
diff --git a/test/e2e/run_restart_test.go b/test/e2e/run_restart_test.go
index ec8fbfe98..b1002ece4 100644
--- a/test/e2e/run_restart_test.go
+++ b/test/e2e/run_restart_test.go
@@ -23,7 +23,6 @@ var _ = Describe("Podman run restart containers", func() {
}
podmanTest = PodmanTestCreate(tempdir)
podmanTest.Setup()
- podmanTest.SeedImages()
})
AfterEach(func() {
diff --git a/test/e2e/run_seccomp_test.go b/test/e2e/run_seccomp_test.go
index 03212b6dc..bd44a3ef1 100644
--- a/test/e2e/run_seccomp_test.go
+++ b/test/e2e/run_seccomp_test.go
@@ -23,7 +23,6 @@ var _ = Describe("Podman run", func() {
}
podmanTest = PodmanTestCreate(tempdir)
podmanTest.Setup()
- podmanTest.SeedImages()
})
AfterEach(func() {
diff --git a/test/e2e/run_security_labels_test.go b/test/e2e/run_security_labels_test.go
index 8aebeaebb..915566a2c 100644
--- a/test/e2e/run_security_labels_test.go
+++ b/test/e2e/run_security_labels_test.go
@@ -25,8 +25,6 @@ var _ = Describe("Podman generate kube", func() {
}
podmanTest = PodmanTestCreate(tempdir)
podmanTest.Setup()
- podmanTest.SeedImages()
-
})
AfterEach(func() {
diff --git a/test/e2e/run_selinux_test.go b/test/e2e/run_selinux_test.go
index b71c68baf..4a433f308 100644
--- a/test/e2e/run_selinux_test.go
+++ b/test/e2e/run_selinux_test.go
@@ -25,7 +25,6 @@ var _ = Describe("Podman run", func() {
}
podmanTest = PodmanTestCreate(tempdir)
podmanTest.Setup()
- podmanTest.SeedImages()
if !selinux.GetEnabled() {
Skip("SELinux not enabled")
}
diff --git a/test/e2e/run_signal_test.go b/test/e2e/run_signal_test.go
index 71efa770a..e5d9b6c7b 100644
--- a/test/e2e/run_signal_test.go
+++ b/test/e2e/run_signal_test.go
@@ -34,7 +34,6 @@ var _ = Describe("Podman run with --sig-proxy", func() {
}
podmanTest = PodmanTestCreate(tmpdir)
podmanTest.Setup()
- podmanTest.SeedImages()
})
AfterEach(func() {
@@ -51,11 +50,14 @@ var _ = Describe("Podman run with --sig-proxy", func() {
signal := syscall.SIGFPE
// Set up a socket for communication
udsDir := filepath.Join(tmpdir, "socket")
- os.Mkdir(udsDir, 0700)
+ err := os.Mkdir(udsDir, 0700)
+ Expect(err).ToNot(HaveOccurred())
udsPath := filepath.Join(udsDir, "fifo")
- syscall.Mkfifo(udsPath, 0600)
+ err = syscall.Mkfifo(udsPath, 0600)
+ Expect(err).ToNot(HaveOccurred())
if rootless.IsRootless() {
- podmanTest.RestoreArtifact(fedoraMinimal)
+ err = podmanTest.RestoreArtifact(fedoraMinimal)
+ Expect(err).ToNot(HaveOccurred())
}
_, pid := podmanTest.PodmanPID([]string{"run", "-it", "-v", fmt.Sprintf("%s:/h:Z", udsDir), fedoraMinimal, "bash", "-c", sigCatch})
@@ -66,7 +68,7 @@ var _ = Describe("Podman run with --sig-proxy", func() {
counter := 0
for {
buf := make([]byte, 1024)
- n, err := uds.Read(buf[:])
+ n, err := uds.Read(buf)
if err != nil && err != io.EOF {
fmt.Println(err)
return
@@ -92,7 +94,7 @@ var _ = Describe("Podman run with --sig-proxy", func() {
counter = 0
for {
buf := make([]byte, 1024)
- n, err := uds.Read(buf[:])
+ n, err := uds.Read(buf)
if err != nil {
fmt.Println(err)
return
@@ -112,7 +114,8 @@ var _ = Describe("Podman run with --sig-proxy", func() {
Specify("signals are not forwarded to container with sig-proxy false", func() {
signal := syscall.SIGFPE
if rootless.IsRootless() {
- podmanTest.RestoreArtifact(fedoraMinimal)
+ err = podmanTest.RestoreArtifact(fedoraMinimal)
+ Expect(err).ToNot(HaveOccurred())
}
session, pid := podmanTest.PodmanPID([]string{"run", "--name", "test2", "--sig-proxy=false", fedoraMinimal, "bash", "-c", sigCatch2})
diff --git a/test/e2e/run_staticip_test.go b/test/e2e/run_staticip_test.go
index 7e61e7c5e..af3f98d4b 100644
--- a/test/e2e/run_staticip_test.go
+++ b/test/e2e/run_staticip_test.go
@@ -28,7 +28,6 @@ var _ = Describe("Podman run with --ip flag", func() {
}
podmanTest = PodmanTestCreate(tempdir)
podmanTest.Setup()
- podmanTest.SeedImages()
// Cleanup the CNI networks used by the tests
os.RemoveAll("/var/lib/cni/networks/podman")
})
diff --git a/test/e2e/run_test.go b/test/e2e/run_test.go
index 4c399dc2b..182ae1888 100644
--- a/test/e2e/run_test.go
+++ b/test/e2e/run_test.go
@@ -16,7 +16,6 @@ import (
"github.com/containers/podman/v4/pkg/rootless"
. "github.com/containers/podman/v4/test/utils"
"github.com/containers/storage/pkg/stringid"
- "github.com/mrunalp/fileutils"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
. "github.com/onsi/gomega/gexec"
@@ -36,7 +35,6 @@ var _ = Describe("Podman run", func() {
}
podmanTest = PodmanTestCreate(tempdir)
podmanTest.Setup()
- podmanTest.SeedImages()
})
AfterEach(func() {
@@ -288,7 +286,7 @@ var _ = Describe("Podman run", func() {
result.WaitWithDefaultTimeout()
Expect(result).Should(Exit(0))
conData := result.InspectContainerToJSON()
- Expect(conData[0].Path).To(Equal("/dev/init"))
+ Expect(conData[0]).To(HaveField("Path", "/dev/init"))
Expect(conData[0].Config.Annotations).To(HaveKeyWithValue("io.podman.annotations.init", "TRUE"))
})
@@ -300,7 +298,7 @@ var _ = Describe("Podman run", func() {
result.WaitWithDefaultTimeout()
Expect(result).Should(Exit(0))
conData := result.InspectContainerToJSON()
- Expect(conData[0].Path).To(Equal("/dev/init"))
+ Expect(conData[0]).To(HaveField("Path", "/dev/init"))
Expect(conData[0].Config.Annotations).To(HaveKeyWithValue("io.podman.annotations.init", "TRUE"))
})
@@ -312,7 +310,7 @@ var _ = Describe("Podman run", func() {
result.WaitWithDefaultTimeout()
Expect(result).Should(Exit(0))
conData := result.InspectContainerToJSON()
- Expect(conData[0].Path).To(Equal("ls"))
+ Expect(conData[0]).To(HaveField("Path", "ls"))
Expect(conData[0].Config.Annotations).To(HaveKeyWithValue("io.podman.annotations.init", "FALSE"))
})
@@ -812,16 +810,38 @@ USER bin`, BB)
})
It("podman test hooks", func() {
- hcheck := "/run/hookscheck"
+ SkipIfRemote("--hooks-dir does not work with remote")
hooksDir := tempdir + "/hooks"
- os.Mkdir(hooksDir, 0755)
- fileutils.CopyFile("hooks/hooks.json", hooksDir)
- os.Setenv("HOOK_OPTION", fmt.Sprintf("--hooks-dir=%s", hooksDir))
- os.Remove(hcheck)
- session := podmanTest.Podman([]string{"run", ALPINE, "ls"})
+ err := os.Mkdir(hooksDir, 0755)
+ Expect(err).ToNot(HaveOccurred())
+ hookJSONPath := filepath.Join(hooksDir, "checkhooks.json")
+ hookScriptPath := filepath.Join(hooksDir, "checkhooks.sh")
+ targetFile := filepath.Join(hooksDir, "target")
+
+ hookJSON := fmt.Sprintf(`{
+ "cmd" : [".*"],
+ "hook" : "%s",
+ "stage" : [ "prestart" ]
+}
+`, hookScriptPath)
+ err = ioutil.WriteFile(hookJSONPath, []byte(hookJSON), 0644)
+ Expect(err).ToNot(HaveOccurred())
+
+ random := stringid.GenerateNonCryptoID()
+
+ hookScript := fmt.Sprintf(`#!/bin/sh
+echo -n %s >%s
+`, random, targetFile)
+ err = ioutil.WriteFile(hookScriptPath, []byte(hookScript), 0755)
+ Expect(err).ToNot(HaveOccurred())
+
+ session := podmanTest.Podman([]string{"--hooks-dir", hooksDir, "run", ALPINE, "ls"})
session.Wait(10)
- os.Unsetenv("HOOK_OPTION")
Expect(session).Should(Exit(0))
+
+ b, err := ioutil.ReadFile(targetFile)
+ Expect(err).ToNot(HaveOccurred())
+ Expect(string(b)).To(Equal(random))
})
It("podman run with subscription secrets", func() {
diff --git a/test/e2e/run_userns_test.go b/test/e2e/run_userns_test.go
index 092621c27..613727118 100644
--- a/test/e2e/run_userns_test.go
+++ b/test/e2e/run_userns_test.go
@@ -33,7 +33,6 @@ var _ = Describe("Podman UserNS support", func() {
}
podmanTest = PodmanTestCreate(tempdir)
podmanTest.Setup()
- podmanTest.SeedImages()
})
AfterEach(func() {
diff --git a/test/e2e/run_volume_test.go b/test/e2e/run_volume_test.go
index 0be84e11b..3bef889b7 100644
--- a/test/e2e/run_volume_test.go
+++ b/test/e2e/run_volume_test.go
@@ -34,7 +34,6 @@ var _ = Describe("Podman run with volumes", func() {
}
podmanTest = PodmanTestCreate(tempdir)
podmanTest.Setup()
- podmanTest.SeedImages()
})
AfterEach(func() {
@@ -55,7 +54,8 @@ var _ = Describe("Podman run with volumes", func() {
It("podman run with volume flag", func() {
mountPath := filepath.Join(podmanTest.TempDir, "secrets")
- os.Mkdir(mountPath, 0755)
+ err = os.Mkdir(mountPath, 0755)
+ Expect(err).ToNot(HaveOccurred())
vol := mountPath + ":" + dest
// [5] is flags
@@ -82,7 +82,8 @@ var _ = Describe("Podman run with volumes", func() {
Skip("skip failing test on ppc64le")
}
mountPath := filepath.Join(podmanTest.TempDir, "secrets")
- os.Mkdir(mountPath, 0755)
+ err = os.Mkdir(mountPath, 0755)
+ Expect(err).ToNot(HaveOccurred())
mount := "type=bind,src=" + mountPath + ",target=" + dest
session := podmanTest.Podman([]string{"run", "--rm", "--mount", mount, ALPINE, "grep", dest, "/proc/self/mountinfo"})
@@ -141,14 +142,16 @@ var _ = Describe("Podman run with volumes", func() {
It("podman run with conflicting volumes errors", func() {
mountPath := filepath.Join(podmanTest.TmpDir, "secrets")
- os.Mkdir(mountPath, 0755)
+ err := os.Mkdir(mountPath, 0755)
+ Expect(err).ToNot(HaveOccurred())
session := podmanTest.Podman([]string{"run", "-v", mountPath + ":" + dest, "-v", "/tmp" + ":" + dest, ALPINE, "ls"})
session.WaitWithDefaultTimeout()
Expect(session).Should(Exit(125))
})
It("podman run with conflict between image volume and user mount succeeds", func() {
- podmanTest.RestoreArtifact(redis)
+ err = podmanTest.RestoreArtifact(redis)
+ Expect(err).ToNot(HaveOccurred())
mountPath := filepath.Join(podmanTest.TempDir, "secrets")
err := os.Mkdir(mountPath, 0755)
Expect(err).To(BeNil())
@@ -164,7 +167,8 @@ var _ = Describe("Podman run with volumes", func() {
It("podman run with mount flag and boolean options", func() {
mountPath := filepath.Join(podmanTest.TempDir, "secrets")
- os.Mkdir(mountPath, 0755)
+ err := os.Mkdir(mountPath, 0755)
+ Expect(err).ToNot(HaveOccurred())
mount := "type=bind,src=" + mountPath + ",target=" + dest
session := podmanTest.Podman([]string{"run", "--rm", "--mount", mount + ",ro=false", ALPINE, "grep", dest, "/proc/self/mountinfo"})
@@ -193,7 +197,8 @@ var _ = Describe("Podman run with volumes", func() {
It("podman run with volumes and suid/dev/exec options", func() {
SkipIfRemote("podman-remote does not support --volumes")
mountPath := filepath.Join(podmanTest.TempDir, "secrets")
- os.Mkdir(mountPath, 0755)
+ err := os.Mkdir(mountPath, 0755)
+ Expect(err).ToNot(HaveOccurred())
session := podmanTest.Podman([]string{"run", "--rm", "-v", mountPath + ":" + dest + ":suid,dev,exec", ALPINE, "grep", dest, "/proc/self/mountinfo"})
session.WaitWithDefaultTimeout()
@@ -224,9 +229,10 @@ var _ = Describe("Podman run with volumes", func() {
}
}
mountPath := filepath.Join(podmanTest.TempDir, "secrets")
- os.Mkdir(mountPath, 0755)
+ err := os.Mkdir(mountPath, 0755)
+ Expect(err).ToNot(HaveOccurred())
- //Container should be able to start with custom overlay volume
+ // Container should be able to start with custom overlay volume
session := podmanTest.Podman([]string{"run", "--rm", "-v", mountPath + ":/data:O", "--workdir=/data", ALPINE, "echo", "hello"})
session.WaitWithDefaultTimeout()
Expect(session).Should(Exit(0))
@@ -588,8 +594,8 @@ VOLUME /test/`, ALPINE)
data := podmanTest.InspectContainer(ctrName)
Expect(data).To(HaveLen(1))
Expect(data[0].Mounts).To(HaveLen(1))
- Expect(data[0].Mounts[0].Source).To(Equal("/tmp"))
- Expect(data[0].Mounts[0].Destination).To(Equal("/test"))
+ Expect(data[0].Mounts[0]).To(HaveField("Source", "/tmp"))
+ Expect(data[0].Mounts[0]).To(HaveField("Destination", "/test"))
})
It("podman run with overlay volume flag", func() {
@@ -603,7 +609,8 @@ VOLUME /test/`, ALPINE)
}
}
mountPath := filepath.Join(podmanTest.TempDir, "secrets")
- os.Mkdir(mountPath, 0755)
+ err := os.Mkdir(mountPath, 0755)
+ Expect(err).ToNot(HaveOccurred())
testFile := filepath.Join(mountPath, "test1")
f, err := os.Create(testFile)
Expect(err).To(BeNil(), "os.Create "+testFile)
@@ -651,7 +658,8 @@ VOLUME /test/`, ALPINE)
It("overlay volume conflicts with named volume and mounts", func() {
mountPath := filepath.Join(podmanTest.TempDir, "secrets")
- os.Mkdir(mountPath, 0755)
+ err := os.Mkdir(mountPath, 0755)
+ Expect(err).ToNot(HaveOccurred())
testFile := filepath.Join(mountPath, "test1")
f, err := os.Create(testFile)
Expect(err).To(BeNil())
@@ -716,7 +724,8 @@ VOLUME /test/`, ALPINE)
}
mountPath := filepath.Join(podmanTest.TempDir, "secrets")
- os.Mkdir(mountPath, 0755)
+ err = os.Mkdir(mountPath, 0755)
+ Expect(err).ToNot(HaveOccurred())
vol := mountPath + ":" + dest + ":U"
session := podmanTest.Podman([]string{"run", "--rm", "--user", "888:888", "-v", vol, ALPINE, "stat", "-c", "%u:%g", dest})
@@ -729,7 +738,7 @@ VOLUME /test/`, ALPINE)
Expect(session).Should(Exit(0))
Expect(session.OutputToString()).To(ContainSubstring("888:888"))
- vol = vol + ",O"
+ vol += ",O"
session = podmanTest.Podman([]string{"run", "--rm", "--user", "888:888", "--userns", "keep-id", "-v", vol, ALPINE, "stat", "-c", "%u:%g", dest})
session.WaitWithDefaultTimeout()
Expect(session).Should(Exit(0))
@@ -754,7 +763,8 @@ VOLUME /test/`, ALPINE)
}
mountPath := filepath.Join(podmanTest.TempDir, "foo")
- os.Mkdir(mountPath, 0755)
+ err = os.Mkdir(mountPath, 0755)
+ Expect(err).ToNot(HaveOccurred())
// false bind mount
vol := "type=bind,src=" + mountPath + ",dst=" + dest + ",U=false"
diff --git a/test/e2e/run_working_dir_test.go b/test/e2e/run_working_dir_test.go
index 50d0a2194..ff91a420f 100644
--- a/test/e2e/run_working_dir_test.go
+++ b/test/e2e/run_working_dir_test.go
@@ -24,7 +24,6 @@ var _ = Describe("Podman run", func() {
}
podmanTest = PodmanTestCreate(tempdir)
podmanTest.Setup()
- podmanTest.SeedImages()
})
AfterEach(func() {
diff --git a/test/e2e/runlabel_test.go b/test/e2e/runlabel_test.go
index d1e11dd9a..018ed37c2 100644
--- a/test/e2e/runlabel_test.go
+++ b/test/e2e/runlabel_test.go
@@ -37,7 +37,6 @@ var _ = Describe("podman container runlabel", func() {
}
podmanTest = PodmanTestCreate(tempdir)
podmanTest.Setup()
- podmanTest.SeedImages()
})
AfterEach(func() {
diff --git a/test/e2e/save_test.go b/test/e2e/save_test.go
index 39295608e..536eefda7 100644
--- a/test/e2e/save_test.go
+++ b/test/e2e/save_test.go
@@ -170,7 +170,8 @@ var _ = Describe("Podman save", func() {
}
defer func() {
cmd = exec.Command("cp", "default.yaml", "/etc/containers/registries.d/default.yaml")
- cmd.Run()
+ err := cmd.Run()
+ Expect(err).ToNot(HaveOccurred())
}()
cmd = exec.Command("cp", "sign/key.gpg", "/tmp/key.gpg")
diff --git a/test/e2e/search_test.go b/test/e2e/search_test.go
index 07198d799..8237f6433 100644
--- a/test/e2e/search_test.go
+++ b/test/e2e/search_test.go
@@ -64,8 +64,6 @@ registries = ['{{.Host}}:{{.Port}}']`
podmanTest = PodmanTestCreate(tempdir)
podmanTest.Setup()
- podmanTest.SeedImages()
-
})
AfterEach(func() {
@@ -242,7 +240,8 @@ registries = ['{{.Host}}:{{.Port}}']`
Fail("Cannot start docker registry on port %s", port)
}
ep := endpoint{Port: fmt.Sprintf("%d", port), Host: "localhost"}
- podmanTest.RestoreArtifact(ALPINE)
+ err = podmanTest.RestoreArtifact(ALPINE)
+ Expect(err).ToNot(HaveOccurred())
image := fmt.Sprintf("%s/my-alpine", ep.Address())
push := podmanTest.Podman([]string{"push", "--tls-verify=false", "--remove-signatures", ALPINE, image})
push.WaitWithDefaultTimeout()
@@ -277,7 +276,8 @@ registries = ['{{.Host}}:{{.Port}}']`
Fail("unable to start registry on port %s", port)
}
- podmanTest.RestoreArtifact(ALPINE)
+ err = podmanTest.RestoreArtifact(ALPINE)
+ Expect(err).ToNot(HaveOccurred())
image := fmt.Sprintf("%s/my-alpine", ep.Address())
push := podmanTest.Podman([]string{"push", "--tls-verify=false", "--remove-signatures", ALPINE, image})
push.WaitWithDefaultTimeout()
@@ -285,9 +285,11 @@ registries = ['{{.Host}}:{{.Port}}']`
// registries.conf set up
var buffer bytes.Buffer
- registryFileTmpl.Execute(&buffer, ep)
+ err = registryFileTmpl.Execute(&buffer, ep)
+ Expect(err).ToNot(HaveOccurred())
podmanTest.setRegistriesConfigEnv(buffer.Bytes())
- ioutil.WriteFile(fmt.Sprintf("%s/registry4.conf", tempdir), buffer.Bytes(), 0644)
+ err = ioutil.WriteFile(fmt.Sprintf("%s/registry4.conf", tempdir), buffer.Bytes(), 0644)
+ Expect(err).ToNot(HaveOccurred())
if IsRemote() {
podmanTest.RestartRemoteService()
defer podmanTest.RestartRemoteService()
@@ -319,16 +321,19 @@ registries = ['{{.Host}}:{{.Port}}']`
Fail("Cannot start docker registry on port %s", port)
}
- podmanTest.RestoreArtifact(ALPINE)
+ err = podmanTest.RestoreArtifact(ALPINE)
+ Expect(err).ToNot(HaveOccurred())
image := fmt.Sprintf("%s/my-alpine", ep.Address())
push := podmanTest.Podman([]string{"push", "--tls-verify=false", "--remove-signatures", ALPINE, image})
push.WaitWithDefaultTimeout()
Expect(push).Should(Exit(0))
var buffer bytes.Buffer
- registryFileTmpl.Execute(&buffer, ep)
+ err = registryFileTmpl.Execute(&buffer, ep)
+ Expect(err).ToNot(HaveOccurred())
podmanTest.setRegistriesConfigEnv(buffer.Bytes())
- ioutil.WriteFile(fmt.Sprintf("%s/registry5.conf", tempdir), buffer.Bytes(), 0644)
+ err = ioutil.WriteFile(fmt.Sprintf("%s/registry5.conf", tempdir), buffer.Bytes(), 0644)
+ Expect(err).ToNot(HaveOccurred())
search := podmanTest.Podman([]string{"search", image, "--tls-verify=true"})
search.WaitWithDefaultTimeout()
@@ -356,16 +361,19 @@ registries = ['{{.Host}}:{{.Port}}']`
Fail("Cannot start docker registry on port %s", port)
}
- podmanTest.RestoreArtifact(ALPINE)
+ err = podmanTest.RestoreArtifact(ALPINE)
+ Expect(err).ToNot(HaveOccurred())
image := fmt.Sprintf("%s/my-alpine", ep.Address())
push := podmanTest.Podman([]string{"push", "--tls-verify=false", "--remove-signatures", ALPINE, image})
push.WaitWithDefaultTimeout()
Expect(push).Should(Exit(0))
var buffer bytes.Buffer
- registryFileBadTmpl.Execute(&buffer, ep)
+ err = registryFileBadTmpl.Execute(&buffer, ep)
+ Expect(err).ToNot(HaveOccurred())
podmanTest.setRegistriesConfigEnv(buffer.Bytes())
- ioutil.WriteFile(fmt.Sprintf("%s/registry6.conf", tempdir), buffer.Bytes(), 0644)
+ err = ioutil.WriteFile(fmt.Sprintf("%s/registry6.conf", tempdir), buffer.Bytes(), 0644)
+ Expect(err).ToNot(HaveOccurred())
if IsRemote() {
podmanTest.RestartRemoteService()
@@ -409,16 +417,19 @@ registries = ['{{.Host}}:{{.Port}}']`
Fail("Cannot start docker registry on port %s", port2)
}
- podmanTest.RestoreArtifact(ALPINE)
+ err = podmanTest.RestoreArtifact(ALPINE)
+ Expect(err).ToNot(HaveOccurred())
push := podmanTest.Podman([]string{"push", "--tls-verify=false", "--remove-signatures", ALPINE, fmt.Sprintf("localhost:%d/my-alpine", port2)})
push.WaitWithDefaultTimeout()
Expect(push).Should(Exit(0))
// registries.conf set up
var buffer bytes.Buffer
- registryFileTwoTmpl.Execute(&buffer, ep3)
+ err = registryFileTwoTmpl.Execute(&buffer, ep3)
+ Expect(err).ToNot(HaveOccurred())
podmanTest.setRegistriesConfigEnv(buffer.Bytes())
- ioutil.WriteFile(fmt.Sprintf("%s/registry8.conf", tempdir), buffer.Bytes(), 0644)
+ err = ioutil.WriteFile(fmt.Sprintf("%s/registry8.conf", tempdir), buffer.Bytes(), 0644)
+ Expect(err).ToNot(HaveOccurred())
if IsRemote() {
podmanTest.RestartRemoteService()
diff --git a/test/e2e/secret_test.go b/test/e2e/secret_test.go
index 90d760c81..ed328d84a 100644
--- a/test/e2e/secret_test.go
+++ b/test/e2e/secret_test.go
@@ -26,7 +26,6 @@ var _ = Describe("Podman secret", func() {
}
podmanTest = PodmanTestCreate(tempdir)
podmanTest.Setup()
- podmanTest.SeedImages()
})
AfterEach(func() {
diff --git a/test/e2e/start_test.go b/test/e2e/start_test.go
index 98943c6fc..73af9d12c 100644
--- a/test/e2e/start_test.go
+++ b/test/e2e/start_test.go
@@ -26,7 +26,6 @@ var _ = Describe("Podman start", func() {
}
podmanTest = PodmanTestCreate(tempdir)
podmanTest.Setup()
- podmanTest.SeedImages()
})
AfterEach(func() {
diff --git a/test/e2e/stats_test.go b/test/e2e/stats_test.go
index 7435a0e3b..b43a81cd3 100644
--- a/test/e2e/stats_test.go
+++ b/test/e2e/stats_test.go
@@ -32,7 +32,6 @@ var _ = Describe("Podman stats", func() {
}
podmanTest = PodmanTestCreate(tempdir)
podmanTest.Setup()
- podmanTest.SeedImages()
})
AfterEach(func() {
diff --git a/test/e2e/stop_test.go b/test/e2e/stop_test.go
index 99d7f278c..8864ba5fd 100644
--- a/test/e2e/stop_test.go
+++ b/test/e2e/stop_test.go
@@ -25,7 +25,6 @@ var _ = Describe("Podman stop", func() {
}
podmanTest = PodmanTestCreate(tempdir)
podmanTest.Setup()
- podmanTest.SeedImages()
})
AfterEach(func() {
diff --git a/test/e2e/system_connection_test.go b/test/e2e/system_connection_test.go
index ac4c5e5ea..95920136e 100644
--- a/test/e2e/system_connection_test.go
+++ b/test/e2e/system_connection_test.go
@@ -47,7 +47,7 @@ var _ = Describe("podman system connection", func() {
}
f := CurrentGinkgoTestDescription()
- GinkgoWriter.Write(
+ _, _ = GinkgoWriter.Write(
[]byte(
fmt.Sprintf("Test: %s completed in %f seconds", f.TestText, f.Duration.Seconds())))
})
diff --git a/test/e2e/system_df_test.go b/test/e2e/system_df_test.go
index a9fa5f4ac..ba4a40ab4 100644
--- a/test/e2e/system_df_test.go
+++ b/test/e2e/system_df_test.go
@@ -26,14 +26,13 @@ var _ = Describe("podman system df", func() {
}
podmanTest = PodmanTestCreate(tempdir)
podmanTest.Setup()
- podmanTest.SeedImages()
})
AfterEach(func() {
podmanTest.Cleanup()
f := CurrentGinkgoTestDescription()
timedResult := fmt.Sprintf("Test: %s completed in %f seconds", f.TestText, f.Duration.Seconds())
- GinkgoWriter.Write([]byte(timedResult))
+ _, _ = GinkgoWriter.Write([]byte(timedResult))
})
It("podman system df", func() {
diff --git a/test/e2e/system_dial_stdio_test.go b/test/e2e/system_dial_stdio_test.go
index 5fcb20cb8..4e4c99bfe 100644
--- a/test/e2e/system_dial_stdio_test.go
+++ b/test/e2e/system_dial_stdio_test.go
@@ -24,14 +24,13 @@ var _ = Describe("podman system dial-stdio", func() {
}
podmanTest = PodmanTestCreate(tempdir)
podmanTest.Setup()
- podmanTest.SeedImages()
})
AfterEach(func() {
podmanTest.Cleanup()
f := CurrentGinkgoTestDescription()
timedResult := fmt.Sprintf("Test: %s completed in %f seconds", f.TestText, f.Duration.Seconds())
- GinkgoWriter.Write([]byte(timedResult))
+ _, _ = GinkgoWriter.Write([]byte(timedResult))
})
It("podman system dial-stdio help", func() {
diff --git a/test/e2e/system_reset_test.go b/test/e2e/system_reset_test.go
index f413ce147..ec94bb819 100644
--- a/test/e2e/system_reset_test.go
+++ b/test/e2e/system_reset_test.go
@@ -24,14 +24,13 @@ var _ = Describe("podman system reset", func() {
}
podmanTest = PodmanTestCreate(tempdir)
podmanTest.Setup()
- podmanTest.SeedImages()
})
AfterEach(func() {
podmanTest.Cleanup()
f := CurrentGinkgoTestDescription()
timedResult := fmt.Sprintf("Test: %s completed in %f seconds", f.TestText, f.Duration.Seconds())
- GinkgoWriter.Write([]byte(timedResult))
+ _, _ = GinkgoWriter.Write([]byte(timedResult))
})
It("podman system reset", func() {
diff --git a/test/e2e/systemd_activate_test.go b/test/e2e/systemd_activate_test.go
index 04acafe1b..aeea4f932 100644
--- a/test/e2e/systemd_activate_test.go
+++ b/test/e2e/systemd_activate_test.go
@@ -31,7 +31,6 @@ var _ = Describe("Systemd activate", func() {
podmanTest = PodmanTestCreate(tempDir)
podmanTest.Setup()
- podmanTest.SeedImages()
})
AfterEach(func() {
diff --git a/test/e2e/systemd_test.go b/test/e2e/systemd_test.go
index 57fc323ce..a1a080904 100644
--- a/test/e2e/systemd_test.go
+++ b/test/e2e/systemd_test.go
@@ -28,7 +28,6 @@ var _ = Describe("Podman systemd", func() {
}
podmanTest = PodmanTestCreate(tempdir)
podmanTest.Setup()
- podmanTest.SeedImages()
systemdUnitFile = `[Unit]
Description=redis container
[Service]
diff --git a/test/e2e/toolbox_test.go b/test/e2e/toolbox_test.go
index 1fc28a06d..1e9a6da1f 100644
--- a/test/e2e/toolbox_test.go
+++ b/test/e2e/toolbox_test.go
@@ -56,7 +56,6 @@ var _ = Describe("Toolbox-specific testing", func() {
}
podmanTest = PodmanTestCreate(tempdir)
podmanTest.Setup()
- podmanTest.SeedImages()
})
AfterEach(func() {
diff --git a/test/e2e/top_test.go b/test/e2e/top_test.go
index 344568da5..66bb887dc 100644
--- a/test/e2e/top_test.go
+++ b/test/e2e/top_test.go
@@ -23,7 +23,6 @@ var _ = Describe("Podman top", func() {
}
podmanTest = PodmanTestCreate(tempdir)
podmanTest.Setup()
- podmanTest.SeedImages()
})
AfterEach(func() {
diff --git a/test/e2e/tree_test.go b/test/e2e/tree_test.go
index ab6e49e88..e1282d2b4 100644
--- a/test/e2e/tree_test.go
+++ b/test/e2e/tree_test.go
@@ -31,7 +31,7 @@ var _ = Describe("Podman image tree", func() {
podmanTest.Cleanup()
f := CurrentGinkgoTestDescription()
timedResult := fmt.Sprintf("Test: %s completed in %f seconds", f.TestText, f.Duration.Seconds())
- GinkgoWriter.Write([]byte(timedResult))
+ _, _ = GinkgoWriter.Write([]byte(timedResult))
})
It("podman image tree", func() {
diff --git a/test/e2e/trust_test.go b/test/e2e/trust_test.go
index d17e34e9c..eee802e43 100644
--- a/test/e2e/trust_test.go
+++ b/test/e2e/trust_test.go
@@ -28,7 +28,6 @@ var _ = Describe("Podman trust", func() {
}
podmanTest = PodmanTestCreate(tempdir)
podmanTest.Setup()
- podmanTest.SeedImages()
})
AfterEach(func() {
@@ -75,7 +74,8 @@ var _ = Describe("Podman trust", func() {
Expect(session).Should(Exit(0))
Expect(session.OutputToString()).To(BeValidJSON())
var teststruct []map[string]string
- json.Unmarshal(session.Out.Contents(), &teststruct)
+ err = json.Unmarshal(session.Out.Contents(), &teststruct)
+ Expect(err).ToNot(HaveOccurred())
Expect(teststruct).To(HaveLen(3))
// To ease comparison, group the unordered array of repos by repo (and we expect only one entry by repo, so order within groups doesn’t matter)
repoMap := map[string][]map[string]string{}
diff --git a/test/e2e/unshare_test.go b/test/e2e/unshare_test.go
index 8b06dd4f5..520a2f884 100644
--- a/test/e2e/unshare_test.go
+++ b/test/e2e/unshare_test.go
@@ -32,7 +32,6 @@ var _ = Describe("Podman unshare", func() {
podmanTest.CgroupManager = "cgroupfs"
podmanTest.StorageOptions = ROOTLESS_STORAGE_OPTIONS
podmanTest.Setup()
- podmanTest.SeedImages()
})
AfterEach(func() {
diff --git a/test/e2e/version_test.go b/test/e2e/version_test.go
index a30db80eb..052b9aa39 100644
--- a/test/e2e/version_test.go
+++ b/test/e2e/version_test.go
@@ -30,7 +30,7 @@ var _ = Describe("Podman version", func() {
podmanTest.Cleanup()
f := CurrentGinkgoTestDescription()
processTestResult(f)
- podmanTest.SeedImages()
+
})
It("podman version", func() {
diff --git a/test/e2e/volume_create_test.go b/test/e2e/volume_create_test.go
index 0ac91abd3..09e5da8a0 100644
--- a/test/e2e/volume_create_test.go
+++ b/test/e2e/volume_create_test.go
@@ -24,7 +24,6 @@ var _ = Describe("Podman volume create", func() {
}
podmanTest = PodmanTestCreate(tempdir)
podmanTest.Setup()
- podmanTest.SeedImages()
})
AfterEach(func() {
diff --git a/test/e2e/volume_exists_test.go b/test/e2e/volume_exists_test.go
index fdadbda27..0de574968 100644
--- a/test/e2e/volume_exists_test.go
+++ b/test/e2e/volume_exists_test.go
@@ -24,7 +24,6 @@ var _ = Describe("Podman volume exists", func() {
}
podmanTest = PodmanTestCreate(tempdir)
podmanTest.Setup()
- podmanTest.SeedImages()
})
AfterEach(func() {
diff --git a/test/e2e/volume_inspect_test.go b/test/e2e/volume_inspect_test.go
index 5e3edfe24..344fe8b05 100644
--- a/test/e2e/volume_inspect_test.go
+++ b/test/e2e/volume_inspect_test.go
@@ -23,7 +23,6 @@ var _ = Describe("Podman volume inspect", func() {
}
podmanTest = PodmanTestCreate(tempdir)
podmanTest.Setup()
- podmanTest.SeedImages()
})
AfterEach(func() {
diff --git a/test/e2e/volume_ls_test.go b/test/e2e/volume_ls_test.go
index ce4cfc77d..19f87fb8a 100644
--- a/test/e2e/volume_ls_test.go
+++ b/test/e2e/volume_ls_test.go
@@ -24,7 +24,6 @@ var _ = Describe("Podman volume ls", func() {
}
podmanTest = PodmanTestCreate(tempdir)
podmanTest.Setup()
- podmanTest.SeedImages()
})
AfterEach(func() {
diff --git a/test/e2e/volume_plugin_test.go b/test/e2e/volume_plugin_test.go
index fd205805d..4700afdb5 100644
--- a/test/e2e/volume_plugin_test.go
+++ b/test/e2e/volume_plugin_test.go
@@ -25,11 +25,11 @@ var _ = Describe("Podman volume plugins", func() {
}
podmanTest = PodmanTestCreate(tempdir)
podmanTest.Setup()
- podmanTest.SeedImages()
os.Setenv("CONTAINERS_CONF", "config/containers.conf")
SkipIfRemote("Volume plugins only supported as local")
SkipIfRootless("Root is required for volume plugin testing")
- os.MkdirAll("/run/docker/plugins", 0755)
+ err = os.MkdirAll("/run/docker/plugins", 0755)
+ Expect(err).ToNot(HaveOccurred())
})
AfterEach(func() {
@@ -55,7 +55,8 @@ var _ = Describe("Podman volume plugins", func() {
podmanTest.AddImageToRWStore(volumeTest)
pluginStatePath := filepath.Join(podmanTest.TempDir, "volumes")
- os.Mkdir(pluginStatePath, 0755)
+ err := os.Mkdir(pluginStatePath, 0755)
+ Expect(err).ToNot(HaveOccurred())
// Keep this distinct within tests to avoid multiple tests using the same plugin.
pluginName := "testvol1"
@@ -89,7 +90,8 @@ var _ = Describe("Podman volume plugins", func() {
podmanTest.AddImageToRWStore(volumeTest)
pluginStatePath := filepath.Join(podmanTest.TempDir, "volumes")
- os.Mkdir(pluginStatePath, 0755)
+ err := os.Mkdir(pluginStatePath, 0755)
+ Expect(err).ToNot(HaveOccurred())
// Keep this distinct within tests to avoid multiple tests using the same plugin.
pluginName := "testvol2"
@@ -112,7 +114,8 @@ var _ = Describe("Podman volume plugins", func() {
podmanTest.AddImageToRWStore(volumeTest)
pluginStatePath := filepath.Join(podmanTest.TempDir, "volumes")
- os.Mkdir(pluginStatePath, 0755)
+ err := os.Mkdir(pluginStatePath, 0755)
+ Expect(err).ToNot(HaveOccurred())
// Keep this distinct within tests to avoid multiple tests using the same plugin.
pluginName := "testvol3"
@@ -153,7 +156,8 @@ var _ = Describe("Podman volume plugins", func() {
podmanTest.AddImageToRWStore(volumeTest)
pluginStatePath := filepath.Join(podmanTest.TempDir, "volumes")
- os.Mkdir(pluginStatePath, 0755)
+ err := os.Mkdir(pluginStatePath, 0755)
+ Expect(err).ToNot(HaveOccurred())
// Keep this distinct within tests to avoid multiple tests using the same plugin.
pluginName := "testvol4"
diff --git a/test/e2e/volume_prune_test.go b/test/e2e/volume_prune_test.go
index 0b4c30a48..600f1b887 100644
--- a/test/e2e/volume_prune_test.go
+++ b/test/e2e/volume_prune_test.go
@@ -23,7 +23,6 @@ var _ = Describe("Podman volume prune", func() {
}
podmanTest = PodmanTestCreate(tempdir)
podmanTest.Setup()
- podmanTest.SeedImages()
})
AfterEach(func() {
diff --git a/test/e2e/volume_rm_test.go b/test/e2e/volume_rm_test.go
index 2a2de0920..0180b7a46 100644
--- a/test/e2e/volume_rm_test.go
+++ b/test/e2e/volume_rm_test.go
@@ -23,7 +23,6 @@ var _ = Describe("Podman volume rm", func() {
}
podmanTest = PodmanTestCreate(tempdir)
podmanTest.Setup()
- podmanTest.SeedImages()
})
AfterEach(func() {
diff --git a/test/e2e/wait_test.go b/test/e2e/wait_test.go
index 098780c70..16e876af9 100644
--- a/test/e2e/wait_test.go
+++ b/test/e2e/wait_test.go
@@ -23,7 +23,6 @@ var _ = Describe("Podman wait", func() {
}
podmanTest = PodmanTestCreate(tempdir)
podmanTest.Setup()
- podmanTest.SeedImages()
})
AfterEach(func() {
diff --git a/test/system/110-history.bats b/test/system/110-history.bats
index 0f6d75cb3..da6f2177c 100644
--- a/test/system/110-history.bats
+++ b/test/system/110-history.bats
@@ -55,4 +55,17 @@ size | -\\\?[0-9]\\\+
}
+@test "podman image history Created" {
+ # Values from image LIST
+ run_podman image list --format '{{.CreatedSince}}--{{.CreatedAt}}' $IMAGE
+ from_imagelist="$output"
+ assert "$from_imagelist" =~ "^[0-9].* ago--[0-9]+-[0-9]+-[0-9]+ [0-9:]+ " \
+ "CreatedSince and CreatedAt look reasonable"
+
+ # Values from image HISTORY
+ run_podman image history --format '{{.CreatedSince}}--{{.CreatedAt}}' $IMAGE
+ assert "${lines[0]}" == "$from_imagelist" \
+ "CreatedSince and CreatedAt from image history should == image list"
+}
+
# vim: filetype=sh
diff --git a/test/system/200-pod.bats b/test/system/200-pod.bats
index ef4bf1a6c..64f95f723 100644
--- a/test/system/200-pod.bats
+++ b/test/system/200-pod.bats
@@ -381,4 +381,32 @@ EOF
is "$output" ".*$container_3_ID.*"
}
+@test "podman pod create share net" {
+ run_podman pod create --name test
+ run_podman pod inspect test --format {{.InfraConfig.HostNetwork}}
+ is "$output" "false" "Default network sharing should be false"
+ run_podman pod rm test
+
+ run_podman pod create --name test --share ipc --network private
+ run_podman pod inspect test --format {{.InfraConfig.HostNetwork}}
+ is "$output" "false" "Private network sharing with only ipc should be false"
+ run_podman pod rm test
+
+ run_podman pod create --name test --share net --network private
+ run_podman pod inspect test --format {{.InfraConfig.HostNetwork}}
+ is "$output" "false" "Private network sharing with only net should be false"
+ run_podman pod rm test
+
+ run_podman pod create --name test --share net --network host
+ run_podman pod inspect test --format {{.InfraConfig.HostNetwork}}
+ is "$output" "true" "Host network sharing with only net should be true"
+ run_podman pod rm test
+
+ run_podman pod create --name test --share ipc --network host
+ run_podman pod inspect test --format {{.InfraConfig.HostNetwork}}
+ is "$output" "true" "Host network sharing with only ipc should be true"
+ run_podman pod rm test
+
+}
+
# vim: filetype=sh
diff --git a/test/system/500-networking.bats b/test/system/500-networking.bats
index 01571d176..3db0804d1 100644
--- a/test/system/500-networking.bats
+++ b/test/system/500-networking.bats
@@ -656,6 +656,15 @@ EOF
run_podman run --network $netname --rm $IMAGE cat /etc/resolv.conf
is "$output" "search dns.podman.*" "correct search domain"
is "$output" ".*nameserver $subnet.1.*" "integrated dns nameserver is set"
+
+ # host network should keep localhost nameservers
+ if grep 127.0.0. /etc/resolv.conf >/dev/null; then
+ run_podman run --network host --rm $IMAGE cat /etc/resolv.conf
+ is "$output" ".*nameserver 127\.0\.0.*" "resolv.conf contains localhost nameserver"
+ fi
+ # host net + dns still works
+ run_podman run --network host --dns 1.1.1.1 --rm $IMAGE cat /etc/resolv.conf
+ is "$output" ".*nameserver 1\.1\.1\.1.*" "resolv.conf contains 1.1.1.1 nameserver"
}
@test "podman run port forward range" {
@@ -723,4 +732,19 @@ EOF
is "${#lines[@]}" "5" "expect 5 host entries in /etc/hosts"
}
+@test "podman run /etc/* permissions" {
+ userns="--userns=keep-id"
+ if ! is_rootless; then
+ userns="--uidmap=0:1111111:65536 --gidmap=0:1111111:65536"
+ fi
+ # check with and without userns
+ for userns in "" "$userns"; do
+ # check the /etc/hosts /etc/hostname /etc/resolv.conf are owned by root
+ run_podman run $userns --rm $IMAGE stat -c %u:%g /etc/hosts /etc/resolv.conf /etc/hostname
+ is "${lines[0]}" "0\:0" "/etc/hosts owned by root"
+ is "${lines[1]}" "0\:0" "/etc/resolv.conf owned by root"
+ is "${lines[2]}" "0\:0" "/etc/hosts owned by root"
+ done
+}
+
# vim: filetype=sh
diff --git a/test/system/700-play.bats b/test/system/700-play.bats
index 8af4cd25b..b0624cbf2 100644
--- a/test/system/700-play.bats
+++ b/test/system/700-play.bats
@@ -233,3 +233,48 @@ _EOF
run_podman stop -a -t 0
run_podman pod rm -t 0 -f test_pod
}
+
+@test "podman play --annotation > Max" {
+ TESTDIR=$PODMAN_TMPDIR/testdir
+ RANDOMSTRING=$(random_string 65)
+ mkdir -p $TESTDIR
+ echo "$testYaml" | sed "s|TESTDIR|${TESTDIR}|g" > $PODMAN_TMPDIR/test.yaml
+ run_podman 125 play kube --annotation "name=$RANDOMSTRING" $PODMAN_TMPDIR/test.yaml
+ assert "$output" =~ "annotation exceeds maximum size, 63, of kubernetes annotation:" "Expected to fail with Length greater than 63"
+}
+
+@test "podman play Yaml with annotation > Max" {
+ RANDOMSTRING=$(random_string 65)
+ testBadYaml="
+apiVersion: v1
+kind: Pod
+metadata:
+ annotations:
+ test: ${RANDOMSTRING}
+ labels:
+ app: test
+ name: test_pod
+spec:
+ containers:
+ - command:
+ - id
+ env:
+ - name: PATH
+ value: /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
+ - name: TERM
+ value: xterm
+ - name: container
+
+ value: podman
+ image: quay.io/libpod/userimage
+ name: test
+ resources: {}
+status: {}
+"
+ TESTDIR=$PODMAN_TMPDIR/testdir
+ mkdir -p $TESTDIR
+ echo "$testBadYaml" | sed "s|TESTDIR|${TESTDIR}|g" > $PODMAN_TMPDIR/test.yaml
+
+ run_podman 125 play kube - < $PODMAN_TMPDIR/test.yaml
+ assert "$output" =~ "invalid annotation \"test\"=\"$RANDOMSTRING\"" "Expected to fail with annotation length greater than 63"
+}
diff --git a/test/test_podman_baseline.sh b/test/test_podman_baseline.sh
index 5a420fe60..5ef2d1bda 100755
--- a/test/test_podman_baseline.sh
+++ b/test/test_podman_baseline.sh
@@ -309,6 +309,28 @@ else
echo "Overlay test within limits failed"
fi
+before=`xfs_quota -x -c 'report -N -p' $TMPDIR | grep -c ^#`
+podman $PODMANBASE volume create -o o=noquota test-no-quota
+after=`xfs_quota -x -c 'report -N -p' $TMPDIR | grep -c ^#`
+
+if [ $before != $after ];
+then
+ echo "Test -o=noquota doesn't create a projid failed"
+else
+ echo "Test -o=noquota doesn't create a projid passed"
+fi
+
+before=`xfs_quota -x -c 'report -N -p' $TMPDIR | grep -c ^#`
+podman $PODMANBASE volume create -o test-no-quota
+after=`xfs_quota -x -c 'report -N -p' $TMPDIR | grep -c ^#`
+
+if [ $before == $after ];
+then
+ echo "Test without -o=noquota creates a projid failed"
+else
+ echo "Test without -o=noquota creates a projid passed"
+fi
+
########
# Expected to fail
########
diff --git a/test/utils/common_function_test.go b/test/utils/common_function_test.go
index a73d75490..7092e40a1 100644
--- a/test/utils/common_function_test.go
+++ b/test/utils/common_function_test.go
@@ -113,8 +113,10 @@ var _ = Describe("Common functions test", func() {
Expect(err).To(BeNil(), "Can not find the JSON file after we write it.")
defer read.Close()
- bytes, _ := ioutil.ReadAll(read)
- json.Unmarshal(bytes, compareData)
+ bytes, err := ioutil.ReadAll(read)
+ Expect(err).ToNot(HaveOccurred())
+ err = json.Unmarshal(bytes, compareData)
+ Expect(err).ToNot(HaveOccurred())
Expect(reflect.DeepEqual(testData, compareData)).To(BeTrue(), "Data changed after we store it to file.")
})
diff --git a/test/utils/podmantest_test.go b/test/utils/podmantest_test.go
index a9b5aef1f..26d359d38 100644
--- a/test/utils/podmantest_test.go
+++ b/test/utils/podmantest_test.go
@@ -1,8 +1,6 @@
package utils_test
import (
- "os"
-
. "github.com/containers/podman/v4/test/utils"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
@@ -19,16 +17,6 @@ var _ = Describe("PodmanTest test", func() {
FakeOutputs = make(map[string][]string)
})
- It("Test PodmanAsUserBase", func() {
- FakeOutputs["check"] = []string{"check"}
- os.Setenv("HOOK_OPTION", "hook_option")
- env := os.Environ()
- session := podmanTest.PodmanAsUserBase([]string{"check"}, 1000, 1000, "", env, true, false, nil, nil)
- os.Unsetenv("HOOK_OPTION")
- session.WaitWithDefaultTimeout()
- Expect(session.Command.Process).ShouldNot(BeNil())
- })
-
It("Test NumberOfContainersRunning", func() {
FakeOutputs["ps -q"] = []string{"one", "two"}
Expect(podmanTest.NumberOfContainersRunning()).To(Equal(2))
diff --git a/test/utils/utils.go b/test/utils/utils.go
index 0867570c1..36f5a9414 100644
--- a/test/utils/utils.go
+++ b/test/utils/utils.go
@@ -108,8 +108,8 @@ func (p *PodmanTest) PodmanAsUserBase(args []string, uid, gid uint32, cwd string
timeCmd := append([]string{"/usr/bin/time"}, timeArgs...)
wrapper = append(timeCmd, wrapper...)
}
-
- runCmd := append(wrapper, podmanBinary)
+ runCmd := wrapper
+ runCmd = append(runCmd, podmanBinary)
if !p.RemoteTest && p.NetworkBackend == Netavark {
runCmd = append(runCmd, []string{"--network-backend", "netavark"}...)
}
@@ -449,10 +449,10 @@ func GetHostDistributionInfo() HostOS {
host.Arch = runtime.GOARCH
for l.Scan() {
if strings.HasPrefix(l.Text(), "ID=") {
- host.Distribution = strings.Replace(strings.TrimSpace(strings.Join(strings.Split(l.Text(), "=")[1:], "")), "\"", "", -1)
+ host.Distribution = strings.ReplaceAll(strings.TrimSpace(strings.Join(strings.Split(l.Text(), "=")[1:], "")), "\"", "")
}
if strings.HasPrefix(l.Text(), "VERSION_ID=") {
- host.Version = strings.Replace(strings.TrimSpace(strings.Join(strings.Split(l.Text(), "=")[1:], "")), "\"", "", -1)
+ host.Version = strings.ReplaceAll(strings.TrimSpace(strings.Join(strings.Split(l.Text(), "=")[1:], "")), "\"", "")
}
}
return host
@@ -489,7 +489,9 @@ func IsCommandAvailable(command string) bool {
// WriteJSONFile write json format data to a json file
func WriteJSONFile(data []byte, filePath string) error {
var jsonData map[string]interface{}
- json.Unmarshal(data, &jsonData)
+ if err := json.Unmarshal(data, &jsonData); err != nil {
+ return err
+ }
formatJSON, err := json.MarshalIndent(jsonData, "", " ")
if err != nil {
return err
diff --git a/vendor/github.com/containernetworking/cni/libcni/conf.go b/vendor/github.com/containernetworking/cni/libcni/conf.go
index d28135ff3..3cd6a59d1 100644
--- a/vendor/github.com/containernetworking/cni/libcni/conf.go
+++ b/vendor/github.com/containernetworking/cni/libcni/conf.go
@@ -21,6 +21,8 @@ import (
"os"
"path/filepath"
"sort"
+
+ "github.com/containernetworking/cni/pkg/types"
)
type NotFoundError struct {
@@ -41,8 +43,8 @@ func (e NoConfigsFoundError) Error() string {
}
func ConfFromBytes(bytes []byte) (*NetworkConfig, error) {
- conf := &NetworkConfig{Bytes: bytes}
- if err := json.Unmarshal(bytes, &conf.Network); err != nil {
+ conf := &NetworkConfig{Bytes: bytes, Network: &types.NetConf{}}
+ if err := json.Unmarshal(bytes, conf.Network); err != nil {
return nil, fmt.Errorf("error parsing configuration: %w", err)
}
if conf.Network.Type == "" {
diff --git a/vendor/github.com/containernetworking/cni/pkg/version/plugin.go b/vendor/github.com/containernetworking/cni/pkg/version/plugin.go
index d4bc9d169..17b22b6b0 100644
--- a/vendor/github.com/containernetworking/cni/pkg/version/plugin.go
+++ b/vendor/github.com/containernetworking/cni/pkg/version/plugin.go
@@ -86,8 +86,8 @@ func (*PluginDecoder) Decode(jsonBytes []byte) (PluginInfo, error) {
// minor, and micro numbers or returns an error
func ParseVersion(version string) (int, int, int, error) {
var major, minor, micro int
- if version == "" {
- return -1, -1, -1, fmt.Errorf("invalid version %q: the version is empty", version)
+ if version == "" { // special case: no version declared == v0.1.0
+ return 0, 1, 0, nil
}
parts := strings.Split(version, ".")
diff --git a/vendor/github.com/fsnotify/fsnotify/CHANGELOG.md b/vendor/github.com/fsnotify/fsnotify/CHANGELOG.md
index a438fe4b4..cc01c08f5 100644
--- a/vendor/github.com/fsnotify/fsnotify/CHANGELOG.md
+++ b/vendor/github.com/fsnotify/fsnotify/CHANGELOG.md
@@ -7,9 +7,27 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## [Unreleased]
+## [1.5.4] - 2022-04-25
+
+* Windows: add missing defer to `Watcher.WatchList` [#447](https://github.com/fsnotify/fsnotify/pull/447)
+* go.mod: use latest x/sys [#444](https://github.com/fsnotify/fsnotify/pull/444)
+* Fix compilation for OpenBSD [#443](https://github.com/fsnotify/fsnotify/pull/443)
+
+## [1.5.3] - 2022-04-22
+
+* This version is retracted. An incorrect branch is published accidentally [#445](https://github.com/fsnotify/fsnotify/issues/445)
+
+## [1.5.2] - 2022-04-21
+
+* Add a feature to return the directories and files that are being monitored [#374](https://github.com/fsnotify/fsnotify/pull/374)
+* Fix potential crash on windows if `raw.FileNameLength` exceeds `syscall.MAX_PATH` [#361](https://github.com/fsnotify/fsnotify/pull/361)
+* Allow build on unsupported GOOS [#424](https://github.com/fsnotify/fsnotify/pull/424)
+* Don't set `poller.fd` twice in `newFdPoller` [#406](https://github.com/fsnotify/fsnotify/pull/406)
+* fix go vet warnings: call to `(*T).Fatalf` from a non-test goroutine [#416](https://github.com/fsnotify/fsnotify/pull/416)
+
## [1.5.1] - 2021-08-24
-* Revert Add AddRaw to not follow symlinks
+* Revert Add AddRaw to not follow symlinks [#394](https://github.com/fsnotify/fsnotify/pull/394)
## [1.5.0] - 2021-08-20
diff --git a/vendor/github.com/fsnotify/fsnotify/CONTRIBUTING.md b/vendor/github.com/fsnotify/fsnotify/CONTRIBUTING.md
index 828a60b24..8a642563d 100644
--- a/vendor/github.com/fsnotify/fsnotify/CONTRIBUTING.md
+++ b/vendor/github.com/fsnotify/fsnotify/CONTRIBUTING.md
@@ -48,18 +48,6 @@ fsnotify uses build tags to compile different code on Linux, BSD, macOS, and Win
Before doing a pull request, please do your best to test your changes on multiple platforms, and list which platforms you were able/unable to test on.
-To aid in cross-platform testing there is a Vagrantfile for Linux and BSD.
-
-* Install [Vagrant](http://www.vagrantup.com/) and [VirtualBox](https://www.virtualbox.org/)
-* Setup [Vagrant Gopher](https://github.com/nathany/vagrant-gopher) in your `src` folder.
-* Run `vagrant up` from the project folder. You can also setup just one box with `vagrant up linux` or `vagrant up bsd` (note: the BSD box doesn't support Windows hosts at this time, and NFS may prompt for your host OS password)
-* Once setup, you can run the test suite on a given OS with a single command `vagrant ssh linux -c 'cd fsnotify/fsnotify; go test'`.
-* When you're done, you will want to halt or destroy the Vagrant boxes.
-
-Notice: fsnotify file system events won't trigger in shared folders. The tests get around this limitation by using the /tmp directory.
-
-Right now there is no equivalent solution for Windows and macOS, but there are Windows VMs [freely available from Microsoft](http://www.modern.ie/en-us/virtualization-tools#downloads).
-
### Maintainers
Help maintaining fsnotify is welcome. To be a maintainer:
@@ -67,11 +55,6 @@ Help maintaining fsnotify is welcome. To be a maintainer:
* Submit a pull request and sign the CLA as above.
* You must be able to run the test suite on Mac, Windows, Linux and BSD.
-To keep master clean, the fsnotify project uses the "apply mail" workflow outlined in Nathaniel Talbott's post ["Merge pull request" Considered Harmful][am]. This requires installing [hub][].
-
All code changes should be internal pull requests.
Releases are tagged using [Semantic Versioning](http://semver.org/).
-
-[hub]: https://github.com/github/hub
-[am]: http://blog.spreedly.com/2014/06/24/merge-pull-request-considered-harmful/#.VGa5yZPF_Zs
diff --git a/vendor/github.com/fsnotify/fsnotify/README.md b/vendor/github.com/fsnotify/fsnotify/README.md
index 34488e621..0731c5ef8 100644
--- a/vendor/github.com/fsnotify/fsnotify/README.md
+++ b/vendor/github.com/fsnotify/fsnotify/README.md
@@ -1,40 +1,120 @@
-# WARNING
+# File system notifications for Go
-If you are reading this, you use `master` branch of this repository,
-which is wrong.
+[![Go Reference](https://pkg.go.dev/badge/github.com/fsnotify/fsnotify.svg)](https://pkg.go.dev/github.com/fsnotify/fsnotify) [![Go Report Card](https://goreportcard.com/badge/github.com/fsnotify/fsnotify)](https://goreportcard.com/report/github.com/fsnotify/fsnotify) [![Maintainers Wanted](https://img.shields.io/badge/maintainers-wanted-red.svg)](https://github.com/fsnotify/fsnotify/issues/413)
-This branch
- - should not be used;
- - is not maintained;
- - is not supported;
- - will be removed soon.
+fsnotify utilizes [`golang.org/x/sys`](https://pkg.go.dev/golang.org/x/sys) rather than [`syscall`](https://pkg.go.dev/syscall) from the standard library.
-You should switch to using the default branch instead.
+Cross platform: Windows, Linux, BSD and macOS.
-## Using git
+| Adapter | OS | Status |
+| --------------------- | -------------------------------- | ------------------------------------------------------------------------------------------------------------------------------- |
+| inotify | Linux 2.6.27 or later, Android\* | Supported |
+| kqueue | BSD, macOS, iOS\* | Supported |
+| ReadDirectoryChangesW | Windows | Supported |
+| FSEvents | macOS | [Planned](https://github.com/fsnotify/fsnotify/issues/11) |
+| FEN | Solaris 11 | [In Progress](https://github.com/fsnotify/fsnotify/pull/371) |
+| fanotify | Linux 2.6.37+ | [Maybe](https://github.com/fsnotify/fsnotify/issues/114) |
+| USN Journals | Windows | [Maybe](https://github.com/fsnotify/fsnotify/issues/53) |
+| Polling | *All* | [Maybe](https://github.com/fsnotify/fsnotify/issues/9) |
-Here's how to switch your existing local copy of this repository from `master`
-to `main` (assuming the remote name is `origin`):
+\* Android and iOS are untested.
-```
-git branch -m master main
-git fetch origin
-git branch -u origin/main main
-git remote set-head origin -a
-```
+Please see [the documentation](https://pkg.go.dev/github.com/fsnotify/fsnotify) and consult the [FAQ](#faq) for usage information.
-In addition to the above, if you want to remove the leftover `origin/master`
-remote branch (NOTE this also removes all other remote branches that no longer
-exist in `origin`):
+## API stability
+fsnotify is a fork of [howeyc/fsnotify](https://github.com/howeyc/fsnotify) with a new API as of v1.0. The API is based on [this design document](http://goo.gl/MrYxyA).
+
+All [releases](https://github.com/fsnotify/fsnotify/releases) are tagged based on [Semantic Versioning](http://semver.org/).
+
+## Usage
+
+```go
+package main
+
+import (
+ "log"
+
+ "github.com/fsnotify/fsnotify"
+)
+
+func main() {
+ watcher, err := fsnotify.NewWatcher()
+ if err != nil {
+ log.Fatal(err)
+ }
+ defer watcher.Close()
+
+ done := make(chan bool)
+ go func() {
+ for {
+ select {
+ case event, ok := <-watcher.Events:
+ if !ok {
+ return
+ }
+ log.Println("event:", event)
+ if event.Op&fsnotify.Write == fsnotify.Write {
+ log.Println("modified file:", event.Name)
+ }
+ case err, ok := <-watcher.Errors:
+ if !ok {
+ return
+ }
+ log.Println("error:", err)
+ }
+ }
+ }()
+
+ err = watcher.Add("/tmp/foo")
+ if err != nil {
+ log.Fatal(err)
+ }
+ <-done
+}
```
-git remote prune origin
-```
-## Background
+## Contributing
+
+Please refer to [CONTRIBUTING][] before opening an issue or pull request.
+
+## FAQ
+
+**When a file is moved to another directory is it still being watched?**
+
+No (it shouldn't be, unless you are watching where it was moved to).
+
+**When I watch a directory, are all subdirectories watched as well?**
+
+No, you must add watches for any directory you want to watch (a recursive watcher is on the roadmap [#18][]).
+
+**Do I have to watch the Error and Event channels in a separate goroutine?**
+
+As of now, yes. Looking into making this single-thread friendly (see [howeyc #7][#7])
+
+**Why am I receiving multiple events for the same file on OS X?**
+
+Spotlight indexing on OS X can result in multiple events (see [howeyc #62][#62]). A temporary workaround is to add your folder(s) to the *Spotlight Privacy settings* until we have a native FSEvents implementation (see [#11][]).
+
+**How many files can be watched at once?**
+
+There are OS-specific limits as to how many watches can be created:
+* Linux: /proc/sys/fs/inotify/max_user_watches contains the limit, reaching this limit results in a "no space left on device" error.
+* BSD / OSX: sysctl variables "kern.maxfiles" and "kern.maxfilesperproc", reaching these limits results in a "too many open files" error.
+
+**Why don't notifications work with NFS filesystems or filesystem in userspace (FUSE)?**
+
+fsnotify requires support from underlying OS to work. The current NFS protocol does not provide network level support for file notifications.
+
+[#62]: https://github.com/howeyc/fsnotify/issues/62
+[#18]: https://github.com/fsnotify/fsnotify/issues/18
+[#11]: https://github.com/fsnotify/fsnotify/issues/11
+[#7]: https://github.com/howeyc/fsnotify/issues/7
+
+[contributing]: https://github.com/fsnotify/fsnotify/blob/master/CONTRIBUTING.md
+
+## Related Projects
-The `master` branch was renamed to `main`, causing an issue with
-Yocto/OpenEmbedded's meta-virtualization layer, which explicitly refers
-to `master` branch of this repository (see #426).
+* [notify](https://github.com/rjeczalik/notify)
+* [fsevents](https://github.com/fsnotify/fsevents)
-This temporary branch is created to alleviate the Yocto/OE issue.
diff --git a/vendor/github.com/fsnotify/fsnotify/fsnotify_unsupported.go b/vendor/github.com/fsnotify/fsnotify/fsnotify_unsupported.go
new file mode 100644
index 000000000..596885598
--- /dev/null
+++ b/vendor/github.com/fsnotify/fsnotify/fsnotify_unsupported.go
@@ -0,0 +1,36 @@
+// Copyright 2022 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+//go:build !darwin && !dragonfly && !freebsd && !openbsd && !linux && !netbsd && !solaris && !windows
+// +build !darwin,!dragonfly,!freebsd,!openbsd,!linux,!netbsd,!solaris,!windows
+
+package fsnotify
+
+import (
+ "fmt"
+ "runtime"
+)
+
+// Watcher watches a set of files, delivering events to a channel.
+type Watcher struct{}
+
+// NewWatcher establishes a new watcher with the underlying OS and begins waiting for events.
+func NewWatcher() (*Watcher, error) {
+ return nil, fmt.Errorf("fsnotify not supported on %s", runtime.GOOS)
+}
+
+// Close removes all watches and closes the events channel.
+func (w *Watcher) Close() error {
+ return nil
+}
+
+// Add starts watching the named file or directory (non-recursively).
+func (w *Watcher) Add(name string) error {
+ return nil
+}
+
+// Remove stops watching the the named file or directory (non-recursively).
+func (w *Watcher) Remove(name string) error {
+ return nil
+}
diff --git a/vendor/github.com/fsnotify/fsnotify/go.mod b/vendor/github.com/fsnotify/fsnotify/go.mod
index 54089e48b..48cfd07fe 100644
--- a/vendor/github.com/fsnotify/fsnotify/go.mod
+++ b/vendor/github.com/fsnotify/fsnotify/go.mod
@@ -1,7 +1,10 @@
module github.com/fsnotify/fsnotify
-go 1.13
+go 1.16
-require golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c
+require golang.org/x/sys v0.0.0-20220412211240-33da011f77ad
-retract v1.5.0
+retract (
+ v1.5.3 // Published an incorrect branch accidentally https://github.com/fsnotify/fsnotify/issues/445
+ v1.5.0 // Contains symlink regression https://github.com/fsnotify/fsnotify/pull/394
+)
diff --git a/vendor/github.com/fsnotify/fsnotify/go.sum b/vendor/github.com/fsnotify/fsnotify/go.sum
index 0f478630c..7f2d82d5c 100644
--- a/vendor/github.com/fsnotify/fsnotify/go.sum
+++ b/vendor/github.com/fsnotify/fsnotify/go.sum
@@ -1,2 +1,2 @@
-golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c h1:F1jZWGFhYfh0Ci55sIpILtKKK8p3i2/krTr0H1rg74I=
-golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
+golang.org/x/sys v0.0.0-20220412211240-33da011f77ad h1:ntjMns5wyP/fN65tdBD4g8J5w8n015+iIIs9rtjXkY0=
+golang.org/x/sys v0.0.0-20220412211240-33da011f77ad/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
diff --git a/vendor/github.com/fsnotify/fsnotify/inotify.go b/vendor/github.com/fsnotify/fsnotify/inotify.go
index eb87699b5..a6d0e0ec8 100644
--- a/vendor/github.com/fsnotify/fsnotify/inotify.go
+++ b/vendor/github.com/fsnotify/fsnotify/inotify.go
@@ -163,6 +163,19 @@ func (w *Watcher) Remove(name string) error {
return nil
}
+// WatchList returns the directories and files that are being monitered.
+func (w *Watcher) WatchList() []string {
+ w.mu.Lock()
+ defer w.mu.Unlock()
+
+ entries := make([]string, 0, len(w.watches))
+ for pathname := range w.watches {
+ entries = append(entries, pathname)
+ }
+
+ return entries
+}
+
type watch struct {
wd uint32 // Watch descriptor (as returned by the inotify_add_watch() syscall)
flags uint32 // inotify flags of this watch (see inotify(7) for the list of valid flags)
diff --git a/vendor/github.com/fsnotify/fsnotify/inotify_poller.go b/vendor/github.com/fsnotify/fsnotify/inotify_poller.go
index e9ff9439f..b572a37c3 100644
--- a/vendor/github.com/fsnotify/fsnotify/inotify_poller.go
+++ b/vendor/github.com/fsnotify/fsnotify/inotify_poller.go
@@ -38,7 +38,6 @@ func newFdPoller(fd int) (*fdPoller, error) {
poller.close()
}
}()
- poller.fd = fd
// Create epoll fd
poller.epfd, errno = unix.EpollCreate1(unix.EPOLL_CLOEXEC)
diff --git a/vendor/github.com/fsnotify/fsnotify/kqueue.go b/vendor/github.com/fsnotify/fsnotify/kqueue.go
index 368f5b790..6fb8d8532 100644
--- a/vendor/github.com/fsnotify/fsnotify/kqueue.go
+++ b/vendor/github.com/fsnotify/fsnotify/kqueue.go
@@ -148,6 +148,19 @@ func (w *Watcher) Remove(name string) error {
return nil
}
+// WatchList returns the directories and files that are being monitered.
+func (w *Watcher) WatchList() []string {
+ w.mu.Lock()
+ defer w.mu.Unlock()
+
+ entries := make([]string, 0, len(w.watches))
+ for pathname := range w.watches {
+ entries = append(entries, pathname)
+ }
+
+ return entries
+}
+
// Watch all events (except NOTE_EXTEND, NOTE_LINK, NOTE_REVOKE)
const noteAllEvents = unix.NOTE_DELETE | unix.NOTE_WRITE | unix.NOTE_ATTRIB | unix.NOTE_RENAME
diff --git a/vendor/github.com/fsnotify/fsnotify/windows.go b/vendor/github.com/fsnotify/fsnotify/windows.go
index c02b75f7c..02ce7deb0 100644
--- a/vendor/github.com/fsnotify/fsnotify/windows.go
+++ b/vendor/github.com/fsnotify/fsnotify/windows.go
@@ -12,6 +12,7 @@ import (
"fmt"
"os"
"path/filepath"
+ "reflect"
"runtime"
"sync"
"syscall"
@@ -96,6 +97,21 @@ func (w *Watcher) Remove(name string) error {
return <-in.reply
}
+// WatchList returns the directories and files that are being monitered.
+func (w *Watcher) WatchList() []string {
+ w.mu.Lock()
+ defer w.mu.Unlock()
+
+ entries := make([]string, 0, len(w.watches))
+ for _, entry := range w.watches {
+ for _, watchEntry := range entry {
+ entries = append(entries, watchEntry.path)
+ }
+ }
+
+ return entries
+}
+
const (
// Options for AddWatch
sysFSONESHOT = 0x80000000
@@ -452,8 +468,16 @@ func (w *Watcher) readEvents() {
// Point "raw" to the event in the buffer
raw := (*syscall.FileNotifyInformation)(unsafe.Pointer(&watch.buf[offset]))
- buf := (*[syscall.MAX_PATH]uint16)(unsafe.Pointer(&raw.FileName))
- name := syscall.UTF16ToString(buf[:raw.FileNameLength/2])
+ // TODO: Consider using unsafe.Slice that is available from go1.17
+ // https://stackoverflow.com/questions/51187973/how-to-create-an-array-or-a-slice-from-an-array-unsafe-pointer-in-golang
+ // instead of using a fixed syscall.MAX_PATH buf, we create a buf that is the size of the path name
+ size := int(raw.FileNameLength / 2)
+ var buf []uint16
+ sh := (*reflect.SliceHeader)(unsafe.Pointer(&buf))
+ sh.Data = uintptr(unsafe.Pointer(&raw.FileName))
+ sh.Len = size
+ sh.Cap = size
+ name := syscall.UTF16ToString(buf)
fullname := filepath.Join(watch.path, name)
var mask uint64
diff --git a/vendor/github.com/mrunalp/fileutils/.gitignore b/vendor/github.com/mrunalp/fileutils/.gitignore
deleted file mode 100644
index aac977bca..000000000
--- a/vendor/github.com/mrunalp/fileutils/.gitignore
+++ /dev/null
@@ -1 +0,0 @@
-/gocp
diff --git a/vendor/github.com/mrunalp/fileutils/LICENSE b/vendor/github.com/mrunalp/fileutils/LICENSE
deleted file mode 100644
index 27448585a..000000000
--- a/vendor/github.com/mrunalp/fileutils/LICENSE
+++ /dev/null
@@ -1,191 +0,0 @@
-
- Apache License
- Version 2.0, January 2004
- http://www.apache.org/licenses/
-
- TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
-
- 1. Definitions.
-
- "License" shall mean the terms and conditions for use, reproduction,
- and distribution as defined by Sections 1 through 9 of this document.
-
- "Licensor" shall mean the copyright owner or entity authorized by
- the copyright owner that is granting the License.
-
- "Legal Entity" shall mean the union of the acting entity and all
- other entities that control, are controlled by, or are under common
- control with that entity. For the purposes of this definition,
- "control" means (i) the power, direct or indirect, to cause the
- direction or management of such entity, whether by contract or
- otherwise, or (ii) ownership of fifty percent (50%) or more of the
- outstanding shares, or (iii) beneficial ownership of such entity.
-
- "You" (or "Your") shall mean an individual or Legal Entity
- exercising permissions granted by this License.
-
- "Source" form shall mean the preferred form for making modifications,
- including but not limited to software source code, documentation
- source, and configuration files.
-
- "Object" form shall mean any form resulting from mechanical
- transformation or translation of a Source form, including but
- not limited to compiled object code, generated documentation,
- and conversions to other media types.
-
- "Work" shall mean the work of authorship, whether in Source or
- Object form, made available under the License, as indicated by a
- copyright notice that is included in or attached to the work
- (an example is provided in the Appendix below).
-
- "Derivative Works" shall mean any work, whether in Source or Object
- form, that is based on (or derived from) the Work and for which the
- editorial revisions, annotations, elaborations, or other modifications
- represent, as a whole, an original work of authorship. For the purposes
- of this License, Derivative Works shall not include works that remain
- separable from, or merely link (or bind by name) to the interfaces of,
- the Work and Derivative Works thereof.
-
- "Contribution" shall mean any work of authorship, including
- the original version of the Work and any modifications or additions
- to that Work or Derivative Works thereof, that is intentionally
- submitted to Licensor for inclusion in the Work by the copyright owner
- or by an individual or Legal Entity authorized to submit on behalf of
- the copyright owner. For the purposes of this definition, "submitted"
- means any form of electronic, verbal, or written communication sent
- to the Licensor or its representatives, including but not limited to
- communication on electronic mailing lists, source code control systems,
- and issue tracking systems that are managed by, or on behalf of, the
- Licensor for the purpose of discussing and improving the Work, but
- excluding communication that is conspicuously marked or otherwise
- designated in writing by the copyright owner as "Not a Contribution."
-
- "Contributor" shall mean Licensor and any individual or Legal Entity
- on behalf of whom a Contribution has been received by Licensor and
- subsequently incorporated within the Work.
-
- 2. Grant of Copyright License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- copyright license to reproduce, prepare Derivative Works of,
- publicly display, publicly perform, sublicense, and distribute the
- Work and such Derivative Works in Source or Object form.
-
- 3. Grant of Patent License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- (except as stated in this section) patent license to make, have made,
- use, offer to sell, sell, import, and otherwise transfer the Work,
- where such license applies only to those patent claims licensable
- by such Contributor that are necessarily infringed by their
- Contribution(s) alone or by combination of their Contribution(s)
- with the Work to which such Contribution(s) was submitted. If You
- institute patent litigation against any entity (including a
- cross-claim or counterclaim in a lawsuit) alleging that the Work
- or a Contribution incorporated within the Work constitutes direct
- or contributory patent infringement, then any patent licenses
- granted to You under this License for that Work shall terminate
- as of the date such litigation is filed.
-
- 4. Redistribution. You may reproduce and distribute copies of the
- Work or Derivative Works thereof in any medium, with or without
- modifications, and in Source or Object form, provided that You
- meet the following conditions:
-
- (a) You must give any other recipients of the Work or
- Derivative Works a copy of this License; and
-
- (b) You must cause any modified files to carry prominent notices
- stating that You changed the files; and
-
- (c) You must retain, in the Source form of any Derivative Works
- that You distribute, all copyright, patent, trademark, and
- attribution notices from the Source form of the Work,
- excluding those notices that do not pertain to any part of
- the Derivative Works; and
-
- (d) If the Work includes a "NOTICE" text file as part of its
- distribution, then any Derivative Works that You distribute must
- include a readable copy of the attribution notices contained
- within such NOTICE file, excluding those notices that do not
- pertain to any part of the Derivative Works, in at least one
- of the following places: within a NOTICE text file distributed
- as part of the Derivative Works; within the Source form or
- documentation, if provided along with the Derivative Works; or,
- within a display generated by the Derivative Works, if and
- wherever such third-party notices normally appear. The contents
- of the NOTICE file are for informational purposes only and
- do not modify the License. You may add Your own attribution
- notices within Derivative Works that You distribute, alongside
- or as an addendum to the NOTICE text from the Work, provided
- that such additional attribution notices cannot be construed
- as modifying the License.
-
- You may add Your own copyright statement to Your modifications and
- may provide additional or different license terms and conditions
- for use, reproduction, or distribution of Your modifications, or
- for any such Derivative Works as a whole, provided Your use,
- reproduction, and distribution of the Work otherwise complies with
- the conditions stated in this License.
-
- 5. Submission of Contributions. Unless You explicitly state otherwise,
- any Contribution intentionally submitted for inclusion in the Work
- by You to the Licensor shall be under the terms and conditions of
- this License, without any additional terms or conditions.
- Notwithstanding the above, nothing herein shall supersede or modify
- the terms of any separate license agreement you may have executed
- with Licensor regarding such Contributions.
-
- 6. Trademarks. This License does not grant permission to use the trade
- names, trademarks, service marks, or product names of the Licensor,
- except as required for reasonable and customary use in describing the
- origin of the Work and reproducing the content of the NOTICE file.
-
- 7. Disclaimer of Warranty. Unless required by applicable law or
- agreed to in writing, Licensor provides the Work (and each
- Contributor provides its Contributions) on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
- implied, including, without limitation, any warranties or conditions
- of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
- PARTICULAR PURPOSE. You are solely responsible for determining the
- appropriateness of using or redistributing the Work and assume any
- risks associated with Your exercise of permissions under this License.
-
- 8. Limitation of Liability. In no event and under no legal theory,
- whether in tort (including negligence), contract, or otherwise,
- unless required by applicable law (such as deliberate and grossly
- negligent acts) or agreed to in writing, shall any Contributor be
- liable to You for damages, including any direct, indirect, special,
- incidental, or consequential damages of any character arising as a
- result of this License or out of the use or inability to use the
- Work (including but not limited to damages for loss of goodwill,
- work stoppage, computer failure or malfunction, or any and all
- other commercial damages or losses), even if such Contributor
- has been advised of the possibility of such damages.
-
- 9. Accepting Warranty or Additional Liability. While redistributing
- the Work or Derivative Works thereof, You may choose to offer,
- and charge a fee for, acceptance of support, warranty, indemnity,
- or other liability obligations and/or rights consistent with this
- License. However, in accepting such obligations, You may act only
- on Your own behalf and on Your sole responsibility, not on behalf
- of any other Contributor, and only if You agree to indemnify,
- defend, and hold each Contributor harmless for any liability
- incurred by, or claims asserted against, such Contributor by reason
- of your accepting any such warranty or additional liability.
-
- END OF TERMS AND CONDITIONS
-
- Copyright 2014 Docker, Inc.
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
diff --git a/vendor/github.com/mrunalp/fileutils/MAINTAINERS b/vendor/github.com/mrunalp/fileutils/MAINTAINERS
deleted file mode 100644
index 4a2cafa5c..000000000
--- a/vendor/github.com/mrunalp/fileutils/MAINTAINERS
+++ /dev/null
@@ -1 +0,0 @@
-Mrunal Patel <mrunalp@gmail.com> (@mrunalp)
diff --git a/vendor/github.com/mrunalp/fileutils/README.md b/vendor/github.com/mrunalp/fileutils/README.md
deleted file mode 100644
index 6cb4140ea..000000000
--- a/vendor/github.com/mrunalp/fileutils/README.md
+++ /dev/null
@@ -1,5 +0,0 @@
-# fileutils
-
-Collection of utilities for file manipulation in golang
-
-The library is based on docker pkg/archive pkg/idtools but does copies instead of handling archive formats.
diff --git a/vendor/github.com/mrunalp/fileutils/fileutils.go b/vendor/github.com/mrunalp/fileutils/fileutils.go
deleted file mode 100644
index 7421e6207..000000000
--- a/vendor/github.com/mrunalp/fileutils/fileutils.go
+++ /dev/null
@@ -1,168 +0,0 @@
-package fileutils
-
-import (
- "fmt"
- "io"
- "os"
- "path/filepath"
- "syscall"
-)
-
-// CopyFile copies the file at source to dest
-func CopyFile(source string, dest string) error {
- si, err := os.Lstat(source)
- if err != nil {
- return err
- }
-
- st, ok := si.Sys().(*syscall.Stat_t)
- if !ok {
- return fmt.Errorf("could not convert to syscall.Stat_t")
- }
-
- uid := int(st.Uid)
- gid := int(st.Gid)
- modeType := si.Mode() & os.ModeType
-
- // Handle symlinks
- if modeType == os.ModeSymlink {
- target, err := os.Readlink(source)
- if err != nil {
- return err
- }
- if err := os.Symlink(target, dest); err != nil {
- return err
- }
- }
-
- // Handle device files
- if modeType == os.ModeDevice {
- devMajor := int64(major(uint64(st.Rdev)))
- devMinor := int64(minor(uint64(st.Rdev)))
- mode := uint32(si.Mode() & os.ModePerm)
- if si.Mode()&os.ModeCharDevice != 0 {
- mode |= syscall.S_IFCHR
- } else {
- mode |= syscall.S_IFBLK
- }
- if err := syscall.Mknod(dest, mode, int(mkdev(devMajor, devMinor))); err != nil {
- return err
- }
- }
-
- // Handle regular files
- if si.Mode().IsRegular() {
- err = copyInternal(source, dest)
- if err != nil {
- return err
- }
- }
-
- // Chown the file
- if err := os.Lchown(dest, uid, gid); err != nil {
- return err
- }
-
- // Chmod the file
- if !(modeType == os.ModeSymlink) {
- if err := os.Chmod(dest, si.Mode()); err != nil {
- return err
- }
- }
-
- return nil
-}
-
-func copyInternal(source, dest string) (retErr error) {
- sf, err := os.Open(source)
- if err != nil {
- return err
- }
- defer sf.Close()
-
- df, err := os.Create(dest)
- if err != nil {
- return err
- }
- defer func() {
- err := df.Close()
- if retErr == nil {
- retErr = err
- }
- }()
-
- _, err = io.Copy(df, sf)
- return err
-}
-
-// CopyDirectory copies the files under the source directory
-// to dest directory. The dest directory is created if it
-// does not exist.
-func CopyDirectory(source string, dest string) error {
- fi, err := os.Stat(source)
- if err != nil {
- return err
- }
-
- // Get owner.
- st, ok := fi.Sys().(*syscall.Stat_t)
- if !ok {
- return fmt.Errorf("could not convert to syscall.Stat_t")
- }
-
- // We have to pick an owner here anyway.
- if err := MkdirAllNewAs(dest, fi.Mode(), int(st.Uid), int(st.Gid)); err != nil {
- return err
- }
-
- return filepath.Walk(source, func(path string, info os.FileInfo, err error) error {
- if err != nil {
- return err
- }
-
- // Get the relative path
- relPath, err := filepath.Rel(source, path)
- if err != nil {
- return nil
- }
-
- if info.IsDir() {
- // Skip the source directory.
- if path != source {
- // Get the owner.
- st, ok := info.Sys().(*syscall.Stat_t)
- if !ok {
- return fmt.Errorf("could not convert to syscall.Stat_t")
- }
-
- uid := int(st.Uid)
- gid := int(st.Gid)
-
- if err := os.Mkdir(filepath.Join(dest, relPath), info.Mode()); err != nil {
- return err
- }
-
- if err := os.Lchown(filepath.Join(dest, relPath), uid, gid); err != nil {
- return err
- }
- }
- return nil
- }
-
- return CopyFile(path, filepath.Join(dest, relPath))
- })
-}
-
-// Gives a number indicating the device driver to be used to access the passed device
-func major(device uint64) uint64 {
- return (device >> 8) & 0xfff
-}
-
-// Gives a number that serves as a flag to the device driver for the passed device
-func minor(device uint64) uint64 {
- return (device & 0xff) | ((device >> 12) & 0xfff00)
-}
-
-func mkdev(major int64, minor int64) uint32 {
- return uint32(((minor & 0xfff00) << 12) | ((major & 0xfff) << 8) | (minor & 0xff))
-}
diff --git a/vendor/github.com/mrunalp/fileutils/go.mod b/vendor/github.com/mrunalp/fileutils/go.mod
deleted file mode 100644
index d8971cabc..000000000
--- a/vendor/github.com/mrunalp/fileutils/go.mod
+++ /dev/null
@@ -1,3 +0,0 @@
-module github.com/mrunalp/fileutils
-
-go 1.13
diff --git a/vendor/github.com/mrunalp/fileutils/idtools.go b/vendor/github.com/mrunalp/fileutils/idtools.go
deleted file mode 100644
index bad6539df..000000000
--- a/vendor/github.com/mrunalp/fileutils/idtools.go
+++ /dev/null
@@ -1,54 +0,0 @@
-package fileutils
-
-import (
- "os"
- "path/filepath"
- "syscall"
-)
-
-// MkdirAllNewAs creates a directory (include any along the path) and then modifies
-// ownership ONLY of newly created directories to the requested uid/gid. If the
-// directories along the path exist, no change of ownership will be performed
-func MkdirAllNewAs(path string, mode os.FileMode, ownerUID, ownerGID int) error {
- // make an array containing the original path asked for, plus (for mkAll == true)
- // all path components leading up to the complete path that don't exist before we MkdirAll
- // so that we can chown all of them properly at the end. If chownExisting is false, we won't
- // chown the full directory path if it exists
- var paths []string
- st, err := os.Stat(path)
- if err != nil && os.IsNotExist(err) {
- paths = []string{path}
- } else if err == nil {
- if !st.IsDir() {
- return &os.PathError{Op: "mkdir", Path: path, Err: syscall.ENOTDIR}
- }
- // nothing to do; directory path fully exists already
- return nil
- }
-
- // walk back to "/" looking for directories which do not exist
- // and add them to the paths array for chown after creation
- dirPath := path
- for {
- dirPath = filepath.Dir(dirPath)
- if dirPath == "/" {
- break
- }
- if _, err := os.Stat(dirPath); err != nil && os.IsNotExist(err) {
- paths = append(paths, dirPath)
- }
- }
-
- if err := os.MkdirAll(path, mode); err != nil {
- return err
- }
-
- // even if it existed, we will chown the requested path + any subpaths that
- // didn't exist when we called MkdirAll
- for _, pathComponent := range paths {
- if err := os.Chown(pathComponent, ownerUID, ownerGID); err != nil {
- return err
- }
- }
- return nil
-}
diff --git a/vendor/golang.org/x/sys/cpu/byteorder.go b/vendor/golang.org/x/sys/cpu/byteorder.go
index dcbb14ef3..271055be0 100644
--- a/vendor/golang.org/x/sys/cpu/byteorder.go
+++ b/vendor/golang.org/x/sys/cpu/byteorder.go
@@ -46,6 +46,7 @@ func hostByteOrder() byteOrder {
case "386", "amd64", "amd64p32",
"alpha",
"arm", "arm64",
+ "loong64",
"mipsle", "mips64le", "mips64p32le",
"nios2",
"ppc64le",
diff --git a/vendor/golang.org/x/sys/cpu/cpu_loong64.go b/vendor/golang.org/x/sys/cpu/cpu_loong64.go
new file mode 100644
index 000000000..0f57b05bd
--- /dev/null
+++ b/vendor/golang.org/x/sys/cpu/cpu_loong64.go
@@ -0,0 +1,13 @@
+// Copyright 2022 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+//go:build loong64
+// +build loong64
+
+package cpu
+
+const cacheLineSize = 64
+
+func initOptions() {
+}
diff --git a/vendor/golang.org/x/sys/unix/asm_linux_loong64.s b/vendor/golang.org/x/sys/unix/asm_linux_loong64.s
new file mode 100644
index 000000000..6abd48eef
--- /dev/null
+++ b/vendor/golang.org/x/sys/unix/asm_linux_loong64.s
@@ -0,0 +1,54 @@
+// Copyright 2022 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+//go:build linux && loong64 && gc
+// +build linux
+// +build loong64
+// +build gc
+
+#include "textflag.h"
+
+
+// Just jump to package syscall's implementation for all these functions.
+// The runtime may know about them.
+
+TEXT ·Syscall(SB),NOSPLIT,$0-56
+ JMP syscall·Syscall(SB)
+
+TEXT ·Syscall6(SB),NOSPLIT,$0-80
+ JMP syscall·Syscall6(SB)
+
+TEXT ·SyscallNoError(SB),NOSPLIT,$0-48
+ JAL runtime·entersyscall(SB)
+ MOVV a1+8(FP), R4
+ MOVV a2+16(FP), R5
+ MOVV a3+24(FP), R6
+ MOVV R0, R7
+ MOVV R0, R8
+ MOVV R0, R9
+ MOVV trap+0(FP), R11 // syscall entry
+ SYSCALL
+ MOVV R4, r1+32(FP)
+ MOVV R5, r2+40(FP)
+ JAL runtime·exitsyscall(SB)
+ RET
+
+TEXT ·RawSyscall(SB),NOSPLIT,$0-56
+ JMP syscall·RawSyscall(SB)
+
+TEXT ·RawSyscall6(SB),NOSPLIT,$0-80
+ JMP syscall·RawSyscall6(SB)
+
+TEXT ·RawSyscallNoError(SB),NOSPLIT,$0-48
+ MOVV a1+8(FP), R4
+ MOVV a2+16(FP), R5
+ MOVV a3+24(FP), R6
+ MOVV R0, R7
+ MOVV R0, R8
+ MOVV R0, R9
+ MOVV trap+0(FP), R11 // syscall entry
+ SYSCALL
+ MOVV R4, r1+32(FP)
+ MOVV R5, r2+40(FP)
+ RET
diff --git a/vendor/golang.org/x/sys/unix/mkerrors.sh b/vendor/golang.org/x/sys/unix/mkerrors.sh
index a03708748..d888fb770 100644
--- a/vendor/golang.org/x/sys/unix/mkerrors.sh
+++ b/vendor/golang.org/x/sys/unix/mkerrors.sh
@@ -215,6 +215,7 @@ struct ltchars {
#include <linux/ethtool_netlink.h>
#include <linux/falloc.h>
#include <linux/fanotify.h>
+#include <linux/fib_rules.h>
#include <linux/filter.h>
#include <linux/fs.h>
#include <linux/fscrypt.h>
@@ -603,6 +604,7 @@ ccflags="$@"
$2 ~ /^ITIMER_/ ||
$2 !~ "WMESGLEN" &&
$2 ~ /^W[A-Z0-9]+$/ ||
+ $2 ~ /^P_/ ||
$2 ~/^PPPIOC/ ||
$2 ~ /^FAN_|FANOTIFY_/ ||
$2 == "HID_MAX_DESCRIPTOR_SIZE" ||
@@ -612,6 +614,7 @@ ccflags="$@"
$2 ~ /^OTP/ ||
$2 ~ /^MEM/ ||
$2 ~ /^WG/ ||
+ $2 ~ /^FIB_RULE_/ ||
$2 ~ /^BLK[A-Z]*(GET$|SET$|BUF$|PART$|SIZE)/ {printf("\t%s = C.%s\n", $2, $2)}
$2 ~ /^__WCOREFLAG$/ {next}
$2 ~ /^__W[A-Z0-9]+$/ {printf("\t%s = C.%s\n", substr($2,3), $2)}
diff --git a/vendor/golang.org/x/sys/unix/syscall_bsd.go b/vendor/golang.org/x/sys/unix/syscall_bsd.go
index a801b1b1b..9c87c5f07 100644
--- a/vendor/golang.org/x/sys/unix/syscall_bsd.go
+++ b/vendor/golang.org/x/sys/unix/syscall_bsd.go
@@ -553,12 +553,7 @@ func UtimesNano(path string, ts []Timespec) error {
if len(ts) != 2 {
return EINVAL
}
- // Darwin setattrlist can set nanosecond timestamps
- err := setattrlistTimes(path, ts, 0)
- if err != ENOSYS {
- return err
- }
- err = utimensat(AT_FDCWD, path, (*[2]Timespec)(unsafe.Pointer(&ts[0])), 0)
+ err := utimensat(AT_FDCWD, path, (*[2]Timespec)(unsafe.Pointer(&ts[0])), 0)
if err != ENOSYS {
return err
}
@@ -578,10 +573,6 @@ func UtimesNanoAt(dirfd int, path string, ts []Timespec, flags int) error {
if len(ts) != 2 {
return EINVAL
}
- err := setattrlistTimes(path, ts, flags)
- if err != ENOSYS {
- return err
- }
return utimensat(dirfd, path, (*[2]Timespec)(unsafe.Pointer(&ts[0])), flags)
}
diff --git a/vendor/golang.org/x/sys/unix/syscall_darwin.go b/vendor/golang.org/x/sys/unix/syscall_darwin.go
index ca2ae3571..09a25c653 100644
--- a/vendor/golang.org/x/sys/unix/syscall_darwin.go
+++ b/vendor/golang.org/x/sys/unix/syscall_darwin.go
@@ -141,16 +141,6 @@ func direntNamlen(buf []byte) (uint64, bool) {
func PtraceAttach(pid int) (err error) { return ptrace(PT_ATTACH, pid, 0, 0) }
func PtraceDetach(pid int) (err error) { return ptrace(PT_DETACH, pid, 0, 0) }
-type attrList struct {
- bitmapCount uint16
- _ uint16
- CommonAttr uint32
- VolAttr uint32
- DirAttr uint32
- FileAttr uint32
- Forkattr uint32
-}
-
//sysnb pipe(p *[2]int32) (err error)
func Pipe(p []int) (err error) {
@@ -282,36 +272,7 @@ func Flistxattr(fd int, dest []byte) (sz int, err error) {
return flistxattr(fd, xattrPointer(dest), len(dest), 0)
}
-func setattrlistTimes(path string, times []Timespec, flags int) error {
- _p0, err := BytePtrFromString(path)
- if err != nil {
- return err
- }
-
- var attrList attrList
- attrList.bitmapCount = ATTR_BIT_MAP_COUNT
- attrList.CommonAttr = ATTR_CMN_MODTIME | ATTR_CMN_ACCTIME
-
- // order is mtime, atime: the opposite of Chtimes
- attributes := [2]Timespec{times[1], times[0]}
- options := 0
- if flags&AT_SYMLINK_NOFOLLOW != 0 {
- options |= FSOPT_NOFOLLOW
- }
- return setattrlist(
- _p0,
- unsafe.Pointer(&attrList),
- unsafe.Pointer(&attributes),
- unsafe.Sizeof(attributes),
- options)
-}
-
-//sys setattrlist(path *byte, list unsafe.Pointer, buf unsafe.Pointer, size uintptr, options int) (err error)
-
-func utimensat(dirfd int, path string, times *[2]Timespec, flags int) error {
- // Darwin doesn't support SYS_UTIMENSAT
- return ENOSYS
-}
+//sys utimensat(dirfd int, path string, times *[2]Timespec, flags int) (err error)
/*
* Wrapped
diff --git a/vendor/golang.org/x/sys/unix/syscall_dragonfly.go b/vendor/golang.org/x/sys/unix/syscall_dragonfly.go
index 36c268b35..c61e27498 100644
--- a/vendor/golang.org/x/sys/unix/syscall_dragonfly.go
+++ b/vendor/golang.org/x/sys/unix/syscall_dragonfly.go
@@ -169,11 +169,6 @@ func Getfsstat(buf []Statfs_t, flags int) (n int, err error) {
return
}
-func setattrlistTimes(path string, times []Timespec, flags int) error {
- // used on Darwin for UtimesNano
- return ENOSYS
-}
-
//sys ioctl(fd int, req uint, arg uintptr) (err error)
//sys sysctl(mib []_C_int, old *byte, oldlen *uintptr, new *byte, newlen uintptr) (err error) = SYS___SYSCTL
diff --git a/vendor/golang.org/x/sys/unix/syscall_freebsd.go b/vendor/golang.org/x/sys/unix/syscall_freebsd.go
index ac3db019b..6f6c510f4 100644
--- a/vendor/golang.org/x/sys/unix/syscall_freebsd.go
+++ b/vendor/golang.org/x/sys/unix/syscall_freebsd.go
@@ -194,11 +194,6 @@ func Getfsstat(buf []Statfs_t, flags int) (n int, err error) {
return
}
-func setattrlistTimes(path string, times []Timespec, flags int) error {
- // used on Darwin for UtimesNano
- return ENOSYS
-}
-
//sys ioctl(fd int, req uint, arg uintptr) (err error)
//sys sysctl(mib []_C_int, old *byte, oldlen *uintptr, new *byte, newlen uintptr) (err error) = SYS___SYSCTL
diff --git a/vendor/golang.org/x/sys/unix/syscall_linux.go b/vendor/golang.org/x/sys/unix/syscall_linux.go
index 2a6affedd..d251dafae 100644
--- a/vendor/golang.org/x/sys/unix/syscall_linux.go
+++ b/vendor/golang.org/x/sys/unix/syscall_linux.go
@@ -366,6 +366,8 @@ func Wait4(pid int, wstatus *WaitStatus, options int, rusage *Rusage) (wpid int,
return
}
+//sys Waitid(idType int, id int, info *Siginfo, options int, rusage *Rusage) (err error)
+
func Mkfifo(path string, mode uint32) error {
return Mknod(path, mode|S_IFIFO, 0)
}
@@ -1827,6 +1829,9 @@ func Dup2(oldfd, newfd int) error {
//sys Fremovexattr(fd int, attr string) (err error)
//sys Fsetxattr(fd int, attr string, dest []byte, flags int) (err error)
//sys Fsync(fd int) (err error)
+//sys Fsmount(fd int, flags int, mountAttrs int) (fsfd int, err error)
+//sys Fsopen(fsName string, flags int) (fd int, err error)
+//sys Fspick(dirfd int, pathName string, flags int) (fd int, err error)
//sys Getdents(fd int, buf []byte) (n int, err error) = SYS_GETDENTS64
//sysnb Getpgid(pid int) (pgid int, err error)
@@ -1857,7 +1862,9 @@ func Getpgrp() (pid int) {
//sys MemfdCreate(name string, flags int) (fd int, err error)
//sys Mkdirat(dirfd int, path string, mode uint32) (err error)
//sys Mknodat(dirfd int, path string, mode uint32, dev int) (err error)
+//sys MoveMount(fromDirfd int, fromPathName string, toDirfd int, toPathName string, flags int) (err error)
//sys Nanosleep(time *Timespec, leftover *Timespec) (err error)
+//sys OpenTree(dfd int, fileName string, flags uint) (r int, err error)
//sys PerfEventOpen(attr *PerfEventAttr, pid int, cpu int, groupFd int, flags int) (fd int, err error)
//sys PivotRoot(newroot string, putold string) (err error) = SYS_PIVOT_ROOT
//sysnb Prlimit(pid int, resource int, newlimit *Rlimit, old *Rlimit) (err error) = SYS_PRLIMIT64
@@ -2182,7 +2189,7 @@ func Faccessat(dirfd int, path string, mode uint32, flags int) (err error) {
gid = Getgid()
}
- if uint32(gid) == st.Gid || isGroupMember(gid) {
+ if uint32(gid) == st.Gid || isGroupMember(int(st.Gid)) {
fmode = (st.Mode >> 3) & 7
} else {
fmode = st.Mode & 7
@@ -2446,5 +2453,4 @@ func Setitimer(which ItimerWhich, it Itimerval) (Itimerval, error) {
// Vfork
// Vhangup
// Vserver
-// Waitid
// _Sysctl
diff --git a/vendor/golang.org/x/sys/unix/syscall_linux_amd64.go b/vendor/golang.org/x/sys/unix/syscall_linux_amd64.go
index b945ab254..f5e9d6bef 100644
--- a/vendor/golang.org/x/sys/unix/syscall_linux_amd64.go
+++ b/vendor/golang.org/x/sys/unix/syscall_linux_amd64.go
@@ -28,6 +28,7 @@ func Lstat(path string, stat *Stat_t) (err error) {
return Fstatat(AT_FDCWD, path, stat, AT_SYMLINK_NOFOLLOW)
}
+//sys MemfdSecret(flags int) (fd int, err error)
//sys Pause() (err error)
//sys pread(fd int, p []byte, offset int64) (n int, err error) = SYS_PREAD64
//sys pwrite(fd int, p []byte, offset int64) (n int, err error) = SYS_PWRITE64
diff --git a/vendor/golang.org/x/sys/unix/syscall_linux_arm64.go b/vendor/golang.org/x/sys/unix/syscall_linux_arm64.go
index 81db4833a..d83e2c657 100644
--- a/vendor/golang.org/x/sys/unix/syscall_linux_arm64.go
+++ b/vendor/golang.org/x/sys/unix/syscall_linux_arm64.go
@@ -22,6 +22,7 @@ import "unsafe"
//sysnb getrlimit(resource int, rlim *Rlimit) (err error)
//sysnb Getuid() (uid int)
//sys Listen(s int, n int) (err error)
+//sys MemfdSecret(flags int) (fd int, err error)
//sys pread(fd int, p []byte, offset int64) (n int, err error) = SYS_PREAD64
//sys pwrite(fd int, p []byte, offset int64) (n int, err error) = SYS_PWRITE64
//sys Renameat(olddirfd int, oldpath string, newdirfd int, newpath string) (err error)
diff --git a/vendor/golang.org/x/sys/unix/syscall_netbsd.go b/vendor/golang.org/x/sys/unix/syscall_netbsd.go
index d9946e5f5..666f0a1b3 100644
--- a/vendor/golang.org/x/sys/unix/syscall_netbsd.go
+++ b/vendor/golang.org/x/sys/unix/syscall_netbsd.go
@@ -163,11 +163,6 @@ func sendfile(outfd int, infd int, offset *int64, count int) (written int, err e
return -1, ENOSYS
}
-func setattrlistTimes(path string, times []Timespec, flags int) error {
- // used on Darwin for UtimesNano
- return ENOSYS
-}
-
//sys ioctl(fd int, req uint, arg uintptr) (err error)
//sys sysctl(mib []_C_int, old *byte, oldlen *uintptr, new *byte, newlen uintptr) (err error) = SYS___SYSCTL
diff --git a/vendor/golang.org/x/sys/unix/syscall_openbsd.go b/vendor/golang.org/x/sys/unix/syscall_openbsd.go
index 0d94765b1..15d637d63 100644
--- a/vendor/golang.org/x/sys/unix/syscall_openbsd.go
+++ b/vendor/golang.org/x/sys/unix/syscall_openbsd.go
@@ -149,11 +149,6 @@ func Getfsstat(buf []Statfs_t, flags int) (n int, err error) {
return
}
-func setattrlistTimes(path string, times []Timespec, flags int) error {
- // used on Darwin for UtimesNano
- return ENOSYS
-}
-
//sys ioctl(fd int, req uint, arg uintptr) (err error)
//sys sysctl(mib []_C_int, old *byte, oldlen *uintptr, new *byte, newlen uintptr) (err error) = SYS___SYSCTL
diff --git a/vendor/golang.org/x/sys/unix/syscall_solaris.go b/vendor/golang.org/x/sys/unix/syscall_solaris.go
index 8c4e80060..5c2003cec 100644
--- a/vendor/golang.org/x/sys/unix/syscall_solaris.go
+++ b/vendor/golang.org/x/sys/unix/syscall_solaris.go
@@ -737,8 +737,20 @@ type fileObjCookie struct {
type EventPort struct {
port int
mu sync.Mutex
- fds map[uintptr]interface{}
+ fds map[uintptr]*fileObjCookie
paths map[string]*fileObjCookie
+ // The user cookie presents an interesting challenge from a memory management perspective.
+ // There are two paths by which we can discover that it is no longer in use:
+ // 1. The user calls port_dissociate before any events fire
+ // 2. An event fires and we return it to the user
+ // The tricky situation is if the event has fired in the kernel but
+ // the user hasn't requested/received it yet.
+ // If the user wants to port_dissociate before the event has been processed,
+ // we should handle things gracefully. To do so, we need to keep an extra
+ // reference to the cookie around until the event is processed
+ // thus the otherwise seemingly extraneous "cookies" map
+ // The key of this map is a pointer to the corresponding &fCookie.cookie
+ cookies map[*interface{}]*fileObjCookie
}
// PortEvent is an abstraction of the port_event C struct.
@@ -762,9 +774,10 @@ func NewEventPort() (*EventPort, error) {
return nil, err
}
e := &EventPort{
- port: port,
- fds: make(map[uintptr]interface{}),
- paths: make(map[string]*fileObjCookie),
+ port: port,
+ fds: make(map[uintptr]*fileObjCookie),
+ paths: make(map[string]*fileObjCookie),
+ cookies: make(map[*interface{}]*fileObjCookie),
}
return e, nil
}
@@ -779,9 +792,13 @@ func NewEventPort() (*EventPort, error) {
func (e *EventPort) Close() error {
e.mu.Lock()
defer e.mu.Unlock()
+ err := Close(e.port)
+ if err != nil {
+ return err
+ }
e.fds = nil
e.paths = nil
- return Close(e.port)
+ return nil
}
// PathIsWatched checks to see if path is associated with this EventPort.
@@ -818,6 +835,7 @@ func (e *EventPort) AssociatePath(path string, stat os.FileInfo, events int, coo
return err
}
e.paths[path] = fCookie
+ e.cookies[&fCookie.cookie] = fCookie
return nil
}
@@ -830,11 +848,19 @@ func (e *EventPort) DissociatePath(path string) error {
return fmt.Errorf("%v is not associated with this Event Port", path)
}
_, err := port_dissociate(e.port, PORT_SOURCE_FILE, uintptr(unsafe.Pointer(f.fobj)))
- if err != nil {
+ // If the path is no longer associated with this event port (ENOENT)
+ // we should delete it from our map. We can still return ENOENT to the caller.
+ // But we need to save the cookie
+ if err != nil && err != ENOENT {
return err
}
+ if err == nil {
+ // dissociate was successful, safe to delete the cookie
+ fCookie := e.paths[path]
+ delete(e.cookies, &fCookie.cookie)
+ }
delete(e.paths, path)
- return nil
+ return err
}
// AssociateFd wraps calls to port_associate(3c) on file descriptors.
@@ -844,12 +870,13 @@ func (e *EventPort) AssociateFd(fd uintptr, events int, cookie interface{}) erro
if _, found := e.fds[fd]; found {
return fmt.Errorf("%v is already associated with this Event Port", fd)
}
- pcookie := &cookie
- _, err := port_associate(e.port, PORT_SOURCE_FD, fd, events, (*byte)(unsafe.Pointer(pcookie)))
+ fCookie := &fileObjCookie{nil, cookie}
+ _, err := port_associate(e.port, PORT_SOURCE_FD, fd, events, (*byte)(unsafe.Pointer(&fCookie.cookie)))
if err != nil {
return err
}
- e.fds[fd] = pcookie
+ e.fds[fd] = fCookie
+ e.cookies[&fCookie.cookie] = fCookie
return nil
}
@@ -862,11 +889,16 @@ func (e *EventPort) DissociateFd(fd uintptr) error {
return fmt.Errorf("%v is not associated with this Event Port", fd)
}
_, err := port_dissociate(e.port, PORT_SOURCE_FD, fd)
- if err != nil {
+ if err != nil && err != ENOENT {
return err
}
+ if err == nil {
+ // dissociate was successful, safe to delete the cookie
+ fCookie := e.fds[fd]
+ delete(e.cookies, &fCookie.cookie)
+ }
delete(e.fds, fd)
- return nil
+ return err
}
func createFileObj(name string, stat os.FileInfo) (*fileObj, error) {
@@ -894,24 +926,46 @@ func (e *EventPort) GetOne(t *Timespec) (*PortEvent, error) {
return nil, err
}
p := new(PortEvent)
- p.Events = pe.Events
- p.Source = pe.Source
e.mu.Lock()
defer e.mu.Unlock()
- switch pe.Source {
+ e.peIntToExt(pe, p)
+ return p, nil
+}
+
+// peIntToExt converts a cgo portEvent struct into the friendlier PortEvent
+// NOTE: Always call this function while holding the e.mu mutex
+func (e *EventPort) peIntToExt(peInt *portEvent, peExt *PortEvent) {
+ peExt.Events = peInt.Events
+ peExt.Source = peInt.Source
+ cookie := (*interface{})(unsafe.Pointer(peInt.User))
+ peExt.Cookie = *cookie
+ switch peInt.Source {
case PORT_SOURCE_FD:
- p.Fd = uintptr(pe.Object)
- cookie := (*interface{})(unsafe.Pointer(pe.User))
- p.Cookie = *cookie
- delete(e.fds, p.Fd)
+ delete(e.cookies, cookie)
+ peExt.Fd = uintptr(peInt.Object)
+ // Only remove the fds entry if it exists and this cookie matches
+ if fobj, ok := e.fds[peExt.Fd]; ok {
+ if &fobj.cookie == cookie {
+ delete(e.fds, peExt.Fd)
+ }
+ }
case PORT_SOURCE_FILE:
- p.fobj = (*fileObj)(unsafe.Pointer(uintptr(pe.Object)))
- p.Path = BytePtrToString((*byte)(unsafe.Pointer(p.fobj.Name)))
- cookie := (*interface{})(unsafe.Pointer(pe.User))
- p.Cookie = *cookie
- delete(e.paths, p.Path)
+ if fCookie, ok := e.cookies[cookie]; ok && uintptr(unsafe.Pointer(fCookie.fobj)) == uintptr(peInt.Object) {
+ // Use our stashed reference rather than using unsafe on what we got back
+ // the unsafe version would be (*fileObj)(unsafe.Pointer(uintptr(peInt.Object)))
+ peExt.fobj = fCookie.fobj
+ } else {
+ panic("mismanaged memory")
+ }
+ delete(e.cookies, cookie)
+ peExt.Path = BytePtrToString((*byte)(unsafe.Pointer(peExt.fobj.Name)))
+ // Only remove the paths entry if it exists and this cookie matches
+ if fobj, ok := e.paths[peExt.Path]; ok {
+ if &fobj.cookie == cookie {
+ delete(e.paths, peExt.Path)
+ }
+ }
}
- return p, nil
}
// Pending wraps port_getn(3c) and returns how many events are pending.
@@ -944,21 +998,7 @@ func (e *EventPort) Get(s []PortEvent, min int, timeout *Timespec) (int, error)
e.mu.Lock()
defer e.mu.Unlock()
for i := 0; i < int(got); i++ {
- s[i].Events = ps[i].Events
- s[i].Source = ps[i].Source
- switch ps[i].Source {
- case PORT_SOURCE_FD:
- s[i].Fd = uintptr(ps[i].Object)
- cookie := (*interface{})(unsafe.Pointer(ps[i].User))
- s[i].Cookie = *cookie
- delete(e.fds, s[i].Fd)
- case PORT_SOURCE_FILE:
- s[i].fobj = (*fileObj)(unsafe.Pointer(uintptr(ps[i].Object)))
- s[i].Path = BytePtrToString((*byte)(unsafe.Pointer(s[i].fobj.Name)))
- cookie := (*interface{})(unsafe.Pointer(ps[i].User))
- s[i].Cookie = *cookie
- delete(e.paths, s[i].Path)
- }
+ e.peIntToExt(&ps[i], &s[i])
}
return int(got), err
}
diff --git a/vendor/golang.org/x/sys/unix/zerrors_linux.go b/vendor/golang.org/x/sys/unix/zerrors_linux.go
index bc7c9d075..3de79fa25 100644
--- a/vendor/golang.org/x/sys/unix/zerrors_linux.go
+++ b/vendor/golang.org/x/sys/unix/zerrors_linux.go
@@ -393,9 +393,11 @@ const (
CAP_SYS_TIME = 0x19
CAP_SYS_TTY_CONFIG = 0x1a
CAP_WAKE_ALARM = 0x23
+ CEPH_SUPER_MAGIC = 0xc36400
CFLUSH = 0xf
CGROUP2_SUPER_MAGIC = 0x63677270
CGROUP_SUPER_MAGIC = 0x27e0eb
+ CIFS_SUPER_MAGIC = 0xff534d42
CLOCK_BOOTTIME = 0x7
CLOCK_BOOTTIME_ALARM = 0x9
CLOCK_DEFAULT = 0x0
@@ -784,6 +786,7 @@ const (
EV_SYN = 0x0
EV_VERSION = 0x10001
EXABYTE_ENABLE_NEST = 0xf0
+ EXFAT_SUPER_MAGIC = 0x2011bab0
EXT2_SUPER_MAGIC = 0xef53
EXT3_SUPER_MAGIC = 0xef53
EXT4_SUPER_MAGIC = 0xef53
@@ -826,6 +829,8 @@ const (
FAN_EVENT_INFO_TYPE_DFID_NAME = 0x2
FAN_EVENT_INFO_TYPE_ERROR = 0x5
FAN_EVENT_INFO_TYPE_FID = 0x1
+ FAN_EVENT_INFO_TYPE_NEW_DFID_NAME = 0xc
+ FAN_EVENT_INFO_TYPE_OLD_DFID_NAME = 0xa
FAN_EVENT_INFO_TYPE_PIDFD = 0x4
FAN_EVENT_METADATA_LEN = 0x18
FAN_EVENT_ON_CHILD = 0x8000000
@@ -854,17 +859,27 @@ const (
FAN_OPEN_EXEC_PERM = 0x40000
FAN_OPEN_PERM = 0x10000
FAN_Q_OVERFLOW = 0x4000
+ FAN_RENAME = 0x10000000
FAN_REPORT_DFID_NAME = 0xc00
+ FAN_REPORT_DFID_NAME_TARGET = 0x1e00
FAN_REPORT_DIR_FID = 0x400
FAN_REPORT_FID = 0x200
FAN_REPORT_NAME = 0x800
FAN_REPORT_PIDFD = 0x80
+ FAN_REPORT_TARGET_FID = 0x1000
FAN_REPORT_TID = 0x100
FAN_UNLIMITED_MARKS = 0x20
FAN_UNLIMITED_QUEUE = 0x10
FD_CLOEXEC = 0x1
FD_SETSIZE = 0x400
FF0 = 0x0
+ FIB_RULE_DEV_DETACHED = 0x8
+ FIB_RULE_FIND_SADDR = 0x10000
+ FIB_RULE_IIF_DETACHED = 0x8
+ FIB_RULE_INVERT = 0x2
+ FIB_RULE_OIF_DETACHED = 0x10
+ FIB_RULE_PERMANENT = 0x1
+ FIB_RULE_UNRESOLVED = 0x4
FIDEDUPERANGE = 0xc0189436
FSCRYPT_KEY_DESCRIPTOR_SIZE = 0x8
FSCRYPT_KEY_DESC_PREFIX = "fscrypt:"
@@ -927,6 +942,7 @@ const (
FS_VERITY_METADATA_TYPE_DESCRIPTOR = 0x2
FS_VERITY_METADATA_TYPE_MERKLE_TREE = 0x1
FS_VERITY_METADATA_TYPE_SIGNATURE = 0x3
+ FUSE_SUPER_MAGIC = 0x65735546
FUTEXFS_SUPER_MAGIC = 0xbad1dea
F_ADD_SEALS = 0x409
F_DUPFD = 0x0
@@ -1495,6 +1511,7 @@ const (
MNT_DETACH = 0x2
MNT_EXPIRE = 0x4
MNT_FORCE = 0x1
+ MODULE_INIT_COMPRESSED_FILE = 0x4
MODULE_INIT_IGNORE_MODVERSIONS = 0x1
MODULE_INIT_IGNORE_VERMAGIC = 0x2
MOUNT_ATTR_IDMAP = 0x100000
@@ -1849,6 +1866,9 @@ const (
PERF_MEM_BLK_NA = 0x1
PERF_MEM_BLK_SHIFT = 0x28
PERF_MEM_HOPS_0 = 0x1
+ PERF_MEM_HOPS_1 = 0x2
+ PERF_MEM_HOPS_2 = 0x3
+ PERF_MEM_HOPS_3 = 0x4
PERF_MEM_HOPS_SHIFT = 0x2b
PERF_MEM_LOCK_LOCKED = 0x2
PERF_MEM_LOCK_NA = 0x1
@@ -2052,6 +2072,8 @@ const (
PR_SET_TIMING = 0xe
PR_SET_TSC = 0x1a
PR_SET_UNALIGN = 0x6
+ PR_SET_VMA = 0x53564d41
+ PR_SET_VMA_ANON_NAME = 0x0
PR_SPEC_DISABLE = 0x4
PR_SPEC_DISABLE_NOEXEC = 0x10
PR_SPEC_ENABLE = 0x2
@@ -2135,6 +2157,10 @@ const (
PTRACE_SYSCALL_INFO_NONE = 0x0
PTRACE_SYSCALL_INFO_SECCOMP = 0x3
PTRACE_TRACEME = 0x0
+ P_ALL = 0x0
+ P_PGID = 0x2
+ P_PID = 0x1
+ P_PIDFD = 0x3
QNX4_SUPER_MAGIC = 0x2f
QNX6_SUPER_MAGIC = 0x68191122
RAMFS_MAGIC = 0x858458f6
@@ -2505,6 +2531,7 @@ const (
SMART_STATUS = 0xda
SMART_WRITE_LOG_SECTOR = 0xd6
SMART_WRITE_THRESHOLDS = 0xd7
+ SMB2_SUPER_MAGIC = 0xfe534d42
SMB_SUPER_MAGIC = 0x517b
SOCKFS_MAGIC = 0x534f434b
SOCK_BUF_LOCK_MASK = 0x3
@@ -2646,7 +2673,7 @@ const (
TASKSTATS_GENL_NAME = "TASKSTATS"
TASKSTATS_GENL_VERSION = 0x1
TASKSTATS_TYPE_MAX = 0x6
- TASKSTATS_VERSION = 0xa
+ TASKSTATS_VERSION = 0xb
TCIFLUSH = 0x0
TCIOFF = 0x2
TCIOFLUSH = 0x2
diff --git a/vendor/golang.org/x/sys/unix/zsyscall_darwin_amd64.go b/vendor/golang.org/x/sys/unix/zsyscall_darwin_amd64.go
index fbfce0204..879376589 100644
--- a/vendor/golang.org/x/sys/unix/zsyscall_darwin_amd64.go
+++ b/vendor/golang.org/x/sys/unix/zsyscall_darwin_amd64.go
@@ -643,17 +643,22 @@ var libc_flistxattr_trampoline_addr uintptr
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
-func setattrlist(path *byte, list unsafe.Pointer, buf unsafe.Pointer, size uintptr, options int) (err error) {
- _, _, e1 := syscall_syscall6(libc_setattrlist_trampoline_addr, uintptr(unsafe.Pointer(path)), uintptr(list), uintptr(buf), uintptr(size), uintptr(options), 0)
+func utimensat(dirfd int, path string, times *[2]Timespec, flags int) (err error) {
+ var _p0 *byte
+ _p0, err = BytePtrFromString(path)
+ if err != nil {
+ return
+ }
+ _, _, e1 := syscall_syscall6(libc_utimensat_trampoline_addr, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(times)), uintptr(flags), 0, 0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
-var libc_setattrlist_trampoline_addr uintptr
+var libc_utimensat_trampoline_addr uintptr
-//go:cgo_import_dynamic libc_setattrlist setattrlist "/usr/lib/libSystem.B.dylib"
+//go:cgo_import_dynamic libc_utimensat utimensat "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
diff --git a/vendor/golang.org/x/sys/unix/zsyscall_darwin_amd64.s b/vendor/golang.org/x/sys/unix/zsyscall_darwin_amd64.s
index eac6ca806..8da90cf0e 100644
--- a/vendor/golang.org/x/sys/unix/zsyscall_darwin_amd64.s
+++ b/vendor/golang.org/x/sys/unix/zsyscall_darwin_amd64.s
@@ -228,11 +228,11 @@ TEXT libc_flistxattr_trampoline<>(SB),NOSPLIT,$0-0
GLOBL ·libc_flistxattr_trampoline_addr(SB), RODATA, $8
DATA ·libc_flistxattr_trampoline_addr(SB)/8, $libc_flistxattr_trampoline<>(SB)
-TEXT libc_setattrlist_trampoline<>(SB),NOSPLIT,$0-0
- JMP libc_setattrlist(SB)
+TEXT libc_utimensat_trampoline<>(SB),NOSPLIT,$0-0
+ JMP libc_utimensat(SB)
-GLOBL ·libc_setattrlist_trampoline_addr(SB), RODATA, $8
-DATA ·libc_setattrlist_trampoline_addr(SB)/8, $libc_setattrlist_trampoline<>(SB)
+GLOBL ·libc_utimensat_trampoline_addr(SB), RODATA, $8
+DATA ·libc_utimensat_trampoline_addr(SB)/8, $libc_utimensat_trampoline<>(SB)
TEXT libc_fcntl_trampoline<>(SB),NOSPLIT,$0-0
JMP libc_fcntl(SB)
diff --git a/vendor/golang.org/x/sys/unix/zsyscall_darwin_arm64.go b/vendor/golang.org/x/sys/unix/zsyscall_darwin_arm64.go
index 49d2225ef..f47eedd5a 100644
--- a/vendor/golang.org/x/sys/unix/zsyscall_darwin_arm64.go
+++ b/vendor/golang.org/x/sys/unix/zsyscall_darwin_arm64.go
@@ -643,17 +643,22 @@ var libc_flistxattr_trampoline_addr uintptr
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
-func setattrlist(path *byte, list unsafe.Pointer, buf unsafe.Pointer, size uintptr, options int) (err error) {
- _, _, e1 := syscall_syscall6(libc_setattrlist_trampoline_addr, uintptr(unsafe.Pointer(path)), uintptr(list), uintptr(buf), uintptr(size), uintptr(options), 0)
+func utimensat(dirfd int, path string, times *[2]Timespec, flags int) (err error) {
+ var _p0 *byte
+ _p0, err = BytePtrFromString(path)
+ if err != nil {
+ return
+ }
+ _, _, e1 := syscall_syscall6(libc_utimensat_trampoline_addr, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(times)), uintptr(flags), 0, 0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
-var libc_setattrlist_trampoline_addr uintptr
+var libc_utimensat_trampoline_addr uintptr
-//go:cgo_import_dynamic libc_setattrlist setattrlist "/usr/lib/libSystem.B.dylib"
+//go:cgo_import_dynamic libc_utimensat utimensat "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
diff --git a/vendor/golang.org/x/sys/unix/zsyscall_darwin_arm64.s b/vendor/golang.org/x/sys/unix/zsyscall_darwin_arm64.s
index 4ebcf2175..4d26f7d01 100644
--- a/vendor/golang.org/x/sys/unix/zsyscall_darwin_arm64.s
+++ b/vendor/golang.org/x/sys/unix/zsyscall_darwin_arm64.s
@@ -228,11 +228,11 @@ TEXT libc_flistxattr_trampoline<>(SB),NOSPLIT,$0-0
GLOBL ·libc_flistxattr_trampoline_addr(SB), RODATA, $8
DATA ·libc_flistxattr_trampoline_addr(SB)/8, $libc_flistxattr_trampoline<>(SB)
-TEXT libc_setattrlist_trampoline<>(SB),NOSPLIT,$0-0
- JMP libc_setattrlist(SB)
+TEXT libc_utimensat_trampoline<>(SB),NOSPLIT,$0-0
+ JMP libc_utimensat(SB)
-GLOBL ·libc_setattrlist_trampoline_addr(SB), RODATA, $8
-DATA ·libc_setattrlist_trampoline_addr(SB)/8, $libc_setattrlist_trampoline<>(SB)
+GLOBL ·libc_utimensat_trampoline_addr(SB), RODATA, $8
+DATA ·libc_utimensat_trampoline_addr(SB)/8, $libc_utimensat_trampoline<>(SB)
TEXT libc_fcntl_trampoline<>(SB),NOSPLIT,$0-0
JMP libc_fcntl(SB)
diff --git a/vendor/golang.org/x/sys/unix/zsyscall_linux.go b/vendor/golang.org/x/sys/unix/zsyscall_linux.go
index e5299395a..bc4a27531 100644
--- a/vendor/golang.org/x/sys/unix/zsyscall_linux.go
+++ b/vendor/golang.org/x/sys/unix/zsyscall_linux.go
@@ -231,6 +231,16 @@ func wait4(pid int, wstatus *_C_int, options int, rusage *Rusage) (wpid int, err
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
+func Waitid(idType int, id int, info *Siginfo, options int, rusage *Rusage) (err error) {
+ _, _, e1 := Syscall6(SYS_WAITID, uintptr(idType), uintptr(id), uintptr(unsafe.Pointer(info)), uintptr(options), uintptr(unsafe.Pointer(rusage)), 0)
+ if e1 != 0 {
+ err = errnoErr(e1)
+ }
+ return
+}
+
+// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
+
func KeyctlInt(cmd int, arg2 int, arg3 int, arg4 int, arg5 int) (ret int, err error) {
r0, _, e1 := Syscall6(SYS_KEYCTL, uintptr(cmd), uintptr(arg2), uintptr(arg3), uintptr(arg4), uintptr(arg5), 0)
ret = int(r0)
@@ -818,6 +828,49 @@ func Fsync(fd int) (err error) {
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
+func Fsmount(fd int, flags int, mountAttrs int) (fsfd int, err error) {
+ r0, _, e1 := Syscall(SYS_FSMOUNT, uintptr(fd), uintptr(flags), uintptr(mountAttrs))
+ fsfd = int(r0)
+ if e1 != 0 {
+ err = errnoErr(e1)
+ }
+ return
+}
+
+// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
+
+func Fsopen(fsName string, flags int) (fd int, err error) {
+ var _p0 *byte
+ _p0, err = BytePtrFromString(fsName)
+ if err != nil {
+ return
+ }
+ r0, _, e1 := Syscall(SYS_FSOPEN, uintptr(unsafe.Pointer(_p0)), uintptr(flags), 0)
+ fd = int(r0)
+ if e1 != 0 {
+ err = errnoErr(e1)
+ }
+ return
+}
+
+// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
+
+func Fspick(dirfd int, pathName string, flags int) (fd int, err error) {
+ var _p0 *byte
+ _p0, err = BytePtrFromString(pathName)
+ if err != nil {
+ return
+ }
+ r0, _, e1 := Syscall(SYS_FSPICK, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(flags))
+ fd = int(r0)
+ if e1 != 0 {
+ err = errnoErr(e1)
+ }
+ return
+}
+
+// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
+
func Getdents(fd int, buf []byte) (n int, err error) {
var _p0 unsafe.Pointer
if len(buf) > 0 {
@@ -1195,6 +1248,26 @@ func Mknodat(dirfd int, path string, mode uint32, dev int) (err error) {
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
+func MoveMount(fromDirfd int, fromPathName string, toDirfd int, toPathName string, flags int) (err error) {
+ var _p0 *byte
+ _p0, err = BytePtrFromString(fromPathName)
+ if err != nil {
+ return
+ }
+ var _p1 *byte
+ _p1, err = BytePtrFromString(toPathName)
+ if err != nil {
+ return
+ }
+ _, _, e1 := Syscall6(SYS_MOVE_MOUNT, uintptr(fromDirfd), uintptr(unsafe.Pointer(_p0)), uintptr(toDirfd), uintptr(unsafe.Pointer(_p1)), uintptr(flags), 0)
+ if e1 != 0 {
+ err = errnoErr(e1)
+ }
+ return
+}
+
+// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
+
func Nanosleep(time *Timespec, leftover *Timespec) (err error) {
_, _, e1 := Syscall(SYS_NANOSLEEP, uintptr(unsafe.Pointer(time)), uintptr(unsafe.Pointer(leftover)), 0)
if e1 != 0 {
@@ -1205,6 +1278,22 @@ func Nanosleep(time *Timespec, leftover *Timespec) (err error) {
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
+func OpenTree(dfd int, fileName string, flags uint) (r int, err error) {
+ var _p0 *byte
+ _p0, err = BytePtrFromString(fileName)
+ if err != nil {
+ return
+ }
+ r0, _, e1 := Syscall(SYS_OPEN_TREE, uintptr(dfd), uintptr(unsafe.Pointer(_p0)), uintptr(flags))
+ r = int(r0)
+ if e1 != 0 {
+ err = errnoErr(e1)
+ }
+ return
+}
+
+// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
+
func PerfEventOpen(attr *PerfEventAttr, pid int, cpu int, groupFd int, flags int) (fd int, err error) {
r0, _, e1 := Syscall6(SYS_PERF_EVENT_OPEN, uintptr(unsafe.Pointer(attr)), uintptr(pid), uintptr(cpu), uintptr(groupFd), uintptr(flags), 0)
fd = int(r0)
diff --git a/vendor/golang.org/x/sys/unix/zsyscall_linux_amd64.go b/vendor/golang.org/x/sys/unix/zsyscall_linux_amd64.go
index c947a4d10..2a0c4aa6a 100644
--- a/vendor/golang.org/x/sys/unix/zsyscall_linux_amd64.go
+++ b/vendor/golang.org/x/sys/unix/zsyscall_linux_amd64.go
@@ -215,6 +215,17 @@ func Listen(s int, n int) (err error) {
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
+func MemfdSecret(flags int) (fd int, err error) {
+ r0, _, e1 := Syscall(SYS_MEMFD_SECRET, uintptr(flags), 0, 0)
+ fd = int(r0)
+ if e1 != 0 {
+ err = errnoErr(e1)
+ }
+ return
+}
+
+// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
+
func Pause() (err error) {
_, _, e1 := Syscall(SYS_PAUSE, 0, 0, 0)
if e1 != 0 {
diff --git a/vendor/golang.org/x/sys/unix/zsyscall_linux_arm64.go b/vendor/golang.org/x/sys/unix/zsyscall_linux_arm64.go
index dd15284d8..9f8c24e43 100644
--- a/vendor/golang.org/x/sys/unix/zsyscall_linux_arm64.go
+++ b/vendor/golang.org/x/sys/unix/zsyscall_linux_arm64.go
@@ -180,6 +180,17 @@ func Listen(s int, n int) (err error) {
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
+func MemfdSecret(flags int) (fd int, err error) {
+ r0, _, e1 := Syscall(SYS_MEMFD_SECRET, uintptr(flags), 0, 0)
+ fd = int(r0)
+ if e1 != 0 {
+ err = errnoErr(e1)
+ }
+ return
+}
+
+// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
+
func pread(fd int, p []byte, offset int64) (n int, err error) {
var _p0 unsafe.Pointer
if len(p) > 0 {
diff --git a/vendor/golang.org/x/sys/unix/zsysnum_linux_386.go b/vendor/golang.org/x/sys/unix/zsysnum_linux_386.go
index cac1f758b..62192e1de 100644
--- a/vendor/golang.org/x/sys/unix/zsysnum_linux_386.go
+++ b/vendor/golang.org/x/sys/unix/zsysnum_linux_386.go
@@ -446,4 +446,5 @@ const (
SYS_MEMFD_SECRET = 447
SYS_PROCESS_MRELEASE = 448
SYS_FUTEX_WAITV = 449
+ SYS_SET_MEMPOLICY_HOME_NODE = 450
)
diff --git a/vendor/golang.org/x/sys/unix/zsysnum_linux_amd64.go b/vendor/golang.org/x/sys/unix/zsysnum_linux_amd64.go
index f327e4a0b..490aab5d2 100644
--- a/vendor/golang.org/x/sys/unix/zsysnum_linux_amd64.go
+++ b/vendor/golang.org/x/sys/unix/zsysnum_linux_amd64.go
@@ -368,4 +368,5 @@ const (
SYS_MEMFD_SECRET = 447
SYS_PROCESS_MRELEASE = 448
SYS_FUTEX_WAITV = 449
+ SYS_SET_MEMPOLICY_HOME_NODE = 450
)
diff --git a/vendor/golang.org/x/sys/unix/zsysnum_linux_arm.go b/vendor/golang.org/x/sys/unix/zsysnum_linux_arm.go
index fb06a08d4..aca17b6fa 100644
--- a/vendor/golang.org/x/sys/unix/zsysnum_linux_arm.go
+++ b/vendor/golang.org/x/sys/unix/zsysnum_linux_arm.go
@@ -410,4 +410,5 @@ const (
SYS_LANDLOCK_RESTRICT_SELF = 446
SYS_PROCESS_MRELEASE = 448
SYS_FUTEX_WAITV = 449
+ SYS_SET_MEMPOLICY_HOME_NODE = 450
)
diff --git a/vendor/golang.org/x/sys/unix/zsysnum_linux_arm64.go b/vendor/golang.org/x/sys/unix/zsysnum_linux_arm64.go
index 58285646e..54b4dfa54 100644
--- a/vendor/golang.org/x/sys/unix/zsysnum_linux_arm64.go
+++ b/vendor/golang.org/x/sys/unix/zsysnum_linux_arm64.go
@@ -313,4 +313,5 @@ const (
SYS_MEMFD_SECRET = 447
SYS_PROCESS_MRELEASE = 448
SYS_FUTEX_WAITV = 449
+ SYS_SET_MEMPOLICY_HOME_NODE = 450
)
diff --git a/vendor/golang.org/x/sys/unix/zsysnum_linux_mips.go b/vendor/golang.org/x/sys/unix/zsysnum_linux_mips.go
index 3b0418e68..65a99efc2 100644
--- a/vendor/golang.org/x/sys/unix/zsysnum_linux_mips.go
+++ b/vendor/golang.org/x/sys/unix/zsysnum_linux_mips.go
@@ -430,4 +430,5 @@ const (
SYS_LANDLOCK_RESTRICT_SELF = 4446
SYS_PROCESS_MRELEASE = 4448
SYS_FUTEX_WAITV = 4449
+ SYS_SET_MEMPOLICY_HOME_NODE = 4450
)
diff --git a/vendor/golang.org/x/sys/unix/zsysnum_linux_mips64.go b/vendor/golang.org/x/sys/unix/zsysnum_linux_mips64.go
index 314ebf166..841c8a668 100644
--- a/vendor/golang.org/x/sys/unix/zsysnum_linux_mips64.go
+++ b/vendor/golang.org/x/sys/unix/zsysnum_linux_mips64.go
@@ -360,4 +360,5 @@ const (
SYS_LANDLOCK_RESTRICT_SELF = 5446
SYS_PROCESS_MRELEASE = 5448
SYS_FUTEX_WAITV = 5449
+ SYS_SET_MEMPOLICY_HOME_NODE = 5450
)
diff --git a/vendor/golang.org/x/sys/unix/zsysnum_linux_mips64le.go b/vendor/golang.org/x/sys/unix/zsysnum_linux_mips64le.go
index b8fbb937a..e26a7c765 100644
--- a/vendor/golang.org/x/sys/unix/zsysnum_linux_mips64le.go
+++ b/vendor/golang.org/x/sys/unix/zsysnum_linux_mips64le.go
@@ -360,4 +360,5 @@ const (
SYS_LANDLOCK_RESTRICT_SELF = 5446
SYS_PROCESS_MRELEASE = 5448
SYS_FUTEX_WAITV = 5449
+ SYS_SET_MEMPOLICY_HOME_NODE = 5450
)
diff --git a/vendor/golang.org/x/sys/unix/zsysnum_linux_mipsle.go b/vendor/golang.org/x/sys/unix/zsysnum_linux_mipsle.go
index ee309b2ba..26447260a 100644
--- a/vendor/golang.org/x/sys/unix/zsysnum_linux_mipsle.go
+++ b/vendor/golang.org/x/sys/unix/zsysnum_linux_mipsle.go
@@ -430,4 +430,5 @@ const (
SYS_LANDLOCK_RESTRICT_SELF = 4446
SYS_PROCESS_MRELEASE = 4448
SYS_FUTEX_WAITV = 4449
+ SYS_SET_MEMPOLICY_HOME_NODE = 4450
)
diff --git a/vendor/golang.org/x/sys/unix/zsysnum_linux_ppc.go b/vendor/golang.org/x/sys/unix/zsysnum_linux_ppc.go
index ac3748104..26aefc186 100644
--- a/vendor/golang.org/x/sys/unix/zsysnum_linux_ppc.go
+++ b/vendor/golang.org/x/sys/unix/zsysnum_linux_ppc.go
@@ -437,4 +437,5 @@ const (
SYS_LANDLOCK_RESTRICT_SELF = 446
SYS_PROCESS_MRELEASE = 448
SYS_FUTEX_WAITV = 449
+ SYS_SET_MEMPOLICY_HOME_NODE = 450
)
diff --git a/vendor/golang.org/x/sys/unix/zsysnum_linux_ppc64.go b/vendor/golang.org/x/sys/unix/zsysnum_linux_ppc64.go
index 5aa472111..8d4cd9d99 100644
--- a/vendor/golang.org/x/sys/unix/zsysnum_linux_ppc64.go
+++ b/vendor/golang.org/x/sys/unix/zsysnum_linux_ppc64.go
@@ -409,4 +409,5 @@ const (
SYS_LANDLOCK_RESTRICT_SELF = 446
SYS_PROCESS_MRELEASE = 448
SYS_FUTEX_WAITV = 449
+ SYS_SET_MEMPOLICY_HOME_NODE = 450
)
diff --git a/vendor/golang.org/x/sys/unix/zsysnum_linux_ppc64le.go b/vendor/golang.org/x/sys/unix/zsysnum_linux_ppc64le.go
index 0793ac1a6..3b405d1f8 100644
--- a/vendor/golang.org/x/sys/unix/zsysnum_linux_ppc64le.go
+++ b/vendor/golang.org/x/sys/unix/zsysnum_linux_ppc64le.go
@@ -409,4 +409,5 @@ const (
SYS_LANDLOCK_RESTRICT_SELF = 446
SYS_PROCESS_MRELEASE = 448
SYS_FUTEX_WAITV = 449
+ SYS_SET_MEMPOLICY_HOME_NODE = 450
)
diff --git a/vendor/golang.org/x/sys/unix/zsysnum_linux_riscv64.go b/vendor/golang.org/x/sys/unix/zsysnum_linux_riscv64.go
index a520962e3..c3a5af862 100644
--- a/vendor/golang.org/x/sys/unix/zsysnum_linux_riscv64.go
+++ b/vendor/golang.org/x/sys/unix/zsysnum_linux_riscv64.go
@@ -311,4 +311,5 @@ const (
SYS_LANDLOCK_RESTRICT_SELF = 446
SYS_PROCESS_MRELEASE = 448
SYS_FUTEX_WAITV = 449
+ SYS_SET_MEMPOLICY_HOME_NODE = 450
)
diff --git a/vendor/golang.org/x/sys/unix/zsysnum_linux_s390x.go b/vendor/golang.org/x/sys/unix/zsysnum_linux_s390x.go
index d1738586b..8ffa66469 100644
--- a/vendor/golang.org/x/sys/unix/zsysnum_linux_s390x.go
+++ b/vendor/golang.org/x/sys/unix/zsysnum_linux_s390x.go
@@ -374,4 +374,5 @@ const (
SYS_LANDLOCK_RESTRICT_SELF = 446
SYS_PROCESS_MRELEASE = 448
SYS_FUTEX_WAITV = 449
+ SYS_SET_MEMPOLICY_HOME_NODE = 450
)
diff --git a/vendor/golang.org/x/sys/unix/zsysnum_linux_sparc64.go b/vendor/golang.org/x/sys/unix/zsysnum_linux_sparc64.go
index dfd5660f9..6a39640e7 100644
--- a/vendor/golang.org/x/sys/unix/zsysnum_linux_sparc64.go
+++ b/vendor/golang.org/x/sys/unix/zsysnum_linux_sparc64.go
@@ -388,4 +388,5 @@ const (
SYS_LANDLOCK_RESTRICT_SELF = 446
SYS_PROCESS_MRELEASE = 448
SYS_FUTEX_WAITV = 449
+ SYS_SET_MEMPOLICY_HOME_NODE = 450
)
diff --git a/vendor/golang.org/x/sys/unix/ztypes_linux.go b/vendor/golang.org/x/sys/unix/ztypes_linux.go
index 2c26466e0..9962d26bb 100644
--- a/vendor/golang.org/x/sys/unix/ztypes_linux.go
+++ b/vendor/golang.org/x/sys/unix/ztypes_linux.go
@@ -754,6 +754,25 @@ const (
AT_SYMLINK_NOFOLLOW = 0x100
AT_EACCESS = 0x200
+
+ OPEN_TREE_CLONE = 0x1
+
+ MOVE_MOUNT_F_SYMLINKS = 0x1
+ MOVE_MOUNT_F_AUTOMOUNTS = 0x2
+ MOVE_MOUNT_F_EMPTY_PATH = 0x4
+ MOVE_MOUNT_T_SYMLINKS = 0x10
+ MOVE_MOUNT_T_AUTOMOUNTS = 0x20
+ MOVE_MOUNT_T_EMPTY_PATH = 0x40
+ MOVE_MOUNT_SET_GROUP = 0x100
+
+ FSOPEN_CLOEXEC = 0x1
+
+ FSPICK_CLOEXEC = 0x1
+ FSPICK_SYMLINK_NOFOLLOW = 0x2
+ FSPICK_NO_AUTOMOUNT = 0x4
+ FSPICK_EMPTY_PATH = 0x8
+
+ FSMOUNT_CLOEXEC = 0x1
)
type OpenHow struct {
@@ -3619,7 +3638,7 @@ const (
ETHTOOL_A_RINGS_RX_MINI = 0x7
ETHTOOL_A_RINGS_RX_JUMBO = 0x8
ETHTOOL_A_RINGS_TX = 0x9
- ETHTOOL_A_RINGS_MAX = 0x9
+ ETHTOOL_A_RINGS_MAX = 0xa
ETHTOOL_A_CHANNELS_UNSPEC = 0x0
ETHTOOL_A_CHANNELS_HEADER = 0x1
ETHTOOL_A_CHANNELS_RX_MAX = 0x2
@@ -4304,7 +4323,7 @@ const (
NL80211_ATTR_MAC_HINT = 0xc8
NL80211_ATTR_MAC_MASK = 0xd7
NL80211_ATTR_MAX_AP_ASSOC_STA = 0xca
- NL80211_ATTR_MAX = 0x133
+ NL80211_ATTR_MAX = 0x135
NL80211_ATTR_MAX_CRIT_PROT_DURATION = 0xb4
NL80211_ATTR_MAX_CSA_COUNTERS = 0xce
NL80211_ATTR_MAX_MATCH_SETS = 0x85
@@ -4645,7 +4664,7 @@ const (
NL80211_CMD_LEAVE_IBSS = 0x2c
NL80211_CMD_LEAVE_MESH = 0x45
NL80211_CMD_LEAVE_OCB = 0x6d
- NL80211_CMD_MAX = 0x92
+ NL80211_CMD_MAX = 0x93
NL80211_CMD_MICHAEL_MIC_FAILURE = 0x29
NL80211_CMD_NAN_MATCH = 0x78
NL80211_CMD_NEW_BEACON = 0xf
@@ -5532,3 +5551,40 @@ const (
NL80211_WPA_VERSION_2 = 0x2
NL80211_WPA_VERSION_3 = 0x4
)
+
+const (
+ FRA_UNSPEC = 0x0
+ FRA_DST = 0x1
+ FRA_SRC = 0x2
+ FRA_IIFNAME = 0x3
+ FRA_GOTO = 0x4
+ FRA_UNUSED2 = 0x5
+ FRA_PRIORITY = 0x6
+ FRA_UNUSED3 = 0x7
+ FRA_UNUSED4 = 0x8
+ FRA_UNUSED5 = 0x9
+ FRA_FWMARK = 0xa
+ FRA_FLOW = 0xb
+ FRA_TUN_ID = 0xc
+ FRA_SUPPRESS_IFGROUP = 0xd
+ FRA_SUPPRESS_PREFIXLEN = 0xe
+ FRA_TABLE = 0xf
+ FRA_FWMASK = 0x10
+ FRA_OIFNAME = 0x11
+ FRA_PAD = 0x12
+ FRA_L3MDEV = 0x13
+ FRA_UID_RANGE = 0x14
+ FRA_PROTOCOL = 0x15
+ FRA_IP_PROTO = 0x16
+ FRA_SPORT_RANGE = 0x17
+ FRA_DPORT_RANGE = 0x18
+ FR_ACT_UNSPEC = 0x0
+ FR_ACT_TO_TBL = 0x1
+ FR_ACT_GOTO = 0x2
+ FR_ACT_NOP = 0x3
+ FR_ACT_RES3 = 0x4
+ FR_ACT_RES4 = 0x5
+ FR_ACT_BLACKHOLE = 0x6
+ FR_ACT_UNREACHABLE = 0x7
+ FR_ACT_PROHIBIT = 0x8
+)
diff --git a/vendor/golang.org/x/sys/unix/ztypes_linux_386.go b/vendor/golang.org/x/sys/unix/ztypes_linux_386.go
index 531aefab7..531409256 100644
--- a/vendor/golang.org/x/sys/unix/ztypes_linux_386.go
+++ b/vendor/golang.org/x/sys/unix/ztypes_linux_386.go
@@ -241,6 +241,10 @@ type EpollEvent struct {
}
const (
+ OPEN_TREE_CLOEXEC = 0x80000
+)
+
+const (
POLLRDHUP = 0x2000
)
@@ -318,6 +322,8 @@ type Taskstats struct {
Thrashing_count uint64
Thrashing_delay_total uint64
Ac_btime64 uint64
+ Compact_count uint64
+ Compact_delay_total uint64
}
type cpuMask uint32
diff --git a/vendor/golang.org/x/sys/unix/ztypes_linux_amd64.go b/vendor/golang.org/x/sys/unix/ztypes_linux_amd64.go
index 727f664bb..b02ab83db 100644
--- a/vendor/golang.org/x/sys/unix/ztypes_linux_amd64.go
+++ b/vendor/golang.org/x/sys/unix/ztypes_linux_amd64.go
@@ -256,6 +256,10 @@ type EpollEvent struct {
}
const (
+ OPEN_TREE_CLOEXEC = 0x80000
+)
+
+const (
POLLRDHUP = 0x2000
)
@@ -332,6 +336,8 @@ type Taskstats struct {
Thrashing_count uint64
Thrashing_delay_total uint64
Ac_btime64 uint64
+ Compact_count uint64
+ Compact_delay_total uint64
}
type cpuMask uint64
diff --git a/vendor/golang.org/x/sys/unix/ztypes_linux_arm.go b/vendor/golang.org/x/sys/unix/ztypes_linux_arm.go
index 639141b1e..9e6871d2e 100644
--- a/vendor/golang.org/x/sys/unix/ztypes_linux_arm.go
+++ b/vendor/golang.org/x/sys/unix/ztypes_linux_arm.go
@@ -232,6 +232,10 @@ type EpollEvent struct {
}
const (
+ OPEN_TREE_CLOEXEC = 0x80000
+)
+
+const (
POLLRDHUP = 0x2000
)
@@ -309,6 +313,8 @@ type Taskstats struct {
Thrashing_count uint64
Thrashing_delay_total uint64
Ac_btime64 uint64
+ Compact_count uint64
+ Compact_delay_total uint64
}
type cpuMask uint32
diff --git a/vendor/golang.org/x/sys/unix/ztypes_linux_arm64.go b/vendor/golang.org/x/sys/unix/ztypes_linux_arm64.go
index 6cb03b1d9..b732d1255 100644
--- a/vendor/golang.org/x/sys/unix/ztypes_linux_arm64.go
+++ b/vendor/golang.org/x/sys/unix/ztypes_linux_arm64.go
@@ -235,6 +235,10 @@ type EpollEvent struct {
}
const (
+ OPEN_TREE_CLOEXEC = 0x80000
+)
+
+const (
POLLRDHUP = 0x2000
)
@@ -311,6 +315,8 @@ type Taskstats struct {
Thrashing_count uint64
Thrashing_delay_total uint64
Ac_btime64 uint64
+ Compact_count uint64
+ Compact_delay_total uint64
}
type cpuMask uint64
diff --git a/vendor/golang.org/x/sys/unix/ztypes_linux_mips.go b/vendor/golang.org/x/sys/unix/ztypes_linux_mips.go
index 4a1555455..5310f71ea 100644
--- a/vendor/golang.org/x/sys/unix/ztypes_linux_mips.go
+++ b/vendor/golang.org/x/sys/unix/ztypes_linux_mips.go
@@ -237,6 +237,10 @@ type EpollEvent struct {
}
const (
+ OPEN_TREE_CLOEXEC = 0x80000
+)
+
+const (
POLLRDHUP = 0x2000
)
@@ -314,6 +318,8 @@ type Taskstats struct {
Thrashing_count uint64
Thrashing_delay_total uint64
Ac_btime64 uint64
+ Compact_count uint64
+ Compact_delay_total uint64
}
type cpuMask uint32
diff --git a/vendor/golang.org/x/sys/unix/ztypes_linux_mips64.go b/vendor/golang.org/x/sys/unix/ztypes_linux_mips64.go
index e1084926f..219bbb126 100644
--- a/vendor/golang.org/x/sys/unix/ztypes_linux_mips64.go
+++ b/vendor/golang.org/x/sys/unix/ztypes_linux_mips64.go
@@ -238,6 +238,10 @@ type EpollEvent struct {
}
const (
+ OPEN_TREE_CLOEXEC = 0x80000
+)
+
+const (
POLLRDHUP = 0x2000
)
@@ -314,6 +318,8 @@ type Taskstats struct {
Thrashing_count uint64
Thrashing_delay_total uint64
Ac_btime64 uint64
+ Compact_count uint64
+ Compact_delay_total uint64
}
type cpuMask uint64
diff --git a/vendor/golang.org/x/sys/unix/ztypes_linux_mips64le.go b/vendor/golang.org/x/sys/unix/ztypes_linux_mips64le.go
index 8904ac84e..be9432da5 100644
--- a/vendor/golang.org/x/sys/unix/ztypes_linux_mips64le.go
+++ b/vendor/golang.org/x/sys/unix/ztypes_linux_mips64le.go
@@ -238,6 +238,10 @@ type EpollEvent struct {
}
const (
+ OPEN_TREE_CLOEXEC = 0x80000
+)
+
+const (
POLLRDHUP = 0x2000
)
@@ -314,6 +318,8 @@ type Taskstats struct {
Thrashing_count uint64
Thrashing_delay_total uint64
Ac_btime64 uint64
+ Compact_count uint64
+ Compact_delay_total uint64
}
type cpuMask uint64
diff --git a/vendor/golang.org/x/sys/unix/ztypes_linux_mipsle.go b/vendor/golang.org/x/sys/unix/ztypes_linux_mipsle.go
index a1a28cc7d..d0155a42e 100644
--- a/vendor/golang.org/x/sys/unix/ztypes_linux_mipsle.go
+++ b/vendor/golang.org/x/sys/unix/ztypes_linux_mipsle.go
@@ -237,6 +237,10 @@ type EpollEvent struct {
}
const (
+ OPEN_TREE_CLOEXEC = 0x80000
+)
+
+const (
POLLRDHUP = 0x2000
)
@@ -314,6 +318,8 @@ type Taskstats struct {
Thrashing_count uint64
Thrashing_delay_total uint64
Ac_btime64 uint64
+ Compact_count uint64
+ Compact_delay_total uint64
}
type cpuMask uint32
diff --git a/vendor/golang.org/x/sys/unix/ztypes_linux_ppc.go b/vendor/golang.org/x/sys/unix/ztypes_linux_ppc.go
index abdc53452..01c17bcc6 100644
--- a/vendor/golang.org/x/sys/unix/ztypes_linux_ppc.go
+++ b/vendor/golang.org/x/sys/unix/ztypes_linux_ppc.go
@@ -244,6 +244,10 @@ type EpollEvent struct {
}
const (
+ OPEN_TREE_CLOEXEC = 0x80000
+)
+
+const (
POLLRDHUP = 0x2000
)
@@ -321,6 +325,8 @@ type Taskstats struct {
Thrashing_count uint64
Thrashing_delay_total uint64
Ac_btime64 uint64
+ Compact_count uint64
+ Compact_delay_total uint64
}
type cpuMask uint32
diff --git a/vendor/golang.org/x/sys/unix/ztypes_linux_ppc64.go b/vendor/golang.org/x/sys/unix/ztypes_linux_ppc64.go
index f4afbbe00..944a9c3c7 100644
--- a/vendor/golang.org/x/sys/unix/ztypes_linux_ppc64.go
+++ b/vendor/golang.org/x/sys/unix/ztypes_linux_ppc64.go
@@ -245,6 +245,10 @@ type EpollEvent struct {
}
const (
+ OPEN_TREE_CLOEXEC = 0x80000
+)
+
+const (
POLLRDHUP = 0x2000
)
@@ -321,6 +325,8 @@ type Taskstats struct {
Thrashing_count uint64
Thrashing_delay_total uint64
Ac_btime64 uint64
+ Compact_count uint64
+ Compact_delay_total uint64
}
type cpuMask uint64
diff --git a/vendor/golang.org/x/sys/unix/ztypes_linux_ppc64le.go b/vendor/golang.org/x/sys/unix/ztypes_linux_ppc64le.go
index ea0b8406d..5d2c90e1c 100644
--- a/vendor/golang.org/x/sys/unix/ztypes_linux_ppc64le.go
+++ b/vendor/golang.org/x/sys/unix/ztypes_linux_ppc64le.go
@@ -245,6 +245,10 @@ type EpollEvent struct {
}
const (
+ OPEN_TREE_CLOEXEC = 0x80000
+)
+
+const (
POLLRDHUP = 0x2000
)
@@ -321,6 +325,8 @@ type Taskstats struct {
Thrashing_count uint64
Thrashing_delay_total uint64
Ac_btime64 uint64
+ Compact_count uint64
+ Compact_delay_total uint64
}
type cpuMask uint64
diff --git a/vendor/golang.org/x/sys/unix/ztypes_linux_riscv64.go b/vendor/golang.org/x/sys/unix/ztypes_linux_riscv64.go
index 85d0a0d50..e173cb515 100644
--- a/vendor/golang.org/x/sys/unix/ztypes_linux_riscv64.go
+++ b/vendor/golang.org/x/sys/unix/ztypes_linux_riscv64.go
@@ -263,6 +263,10 @@ type EpollEvent struct {
}
const (
+ OPEN_TREE_CLOEXEC = 0x80000
+)
+
+const (
POLLRDHUP = 0x2000
)
@@ -339,6 +343,8 @@ type Taskstats struct {
Thrashing_count uint64
Thrashing_delay_total uint64
Ac_btime64 uint64
+ Compact_count uint64
+ Compact_delay_total uint64
}
type cpuMask uint64
diff --git a/vendor/golang.org/x/sys/unix/ztypes_linux_s390x.go b/vendor/golang.org/x/sys/unix/ztypes_linux_s390x.go
index 81dd9c22c..6106715d5 100644
--- a/vendor/golang.org/x/sys/unix/ztypes_linux_s390x.go
+++ b/vendor/golang.org/x/sys/unix/ztypes_linux_s390x.go
@@ -258,6 +258,10 @@ type EpollEvent struct {
}
const (
+ OPEN_TREE_CLOEXEC = 0x80000
+)
+
+const (
POLLRDHUP = 0x2000
)
@@ -334,6 +338,8 @@ type Taskstats struct {
Thrashing_count uint64
Thrashing_delay_total uint64
Ac_btime64 uint64
+ Compact_count uint64
+ Compact_delay_total uint64
}
type cpuMask uint64
diff --git a/vendor/golang.org/x/sys/unix/ztypes_linux_sparc64.go b/vendor/golang.org/x/sys/unix/ztypes_linux_sparc64.go
index 6991b00b5..ca7b37b4b 100644
--- a/vendor/golang.org/x/sys/unix/ztypes_linux_sparc64.go
+++ b/vendor/golang.org/x/sys/unix/ztypes_linux_sparc64.go
@@ -240,6 +240,10 @@ type EpollEvent struct {
}
const (
+ OPEN_TREE_CLOEXEC = 0x400000
+)
+
+const (
POLLRDHUP = 0x800
)
@@ -316,6 +320,8 @@ type Taskstats struct {
Thrashing_count uint64
Thrashing_delay_total uint64
Ac_btime64 uint64
+ Compact_count uint64
+ Compact_delay_total uint64
}
type cpuMask uint64
diff --git a/vendor/modules.txt b/vendor/modules.txt
index 69e276940..5d2fc47a3 100644
--- a/vendor/modules.txt
+++ b/vendor/modules.txt
@@ -72,7 +72,7 @@ github.com/containerd/containerd/sys
# github.com/containerd/stargz-snapshotter/estargz v0.11.4
github.com/containerd/stargz-snapshotter/estargz
github.com/containerd/stargz-snapshotter/estargz/errorutil
-# github.com/containernetworking/cni v1.0.1
+# github.com/containernetworking/cni v1.1.0
## explicit
github.com/containernetworking/cni/libcni
github.com/containernetworking/cni/pkg/invoke
@@ -388,7 +388,7 @@ github.com/docker/libnetwork/types
github.com/dtylman/scp
# github.com/felixge/httpsnoop v1.0.1
github.com/felixge/httpsnoop
-# github.com/fsnotify/fsnotify v1.5.3
+# github.com/fsnotify/fsnotify v1.5.4
## explicit
github.com/fsnotify/fsnotify
# github.com/fsouza/go-dockerclient v1.7.10
@@ -491,9 +491,6 @@ github.com/modern-go/concurrent
github.com/modern-go/reflect2
# github.com/morikuni/aec v1.0.0
github.com/morikuni/aec
-# github.com/mrunalp/fileutils v0.5.0
-## explicit
-github.com/mrunalp/fileutils
# github.com/nxadm/tail v1.4.8
## explicit
github.com/nxadm/tail
@@ -736,7 +733,7 @@ golang.org/x/net/trace
## explicit
golang.org/x/sync/errgroup
golang.org/x/sync/semaphore
-# golang.org/x/sys v0.0.0-20220319134239-a9b59b0215f8
+# golang.org/x/sys v0.0.0-20220412211240-33da011f77ad
## explicit
golang.org/x/sys/cpu
golang.org/x/sys/execabs
diff --git a/version/version.go b/version/version.go
index c6bd2c239..5b2ca0d74 100644
--- a/version/version.go
+++ b/version/version.go
@@ -27,7 +27,7 @@ const (
// NOTE: remember to bump the version at the top
// of the top-level README.md file when this is
// bumped.
-var Version = semver.MustParse("4.0.0-dev")
+var Version = semver.MustParse("4.1.0-dev")
// See https://docs.docker.com/engine/api/v1.40/
// libpod compat handlers are expected to honor docker API versions
@@ -38,7 +38,7 @@ var Version = semver.MustParse("4.0.0-dev")
var APIVersion = map[Tree]map[Level]semver.Version{
Libpod: {
CurrentAPI: Version,
- MinimalAPI: semver.MustParse("3.1.0"),
+ MinimalAPI: semver.MustParse("4.0.0"),
},
Compat: {
CurrentAPI: semver.MustParse("1.40.0"),