diff --git a/.fmf/version b/.fmf/version deleted file mode 100644 index d00491f..0000000 --- a/.fmf/version +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/.gitignore b/.gitignore index 5bb2950..b14dfc3 100644 --- a/.gitignore +++ b/.gitignore @@ -1834,7 +1834,6 @@ /v4.6.0.tar.gz /v4.6.1.tar.gz /v4.6.2.tar.gz -/v4.7.0-rc1.tar.gz /v4.7.0.tar.gz /v4.7.1.tar.gz /v4.7.2.tar.gz @@ -1846,51 +1845,6 @@ /v4.9.0.tar.gz /v4.9.1.tar.gz /v4.9.2.tar.gz -/v5.0.0-rc1.tar.gz -/v5.0.0-rc2.tar.gz -/v5.0.0-rc3.tar.gz -/v5.0.0-rc4.tar.gz -/v5.0.0-rc5.tar.gz -/v5.0.0-rc6.tar.gz -/v5.0.0-rc7.tar.gz -/v5.0.0.tar.gz -/v5.0.1.tar.gz -/v5.0.2.tar.gz -/v5.0.3.tar.gz -/v5.1.0-rc1.tar.gz -/v5.1.0.tar.gz -/v5.1.1.tar.gz -/v5.1.2.tar.gz -/v5.2.0-rc1.tar.gz -/v5.2.0-rc2.tar.gz -/v5.2.0.tar.gz -/v5.2.1.tar.gz -/v5.2.2.tar.gz -/v5.2.3.tar.gz -/v5.2.4.tar.gz -/v5.2.5.tar.gz -/v5.3.0-rc1.tar.gz -/v5.3.0-rc2.tar.gz -/v5.3.0-rc3.tar.gz -/v5.3.0.tar.gz -/v5.3.1.tar.gz -/v5.3.2.tar.gz -/v5.4.0-rc2.tar.gz -/v5.4.0-rc3.tar.gz -/v5.4.0.tar.gz -/v5.4.1.tar.gz -/v5.4.2.tar.gz -/v5.5.0-rc1.tar.gz -/v5.5.0-rc2.tar.gz -/v5.5.0.tar.gz -/v5.5.1.tar.gz -/v5.5.2.tar.gz -/v5.6.0-rc1.tar.gz -/v5.6.0-rc2.tar.gz -/v5.6.0.tar.gz -/v5.6.1.tar.gz -/v5.6.2.tar.gz -/v5.7.0-rc1.tar.gz -/v5.7.0-rc2.tar.gz -/v5.7.0.tar.gz -/v5.7.1.tar.gz +/v4.9.3.tar.gz +/v4.9.4.tar.gz +/v4.9.5.tar.gz diff --git a/.packit.yaml b/.packit.yaml index 117c7b5..8d0fb3e 100644 --- a/.packit.yaml +++ b/.packit.yaml @@ -2,114 +2,50 @@ # See the documentation for more information: # https://packit.dev/docs/configuration/ -downstream_package_name: podman +specfile_path: rpm/podman.spec upstream_tag_template: v{version} -# These files get synced from upstream to downstream (Fedora / CentOS Stream) on every -# propose-downstream job. This is done so tests maintained upstream can be run -# downstream in Zuul CI and Bodhi. -# Ref: https://packit.dev/docs/configuration#files_to_sync -files_to_sync: - - src: rpm/gating.yaml - dest: gating.yaml - delete: true - - src: plans/ - dest: plans/ - delete: true - mkpath: true - - src: test/tmt/ - dest: test/tmt/ - delete: true - mkpath: true - - src: .fmf/ - dest: .fmf/ - delete: true - - .packit.yaml - -packages: - podman-fedora: - pkg_tool: fedpkg - specfile_path: rpm/podman.spec - podman-centos: - pkg_tool: centpkg - specfile_path: rpm/podman.spec - podman-eln: - specfile_path: rpm/podman.spec - -# Disable automatic merging for Copr builds (and subsequent Testing Farm) -merge_pr_in_ci: false - srpm_build_deps: - git-archive-all - make actions: - fix-spec-file: "bash .packit-copr-rpm.sh" - pre-sync: "bash .packit-rpm-git-commit.sh" + fix-spec-file: + - "bash .packit.sh" jobs: - job: copr_build trigger: pull_request - packages: [podman-fedora] - notifications: &packit_generic_failure_notification + notifications: failure_comment: - message: "[NON-BLOCKING] Packit jobs failed. @containers/packit-build please check. Everyone else, feel free to ignore." + message: "Ephemeral COPR build failed. @containers/packit-build please check." enable_net: true targets: - fedora-all-x86_64 - fedora-all-aarch64 - # Re-enable these scans if OpenScanHub starts scanning go packages - # https://packit.dev/posts/openscanhub-prototype - osh_diff_scan_after_copr_build: false - - # Ignore until golang is updated in distro buildroot to go 1.23.3+ - - job: copr_build - trigger: ignore - packages: [podman-eln] - notifications: *packit_generic_failure_notification - enable_net: true - targets: - fedora-eln-x86_64: - additional_repos: - - "https://kojipkgs.fedoraproject.org/repos/eln-build/latest/x86_64/" - fedora-eln-aarch64: - additional_repos: - - "https://kojipkgs.fedoraproject.org/repos/eln-build/latest/aarch64/" - - # Ignore until golang is updated in distro buildroot to go 1.23.3+ - - job: copr_build - trigger: ignore - packages: [podman-centos] - notifications: *packit_generic_failure_notification - enable_net: true - targets: - - centos-stream-9-x86_64 - - centos-stream-9-aarch64 - - centos-stream-10-x86_64 - - centos-stream-10-aarch64 + - fedora-eln-x86_64 + - fedora-eln-aarch64 + - centos-stream+epel-next-8-x86_64 + - centos-stream+epel-next-8-aarch64 + - centos-stream+epel-next-9-x86_64 + - centos-stream+epel-next-9-aarch64 + additional_repos: + - "copr://rhcontainerbot/podman-next" # Run on commit to main branch - job: copr_build trigger: commit - packages: [podman-fedora] + notifications: + failure_comment: + message: "podman-next COPR build failed. @containers/packit-build please check." branch: main owner: rhcontainerbot project: podman-next enable_net: true - # Tests on Fedora - - job: tests - trigger: pull_request - packages: [podman-fedora] - notifications: *packit_generic_failure_notification - targets: - - fedora-all - tmt_plan: "/plans/system/*" - - job: tests identifier: cockpit-revdeps trigger: pull_request - packages: [podman-fedora] notifications: failure_comment: message: "Cockpit tests failed for commit {commit_sha}. @martinpitt, @jelly, @mvollmer please check." @@ -121,46 +57,15 @@ jobs: - artifacts: - type: repository-file id: https://copr.fedorainfracloud.org/coprs/g/cockpit/main-builds/repo/fedora-$releasever/group_cockpit-main-builds-fedora-$releasever.repo + - type: repository-file + id: https://copr.fedorainfracloud.org/coprs/rhcontainerbot/podman-next/repo/fedora-$releasever/rhcontainerbot-podman-next-fedora-$releasever.repo tmt: context: revdeps: "yes" - - job: tests - identifier: tmt-revdeps - trigger: pull_request - packages: [podman-fedora] - notifications: - failure_comment: - message: "tmt tests failed for commit {commit_sha}. @lsm5, @psss, @thrix please check." - targets: - - fedora-latest - fmf_url: https://github.com/teemtee/tmt - fmf_path: /plans/friends - fmf_ref: main - tmt_plan: "/podman" - - job: propose_downstream trigger: release update_release: false - packages: [podman-fedora] - dist_git_branches: &fedora_targets - - fedora-all - - - job: koji_build - trigger: commit - packages: [podman-fedora] - sidetag_group: podman-releases - dist_git_branches: *fedora_targets - - - job: bodhi_update - trigger: koji_build - packages: [podman-fedora] - sidetag_group: podman-releases - # Dependencies are not rpm dependencies, but packages that should go in the - # same bodhi update - # Ref: https://packit.dev/docs/fedora-releases-guide/releasing-multiple-packages - dependencies: - - buildah - - containers-common - - skopeo - dist_git_branches: *fedora_targets + dist_git_branches: + - fedora-39 + - fedora-38 diff --git a/README.packit b/README.packit index 1d2f35b..2fa216c 100644 --- a/README.packit +++ b/README.packit @@ -1,3 +1,3 @@ This repository is maintained by packit. https://packit.dev/ -The file was generated using packit 1.12.0.post1.dev22+gfe66fd850. +The file was generated using packit 0.97.1.post1.dev4+g1268842e. diff --git a/gating.yaml b/gating.yaml index 92c7dc4..5ab3627 100644 --- a/gating.yaml +++ b/gating.yaml @@ -7,11 +7,3 @@ decision_contexts: subject_type: koji_build rules: - !PassingTestCaseRule {test_case_name: fedora-ci.koji-build.tier0.functional} - -# recipients: jnovy, lsm5, santiago ---- !Policy -product_versions: - - rhel-* -decision_context: osci_compose_gate -rules: - - !PassingTestCaseRule {test_case_name: osci.brew-build.tier0.functional} diff --git a/plans/cockpit-podman.fmf b/plans/cockpit-podman.fmf deleted file mode 100644 index 9485470..0000000 --- a/plans/cockpit-podman.fmf +++ /dev/null @@ -1,37 +0,0 @@ -# reverse dependency test for https://github.com/cockpit-project/cockpit-podman/ -# packit should automatically notify the cockpit maintainers on failures. -# For questions, please contact @martinpitt, @jelly, @mvollmer -enabled: false - -adjust+: - when: revdeps == yes - enabled: true - -discover: - how: fmf - url: https://github.com/cockpit-project/cockpit-podman - ref: "main" - -execute: - how: tmt - -# not relevant for testing podman -environment: - TEST_AUDIT_NO_SELINUX: 1 - TEST_ALLOW_JOURNAL_MESSAGES: ".*" - -# This has to duplicate cockpit-podman's plan structure; see https://github.com/teemtee/tmt/issues/1770 -/podman-system: - summary: Run cockpit-podman system tests - discover+: - test: /test/browser/system - -/podman-user: - summary: Run cockpit-podman user tests - discover+: - test: /test/browser/user - -/podman-misc: - summary: Run other cockpit-podman tests - discover+: - test: /test/browser/other diff --git a/plans/system.fmf b/plans/system.fmf deleted file mode 100644 index b04c062..0000000 --- a/plans/system.fmf +++ /dev/null @@ -1,50 +0,0 @@ -discover: - how: fmf - -execute: - how: tmt - -prepare: - - how: shell - script: modprobe null_blk nr_devices=1 - order: 5 - - when: distro == centos-stream or distro == rhel - how: shell - script: | - dnf -y install https://dl.fedoraproject.org/pub/epel/epel-release-latest-$(rpm --eval '%{?rhel}').noarch.rpm - dnf -y config-manager --set-enabled epel - order: 10 - -adjust+: - - enabled: false - when: revdeps == yes - -provision: - how: artemis - hardware: - memory: ">= 16 GB" - cpu: - cores: ">= 4" - threads: ">=8" - disk: - - size: ">= 512 GB" - -/local-root: - summary: Local rootful tests - discover+: - filter: 'tag:local & tag:root' - -/local-rootless: - summary: Local rootless tests - discover+: - filter: 'tag:local & tag:rootless' - -/remote-root: - summary: Remote rootful tests - discover+: - filter: 'tag:remote & tag:root' - -/remote-rootless: - summary: Remote rootless tests - discover+: - filter: 'tag:remote & tag:rootless' diff --git a/plans/tmt.fmf b/plans/tmt.fmf deleted file mode 100644 index 1589b5c..0000000 --- a/plans/tmt.fmf +++ /dev/null @@ -1,21 +0,0 @@ -summary: Run tmt container provision test (downstream only) - -enabled: false -adjust+: - - enabled: true - when: initiator != packit and distro != rhel - -discover: - how: fmf - filter: 'tag:tmt & tag:downstream' - -execute: - how: tmt - -prepare: - - when: distro == centos-stream or distro == rhel - how: shell - script: | - dnf -y install https://dl.fedoraproject.org/pub/epel/epel-release-latest-$(rpm --eval '%{?rhel}').noarch.rpm - dnf -y config-manager --set-enabled epel - order: 10 diff --git a/plans/toolbox.fmf b/plans/toolbox.fmf deleted file mode 100644 index 0aceed0..0000000 --- a/plans/toolbox.fmf +++ /dev/null @@ -1,29 +0,0 @@ -summary: Run toolbox tests (downstream only) - -enabled: false -adjust+: - - enabled: true - when: initiator != packit and distro == fedora - -provision: - how: artemis - hardware: - memory: ">= 16 GB" - cpu: - cores: ">= 4" - threads: ">=8" - disk: - - size: ">= 512 GB" - -prepare: - - name: packages - how: install - package: [toolbox-tests] - -discover: - how: fmf - url: https://src.fedoraproject.org/rpms/toolbox - ref: "rawhide" - -execute: - how: tmt diff --git a/podman.spec b/podman.spec index 1475aed..6b99fbe 100644 --- a/podman.spec +++ b/podman.spec @@ -7,52 +7,52 @@ %global debug_package %{nil} %endif +# RHEL's default %%gobuild macro doesn't account for the BUILDTAGS variable, so we +# set it separately here and do not depend on RHEL's go-[s]rpm-macros package +# until that's fixed. +# c9s bz: https://bugzilla.redhat.com/show_bug.cgi?id=2227328 +# c8s bz: https://bugzilla.redhat.com/show_bug.cgi?id=2227331 +%if %{defined rhel} && 0%{?rhel} < 10 +%define gobuild(o:) go build -buildmode pie -compiler gc -tags="rpm_crashtraceback libtrust_openssl ${BUILDTAGS:-}" -ldflags "-linkmode=external -compressdwarf=false ${LDFLAGS:-} -B 0x$(head -c20 /dev/urandom|od -An -tx1|tr -d ' \\n') -extldflags '%__global_ldflags'" -a -v -x %{?**}; +# python3 dep conditional for rhel8 +%if %{?rhel} == 8 +%define rhel8py3 1 +%endif +%endif + %global gomodulesmode GO111MODULE=on +%if %{defined rhel} +# _user_tmpfiles.d currently undefined on rhel +%global _user_tmpfilesdir %{_datadir}/user-tmpfiles.d +%endif + %if %{defined fedora} %define build_with_btrfs 1 -# qemu-system* isn't packageed for CentOS Stream / RHEL -%define qemu 1 -# bats is included in the default repos (No epel/copr etc.) -%define distro_bats 1 -%if %{?fedora} >= 43 -%define sequoia 1 -%endif %endif %if %{defined copr_username} %define copr_build 1 -%if "%{copr_username}" == "rhcontainerbot" && "%{copr_projectname}" == "podman-next" -%define next_build 1 -%endif -%endif - -# Only RHEL and CentOS Stream rpms are built with fips-enabled go compiler -%if %{defined rhel} -%define fips_enabled 1 %endif %global container_base_path github.com/containers %global container_base_url https://%{container_base_path} # For LDFLAGS -%global ld_project %{container_base_path}/%{name}/v5 +%global ld_project %{container_base_path}/%{name}/v4 %global ld_libpod %{ld_project}/libpod # %%{name} %global git0 %{container_base_url}/%{name} -# podman-machine subpackage will be present only on these architectures -%global machine_arches x86_64 aarch64 - -%if %{defined copr_build} -%define build_origin Copr: %{?copr_username}/%{?copr_projectname} -%else -%define build_origin %{?packager} -%endif +# dnsname +%global repo_plugins dnsname +%global git_plugins %{container_base_url}/%{repo_plugins} +%global commit_plugins 18822f9a4fb35d1349eb256f4cd2bfd372474d84 +%global import_path_plugins %{container_base_path}/%{repo_plugins} Name: podman -%if %{defined next_build} +%if %{defined copr_build} Epoch: 102 %else Epoch: 5 @@ -63,19 +63,20 @@ Epoch: 5 # If that's what you're reading, Version must be 0, and will be updated by Packit for # copr and koji builds. # If you're reading this on dist-git, the version is automatically filled in by Packit. -Version: 5.7.1 +Version: 4.9.5 # The `AND` needs to be uppercase in the License for SPDX compatibility License: Apache-2.0 AND BSD-2-Clause AND BSD-3-Clause AND ISC AND MIT AND MPL-2.0 Release: %autorelease %if %{defined golang_arches_future} ExclusiveArch: %{golang_arches_future} %else -ExclusiveArch: aarch64 ppc64le s390x x86_64 riscv64 +ExclusiveArch: aarch64 ppc64le s390x x86_64 %endif Summary: Manage Pods, Containers and Container Images URL: https://%{name}.io/ # All SourceN files fetched from upstream Source0: %{git0}/archive/v%{version_no_tilde}.tar.gz +Source1: %{git_plugins}/archive/%{commit_plugins}/%{repo_plugins}-%{commit_plugins}.tar.gz Provides: %{name}-manpages = %{epoch}:%{version}-%{release} BuildRequires: %{_bindir}/envsubst %if %{defined build_with_btrfs} @@ -87,7 +88,7 @@ BuildRequires: glibc-devel BuildRequires: glibc-static BuildRequires: golang BuildRequires: git-core -%if %{undefined rhel} || 0%{?rhel} >= 10 +%if !%{defined gobuild} BuildRequires: go-rpm-macros %endif BuildRequires: gpgme-devel @@ -99,23 +100,22 @@ BuildRequires: shadow-utils-subid-devel BuildRequires: pkgconfig BuildRequires: make BuildRequires: man-db -BuildRequires: sqlite-devel +BuildRequires: ostree-devel BuildRequires: systemd BuildRequires: systemd-devel +%if %{defined rhel8py3} +BuildRequires: python3 +%endif Requires: catatonit Requires: conmon >= 2:2.1.7-2 -%if %{defined fedora} && 0%{?fedora} >= 40 -# TODO: Remove the f40 conditional after a few releases to keep conditionals to -# a minimum -# Ref: https://bugzilla.redhat.com/show_bug.cgi?id=2269148 -Requires: containers-common-extra >= 5:0.58.0-1 -%else Requires: containers-common-extra +%if %{defined rhel} && !%{defined eln} +Recommends: gvisor-tap-vsock-gvforwarder +%else +Requires: gvisor-tap-vsock-gvforwarder %endif -%if %{defined sequoia} -Requires: podman-sequoia -%endif - +Recommends: gvisor-tap-vsock +Provides: %{name}-quadlet Obsoletes: %{name}-quadlet <= 5:4.4.0-1 Provides: %{name}-quadlet = %{epoch}:%{version}-%{release} @@ -131,6 +131,8 @@ additional privileges. Both tools share image (not container) storage, hence each can use or manipulate images (but not containers) created by the other. +%{summary} +%{repo} Simple management tool for pods, containers and images %package docker Summary: Emulate Docker CLI using %{name} @@ -151,26 +153,20 @@ pages and %{name}. Summary: Tests for %{name} Requires: %{name} = %{epoch}:%{version}-%{release} -%if %{defined distro_bats} Requires: bats -%endif -Requires: attr Requires: jq Requires: skopeo Requires: nmap-ncat Requires: httpd-tools Requires: openssl Requires: socat -Requires: slirp4netns Requires: buildah Requires: gnupg -Requires: xfsprogs %description tests %{summary} -This package contains system tests for %{name}. Only intended to be used for -gating tests. Not supported for end users / customers. +This package contains system tests for %{name} %package remote Summary: (Experimental) Remote client for managing %{name} containers @@ -185,6 +181,19 @@ run %{name}-remote in production. manage pods, containers and container images. %{name}-remote supports ssh connections as well. +%package plugins +Summary: Plugins for %{name} +Requires: dnsmasq +Recommends: gvisor-tap-vsock + +%description plugins +This plugin sets up the use of dnsmasq on a given CNI network so +that Pods can resolve each other by name. When configured, +the pod and its IP address are added to a network specific hosts file +that dnsmasq will read in. Similarly, when a pod +is removed from the network, it will remove the entry from the hosts +file. Each CNI network will have its own dnsmasq instance. + %package -n %{name}sh Summary: Confined login and user shell using %{name} Requires: %{name} = %{epoch}:%{version}-%{release} @@ -198,39 +207,21 @@ capabilities specified in user quadlets. It is a symlink to %{_bindir}/%{name} and execs into the `%{name}sh` container when `%{_bindir}/%{name}sh` is set as a login shell or set as os.Args[0]. -%ifarch %{machine_arches} -%package machine -Summary: Metapackage for setting up %{name} machine -Requires: %{name} = %{epoch}:%{version}-%{release} -Requires: gvisor-tap-vsock -%if %{defined qemu} -%ifarch aarch64 -Requires: qemu-system-aarch64-core -%endif -%ifarch x86_64 -Requires: qemu-system-x86-core -%endif -%else -Requires: qemu-kvm -%endif -Requires: qemu-img -Requires: virtiofsd -ExclusiveArch: x86_64 aarch64 - -%description machine -This subpackage installs the dependencies for %{name} machine, for more see: -https://docs.podman.io/en/latest/markdown/podman-machine.1.html -%endif - %prep %autosetup -Sgit -n %{name}-%{version_no_tilde} sed -i 's;@@PODMAN@@\;$(BINDIR);@@PODMAN@@\;%{_bindir};' Makefile -# cgroups-v1 is supported on rhel9 -%if 0%{?rhel} == 9 -sed -i '/DELETE ON RHEL9/,/DELETE ON RHEL9/d' libpod/runtime.go +# These changes are only meant for copr builds +%if %{defined copr_build} +# podman --version should show short sha +sed -i "s/^const RawVersion = .*/const RawVersion = \"##VERSION##-##SHORT_SHA##\"/" version/rawversion/version.go +# use ParseTolerant to allow short sha in version +sed -i "s/^var Version.*/var Version, err = semver.ParseTolerant(rawversion.RawVersion)/" version/version.go %endif +# untar dnsname +tar zxf %{SOURCE1} + %build %set_build_flags export CGO_CFLAGS=$CFLAGS @@ -246,59 +237,49 @@ export CGO_CFLAGS+=" -m64 -mtune=generic -fcf-protection=full" export GOPROXY=direct -LDFLAGS="-X %{ld_libpod}/define.buildInfo=${SOURCE_DATE_EPOCH:-$(date +%s)} \ - -X \"%{ld_libpod}/define.buildOrigin=%{build_origin}\" \ +LDFLAGS="-X %{ld_libpod}/define.buildInfo=$(date +%s) \ -X %{ld_libpod}/config._installPrefix=%{_prefix} \ -X %{ld_libpod}/config._etcDir=%{_sysconfdir} \ -X %{ld_project}/pkg/systemd/quadlet._binDir=%{_bindir}" -# This variable will be set by Packit actions. See .packit.yaml in the root dir -# of the repo (upstream as well as Fedora dist-git). -GIT_COMMIT="f845d14e941889ba4c071f35233d09b29d363c75" -LDFLAGS="$LDFLAGS -X %{ld_libpod}/define.gitCommit=$GIT_COMMIT" - # build rootlessport first %gobuild -o bin/rootlessport ./cmd/rootlessport -export BASEBUILDTAGS="seccomp $(hack/systemd_tag.sh) $(hack/libsubid_tag.sh) libsqlite3 grpcnotrace" - -# libtrust_openssl buildtag switches to using the FIPS-compatible func -# `ecdsa.HashSign`. -# Ref 1: https://github.com/golang-fips/go/blob/main/patches/015-add-hash-sign-verify.patch#L22 -# Ref 2: https://github.com/containers/libtrust/blob/main/ec_key_openssl.go#L23 -%if %{defined fips_enabled} -export BASEBUILDTAGS="$BASEBUILDTAGS libtrust_openssl" -%endif +export BASEBUILDTAGS="seccomp exclude_graphdriver_devicemapper $(hack/systemd_tag.sh) $(hack/libsubid_tag.sh)" # build %%{name} -export BUILDTAGS="$BASEBUILDTAGS $(hack/btrfs_installed_tag.sh)" - -%if %{defined sequoia} -export BUILDTAGS="$BUILDTAGS containers_image_sequoia" -%endif - +export BUILDTAGS="$BASEBUILDTAGS $(hack/btrfs_installed_tag.sh) $(hack/btrfs_tag.sh) $(hack/libdm_tag.sh)" %gobuild -o bin/%{name} ./cmd/%{name} # build %%{name}-remote -export BUILDTAGS="$BASEBUILDTAGS exclude_graphdriver_btrfs remote" +export BUILDTAGS="$BASEBUILDTAGS exclude_graphdriver_btrfs btrfs_noversion remote" %gobuild -o bin/%{name}-remote ./cmd/%{name} # build quadlet -export BUILDTAGS="$BASEBUILDTAGS $(hack/btrfs_installed_tag.sh)" +export BUILDTAGS="$BASEBUILDTAGS $(hack/btrfs_installed_tag.sh) $(hack/btrfs_tag.sh)" %gobuild -o bin/quadlet ./cmd/quadlet -# build %%{name}-testing -export BUILDTAGS="$BASEBUILDTAGS $(hack/btrfs_installed_tag.sh)" -%gobuild -o bin/podman-testing ./cmd/podman-testing - # reset LDFLAGS for plugins binaries LDFLAGS='' %{__make} docs docker-docs +# build dnsname the old way otherwise it fails on koji +cd %{repo_plugins}-%{commit_plugins} +mkdir _build +cd _build +mkdir -p src/%{container_base_path} +ln -s ../../../../ src/%{import_path_plugins} +cd .. +ln -s vendor src +export GOPATH=$(pwd)/_build:$(pwd) +%define gomodulesmode GO111MODULE=off +%gobuild -o bin/dnsname %{import_path_plugins}/plugins/meta/dnsname +cd .. + %install install -dp %{buildroot}%{_unitdir} -PODMAN_VERSION=%{version} %{__make} DESTDIR=%{buildroot} PREFIX=%{_prefix} ETCDIR=%{_sysconfdir} \ +PODMAN_VERSION=%{version} %{__make} PREFIX=%{buildroot}%{_prefix} ETCDIR=%{_sysconfdir} \ install.bin \ install.man \ install.systemd \ @@ -306,33 +287,32 @@ PODMAN_VERSION=%{version} %{__make} DESTDIR=%{buildroot} PREFIX=%{_prefix} ETCDI install.docker \ install.docker-docs \ install.remote \ - install.testing +%if %{defined _modulesloaddir} + install.modules-load +%endif sed -i 's;%{buildroot};;g' %{buildroot}%{_bindir}/docker +# install dnsname plugin +cd %{repo_plugins}-%{commit_plugins} +%{__make} PREFIX=%{_prefix} DESTDIR=%{buildroot} install +cd .. + # do not include docker and podman-remote man pages in main package -for file in `find %{buildroot}%{_mandir}/man[157] -type f | sed "s,%{buildroot},," | grep -v -e %{name}sh.1 -e remote -e docker`; do - echo "$file*" >> %{name}.file-list +for file in `find %{buildroot}%{_mandir}/man[15] -type f | sed "s,%{buildroot},," | grep -v -e remote -e docker`; do + echo "$file*" >> podman.file-list done rm -f %{buildroot}%{_mandir}/man5/docker*.5 -install -d -p %{buildroot}%{_datadir}/%{name}/test/system -cp -pav test/system %{buildroot}%{_datadir}/%{name}/test/ - -%ifarch %{machine_arches} -# symlink virtiofsd in %%{name} libexecdir for machine subpackage -ln -s ../virtiofsd %{buildroot}%{_libexecdir}/%{name} -%endif +install -d -p %{buildroot}/%{_datadir}/%{name}/test/system +cp -pav test/system %{buildroot}/%{_datadir}/%{name}/test/ #define license tag if not already defined %{!?_licensedir:%global license %doc} -# Include empty check to silence rpmlint warning -%check - %files -f %{name}.file-list -%license LICENSE vendor/modules.txt +%license LICENSE %doc README.md CONTRIBUTING.md install.md transfer.md %{_bindir}/%{name} %dir %{_libexecdir}/%{name} @@ -349,17 +329,13 @@ ln -s ../virtiofsd %{buildroot}%{_libexecdir}/%{name} %{_tmpfilesdir}/%{name}.conf %{_systemdgeneratordir}/%{name}-system-generator %{_systemdusergeneratordir}/%{name}-user-generator -# iptables modules are only needed with iptables-legacy, -# as of f41 netavark will default to nftables so do not load unessary modules -# https://fedoraproject.org/wiki/Changes/NetavarkNftablesDefault -%if %{defined fedora} && 0%{?fedora} < 41 +%if %{defined _modulesloaddir} %{_modulesloaddir}/%{name}-iptables.conf %endif %files docker %{_bindir}/docker %{_mandir}/man1/docker*.1* -%{_sysconfdir}/profile.d/%{name}-docker.* %{_tmpfilesdir}/%{name}-docker.conf %{_user_tmpfilesdir}/%{name}-docker.conf @@ -374,18 +350,21 @@ ln -s ../virtiofsd %{buildroot}%{_libexecdir}/%{name} %{_datadir}/zsh/site-functions/_%{name}-remote %files tests -%{_bindir}/%{name}-testing %{_datadir}/%{name}/test +%files plugins +%license %{repo_plugins}-%{commit_plugins}/LICENSE +%doc %{repo_plugins}-%{commit_plugins}/{README.md,README_PODMAN.md} +%dir %{_libexecdir}/cni +%{_libexecdir}/cni/dnsname + %files -n %{name}sh %{_bindir}/%{name}sh -%{_mandir}/man1/%{name}sh.1* - -%ifarch %{machine_arches} -%files machine -%dir %{_libexecdir}/%{name} -%{_libexecdir}/%{name}/virtiofsd -%endif %changelog +%if %{defined autochangelog} %autochangelog +%else +* Mon May 01 2023 RH Container Bot +- Placeholder changelog for envs that are not autochangelog-ready +%endif diff --git a/sources b/sources index 1ab124d..ad17651 100644 --- a/sources +++ b/sources @@ -1 +1,2 @@ -SHA512 (v5.7.1.tar.gz) = 81fd4c27ff1d16dcb85229d4e4fd2cb06943ddfe966b5324fa8a8a957b2d2ec2aed7c5da05d6c009148f53b76545b27b0cba506622c8861f70bf7cad6c214a08 +SHA512 (v4.9.5.tar.gz) = 979f855d453034bb053d2cad52dd6b9050ff1a534efebf2c8967dd38c7df9139a2b546caf3d20f76fe130189233ded5e6354e2e68b1ef7bae2617f35b0f4ad4d +SHA512 (dnsname-18822f9a4fb35d1349eb256f4cd2bfd372474d84.tar.gz) = de371722fbf18cd23b31485ee7ba36bb41d0d9a932d15e50872989c3ca1ff7246da63143c3725d81089fadda3821a54c18b22150d9d16005b07df6824f5f71f8 diff --git a/test/tmt/system.fmf b/test/tmt/system.fmf deleted file mode 100644 index 65f4dd0..0000000 --- a/test/tmt/system.fmf +++ /dev/null @@ -1,51 +0,0 @@ -require: - - podman-tests - - psmisc - -environment: - # PODMAN_TESTING envvar is set in system.sh - PODMAN: /usr/bin/podman - QUADLET: /usr/libexec/podman/quadlet - ROOTLESS_USER: "fedora" -adjust+: - - when: distro == centos-stream - environment+: - ROOTLESS_USER: "ec2-user" - - when: distro == rhel - environment+: - ROOTLESS_USER: "cloud-user" - - when: initiator != "packit" - environment+: - RELEASE_TESTING: true - -/local-root: - tag: [ local, root ] - summary: local rootful test - test: bash ./system.sh - duration: 30m - -/local-rootless: - tag: [ local, rootless ] - summary: rootless test - test: bash ./system.sh rootless - duration: 30m - -/remote-root: - tag: [ remote, root ] - summary: remote rootful test - test: bash ./system.sh - duration: 30m - environment+: - PODMAN: /usr/bin/podman-remote - require+: - - podman-remote - -/remote-rootless: - tag: [ remote, rootless ] - summary: remote rootless test - test: bash ./system.sh rootless - duration: 30m - environment+: - PODMAN: /usr/bin/podman-remote - require+: - - podman-remote diff --git a/test/tmt/system.sh b/test/tmt/system.sh deleted file mode 100644 index 3cd29da..0000000 --- a/test/tmt/system.sh +++ /dev/null @@ -1,44 +0,0 @@ -#!/usr/bin/env bash - -set -exo pipefail - -uname -r - -loginctl enable-linger "$ROOTLESS_USER" - -rpm -q \ - aardvark-dns \ - buildah \ - conmon \ - container-selinux \ - containers-common \ - criu \ - crun \ - netavark \ - passt \ - podman \ - podman-tests \ - skopeo \ - slirp4netns \ - systemd - -export system_service_cmd="/usr/bin/podman system service --timeout=0 &" -export test_cmd="whoami && cd /usr/share/podman/test/system && PODMAN_TESTING=/usr/bin/podman-testing bats ." - -if [[ -z $1 ]]; then - if [[ $PODMAN == "/usr/bin/podman-remote" ]]; then - eval "$system_service_cmd" - fi - eval "$test_cmd" -elif [[ $1 == "rootless" ]]; then - if [[ $PODMAN == "/usr/bin/podman-remote" ]]; then - su - "$ROOTLESS_USER" -c "eval $system_service_cmd" - fi - su - "$ROOTLESS_USER" -c "eval $test_cmd" -fi - -# Kill all podman processes for remote tests -if [[ $PODMAN == "/usr/bin/podman-remote" ]]; then - killall -q podman -fi -exit 0 diff --git a/test/tmt/tmt.fmf b/test/tmt/tmt.fmf deleted file mode 100644 index f016947..0000000 --- a/test/tmt/tmt.fmf +++ /dev/null @@ -1,13 +0,0 @@ -enabled: false -adjust: - enabled: true - when: initiator != packit && distro != rhel -summary: Make sure that TMT container provision works -tag: [downstream] -require: - - tmt+provision-container -test: - tmt run --verbose --remove - provision --how container --image fedora - login --command 'cat /etc/os-release' - finish diff --git a/tests/README b/tests/README new file mode 100644 index 0000000..672acdb --- /dev/null +++ b/tests/README @@ -0,0 +1,25 @@ +I'm sorry. The playbooks here are a much-too-complicated way of saying: + + - test podman (root and rootless) under cgroups v2 + - reboot into cgroups v1 + - repeat the same podman tests + +We can't use standard-test-basic any more because, tl;dr, that has to +be the last stanza in the playbook and it doesn't offer any mechanism +for running a reboot in the middle of tests. (I actually found a way +but it was even uglier than this approach). + +The starting point is tests.yml . From there: + + tests.yml + \- test_podman.yml + |- roles/rootless_user_ready/ + \- test_podman_cgroups_vn.yml (runs twice: cgroups v2, v1) + |- roles/set_cgroups/ + \- roles/run_bats_tests/ (runs tests: root, rootless) + +Principal result is the file 'artifacts/test.log'. It will contain +one line for each test run, format will be '(PASS|FAIL|ERROR) ' + +For each completed test there will also be a 'test..bats.log' +containing some setup blurbs (RPMs, environment) and the full BATS log. diff --git a/tests/check_results.yml b/tests/check_results.yml new file mode 100644 index 0000000..e1de3bd --- /dev/null +++ b/tests/check_results.yml @@ -0,0 +1,36 @@ +--- +# Copied from standard-test-basic +# ...and, 2020-05-13, updated, looks like they changed the whole thing around +- name: Check the results + local_action: + module: shell + cmd: | + log="{{ artifacts }}/test.log" + if [ ! -f "$log" ]; then + echo ERROR + echo "Test results not found." 1>&2 + elif grep ^ERROR "$log" 1>&2; then + echo ERROR + elif grep ^FAIL "$log" 1>&2; then + echo FAIL + elif grep -q ^PASS "$log"; then + echo PASS + else + echo ERROR + echo "No test results found." 1>&2 + fi + register: test_results + +- name: Set role result + set_fact: + role_result: "{{ test_results.stdout }}" + role_message: "{{ test_results.stderr|d('test execution error.') }}" + +- name: display results + vars: + msg: | + role_result: {{ role_result|d('Undefined') }} + {{ role_message|d('[No error messages found]') }} + debug: + msg: "{{ msg.split('\n') }}" + failed_when: role_message|d("") != "" diff --git a/tests/roles/disable_systemd_resolved/files/disable_systemd_resolved.sh b/tests/roles/disable_systemd_resolved/files/disable_systemd_resolved.sh new file mode 100755 index 0000000..f5cb4da --- /dev/null +++ b/tests/roles/disable_systemd_resolved/files/disable_systemd_resolved.sh @@ -0,0 +1,41 @@ +#!/bin/bash +# +# Excerpted from https://github.com/containers/automation_images/blob/main/systemd_banish.sh +# +# Early 2023: https://github.com/containers/podman/issues/16973 +# +# We see countless instances of "lookup cdn03.quay.io" flakes. +# Disabling the systemd resolver has completely resolved those, +# from multiple flakes per day to zero in a month. +# +# Opinions differ on the merits of systemd-resolve, but the fact is +# it breaks our CI testing. Kill it. +nsswitch=/etc/authselect/nsswitch.conf +if [[ -e $nsswitch ]]; then + if grep -q -E 'hosts:.*resolve' $nsswitch; then + echo "Disabling systemd-resolved" + sed -i -e 's/^\(hosts: *\).*/\1files dns myhostname/' $nsswitch + systemctl disable --now systemd-resolved + rm -f /etc/resolv.conf + + # NetworkManager may already be running, or it may not.... + systemctl start NetworkManager + sleep 1 + systemctl restart NetworkManager + + # ...and it may create resolv.conf upon start/restart, or it + # may not. Keep restarting until it does. (Yes, I realize + # this is cargocult thinking. Don't care. Not worth the effort + # to diagnose and solve properly.) + retries=10 + while ! test -e /etc/resolv.conf;do + retries=$((retries - 1)) + if [[ $retries -eq 0 ]]; then + echo "Timed out waiting for resolv.conf" >&2 + echo "...gonna try continuing. Expect failures." >&2 + fi + systemctl restart NetworkManager + sleep 5 + done + fi +fi diff --git a/tests/roles/disable_systemd_resolved/tasks/main.yml b/tests/roles/disable_systemd_resolved/tasks/main.yml new file mode 100644 index 0000000..7c77540 --- /dev/null +++ b/tests/roles/disable_systemd_resolved/tasks/main.yml @@ -0,0 +1,3 @@ +--- +- name: disable systemd resolved + script: ./disable_systemd_resolved.sh diff --git a/tests/roles/rootless_user_ready/tasks/main.yml b/tests/roles/rootless_user_ready/tasks/main.yml new file mode 100644 index 0000000..88ad032 --- /dev/null +++ b/tests/roles/rootless_user_ready/tasks/main.yml @@ -0,0 +1,14 @@ +--- +- name: make sure rootless account exists + user: name={{ rootless_user }} + +- name: rootless account | enable linger + shell: loginctl enable-linger {{ rootless_user }} + +- name: rootless account | get uid + getent: + database: passwd + key: "{{ rootless_user }}" + +- name: rootless account | preserve uid + set_fact: rootless_uid="{{ getent_passwd[rootless_user][1] }}" diff --git a/tests/roles/run_bats_tests/files/run_bats_tests.sh b/tests/roles/run_bats_tests/files/run_bats_tests.sh new file mode 100755 index 0000000..f1df29d --- /dev/null +++ b/tests/roles/run_bats_tests/files/run_bats_tests.sh @@ -0,0 +1,73 @@ +#!/bin/bash +# +# Run bats tests for a given $TEST_PACKAGE, e.g. buildah, podman +# +# This is invoked by the 'run_bats_tests' role; we assume that +# the package foo has a foo-tests subpackage which provides the +# directory /usr/share/foo/test/system, containing one or more .bats +# test files. +# +# We create two files: +# +# /tmp/test.summary.log - one-liner with FAIL, PASS, ERROR and a blurb +# /tmp/test.bats.log - full log of this script, plus the BATS run +# +export PATH=/usr/local/bin:/usr/sbin:/usr/bin + +FULL_LOG=/tmp/test.bats.log +rm -f $FULL_LOG +touch $FULL_LOG + +# Preserve output to a log file, but also emit on stdout. This covers +# RHEL (which preserves logfiles but runs ansible without --verbose) +# and Fedora (which hides logfiles but runs ansible --verbose). +exec &> >(tee -a $FULL_LOG) + +# Log program versions +echo "Packages:" +echo " Kernel: $(uname -r)" +rpm -qa |\ + grep -E 'toolbox|podman|conmon|containers-common|crun|runc|iptable|slirp|aardvark|netavark|containernetworking-plugins|systemd|container-selinux|passt' |\ + sort |\ + sed -e 's/^/ /' + +divider='------------------------------------------------------------------' +echo $divider +printenv | sort +echo $divider +echo "ip addr:" +ip addr +echo $divider + +testdir=/usr/share/${TEST_PACKAGE}/test/system + +if ! cd $testdir; then + echo "FAIL ${TEST_NAME} : cd $testdir" > /tmp/test.summary.log + exit 0 +fi + +if [[ $PODMAN =~ remote ]]; then + ${PODMAN%%-remote} system service -t0 &>/dev/null & + PODMAN_SERVER_PID=$! +fi + +echo "\$ bats ." +bats . +rc=$? + +if [[ -n "$PODMAN_SERVER_PID" ]]; then + kill $PODMAN_SERVER_PID +fi + +echo $divider +echo "bats completed with status $rc" + +status=PASS +if [ $rc -ne 0 ]; then + status=FAIL +fi + +echo "${status} ${TEST_NAME}" > /tmp/test.summary.log + +# FIXME: for CI purposes, always exit 0. This allows subsequent tests. +exit 0 diff --git a/tests/roles/run_bats_tests/tasks/main.yml b/tests/roles/run_bats_tests/tasks/main.yml new file mode 100644 index 0000000..a207c05 --- /dev/null +++ b/tests/roles/run_bats_tests/tasks/main.yml @@ -0,0 +1,10 @@ +--- +# Create empty results file, world-writable +- name: initialize test.log file + copy: dest=/tmp/test.log content='' force=yes mode=0666 + +- name: execute tests + include: run_one_test.yml + with_items: "{{ tests }}" + loop_control: + loop_var: test diff --git a/tests/roles/run_bats_tests/tasks/run_one_test.yml b/tests/roles/run_bats_tests/tasks/run_one_test.yml new file mode 100644 index 0000000..9ef8cb7 --- /dev/null +++ b/tests/roles/run_bats_tests/tasks/run_one_test.yml @@ -0,0 +1,87 @@ +--- +- name: "{{ test.name }} | install test packages" + dnf: name="{{ test.package }}-tests" state=installed + +- name: "{{ test.name }} | define helper variables" + set_fact: + test_name_oneword: "{{ test.name | replace(' ','-') }}" + +# UGH. This is necessary because our caller sets some environment variables +# and we need to set a few more based on other caller variables; then we +# need to combine the two dicts when running the test. This seems to be +# the only way to do it in ansible. +- name: "{{ test.name }} | define local environment" + set_fact: + local_environment: + TEST_NAME: "{{ test.name }}" + TEST_PACKAGE: "{{ test.package }}" + TEST_ENV: "{{ test.environment }}" + +- name: "{{ test.name }} | setup/teardown helper | see if exists" + local_action: stat path={{ role_path }}/files/helper.{{ test_name_oneword }}.sh + register: helper + +- name: "{{ test.name }} | setup/teardown helper | install" + copy: src=helper.{{ test_name_oneword }}.sh dest=/tmp/helper.sh + when: helper.stat.exists + +# This is what runs the BATS tests. +- name: "{{ test.name }} | run test" + script: ./run_bats_tests.sh + args: + chdir: /usr/share/{{ test.package }}/test/system + become: "{{ true if test.become is defined else false }}" + become_user: "{{ rootless_user }}" + environment: "{{ local_environment | combine(test.environment) }}" + +# BATS tests will always exit zero and should leave behind two files: +# a full log (test.bats.log) and a one-line PASS/FAIL file (.summary.log) +- name: "{{ test.name }} | pull logs" + fetch: + src: "/tmp/test.{{ item }}.log" + dest: "{{ artifacts }}/test.{{ test_name_oneword }}.{{ item }}.log" + flat: yes + with_items: + - bats + - summary + +# Collect all the one-line PASS/FAIL results in one file, test.log +# Write the same thing, in a different format, to results.yml +# https://docs.fedoraproject.org/en-US/ci/standard-test-interface/ +- name: "{{ test.name }} | keep running tally of test results" + local_action: + module: shell + cmd: | + cd {{ artifacts }} + cat "test.{{ test_name_oneword }}.summary.log" >>test.log + + status=$(awk '{print $1}' >results.yml + echo " result: $status" >>results.yml + echo " logs: test.{{ test_name_oneword }}.bats.log" >>results.yml + + # delete the oneliner file, to keep artifacts dir clean + rm -f test.{{ test_name_oneword }}.summary.log + +- name: "{{ test.name }} | remove remote logs and helpers" + file: + dest=/tmp/{{ item }} + state=absent + with_items: + - test.bats.log + - test.summary.log + - helper.sh + +# AAAAARGH! +# +# Fedora gating tests are failing, because str-common-final/tasks/main.yml +# tries to pull test.log and other logs from $remote_host:/tmp/artifacts . +# Those don't exist, because I track status and artifacts locally, because +# with the reboot I can't rely on /tmp being preserved. +# I see no way to tell str-common-final to skip this step; so let's just +# push logs over upon completion of each subtest. +- name: keep remote artifacts synced + synchronize: + src: "{{ artifacts }}/" + dest: "{{ remote_artifacts|d('/tmp/artifacts') }}/" + mode: push diff --git a/tests/roles/set_cgroups/tasks/main.yml b/tests/roles/set_cgroups/tasks/main.yml new file mode 100644 index 0000000..a900673 --- /dev/null +++ b/tests/roles/set_cgroups/tasks/main.yml @@ -0,0 +1,73 @@ +--- +# Check the CURRENT cgroup level; we get this from /proc/cmdline +- name: check current kernel options + shell: fgrep systemd.unified_cgroup_hierarchy=0 /proc/cmdline + register: result + ignore_errors: true + +- name: determine current cgroups | assume v2 + set_fact: current_cgroups=2 + +- name: determine current cgroups | looks like v1 + set_fact: current_cgroups=1 + when: result is succeeded + +- debug: + msg: "want: v{{ want_cgroups }} actual: v{{ current_cgroups }}" + +- name: grubenv, pre-edit, cat + shell: cat /boot/grub2/grubenv + register: grubenv + +- name: grubenv, pre-edit, show + debug: + msg: "{{ grubenv.stdout_lines }}" + +# Update grubenv file to reflect the desired cgroup level +- name: remove cgroup option from kernel flags + shell: + cmd: sed -i -e "s/^\(kernelopts=.*\)systemd\.unified_cgroup_hierarchy=.\(.*\)/\1 \2/" /boot/grub2/grubenv + +- name: add it with the desired value + shell: + cmd: sed -i -e "s/^\(kernelopts=.*\)/\1 systemd.unified_cgroup_hierarchy=0/" /boot/grub2/grubenv + when: want_cgroups == 1 + +- name: grubenv, post-edit, cat + shell: cat /boot/grub2/grubenv + register: grubenv + +- name: grubenv, post-edit, show + debug: + msg: "post: {{ grubenv.stdout_lines }}" + +# If want != have, reboot +- name: reboot and wait + block: + - name: reboot + reboot: + reboot_timeout: 900 + ignore_errors: yes + - name: wait and reconnect + wait_for_connection: + timeout: 900 + when: want_cgroups|int != current_cgroups|int + +- set_fact: + expected_fstype: + - none + - tmpfs + - cgroup2fs + +- name: confirm cgroups setting + shell: stat -f -c "%T" /sys/fs/cgroup + register: fstype + +- debug: + msg: "stat(/sys/fs/cgroup) = {{ fstype.stdout }}" + +- name: system cgroups is the expected type + assert: + that: + - fstype.stdout == expected_fstype[want_cgroups|int] + fail_msg: "stat(/sys/fs/cgroup) = {{ fstype.stdout }} (expected {{ expected_fstype[want_cgroups|int] }})" diff --git a/tests/test_podman.yml b/tests/test_podman.yml new file mode 100644 index 0000000..a47cd5d --- /dev/null +++ b/tests/test_podman.yml @@ -0,0 +1,51 @@ +--- +- hosts: localhost + tags: + - classic + - container + vars: + - artifacts: ./artifacts + rootless_user: testuser + roles: + - role: disable_systemd_resolved + - role: rootless_user_ready + + tasks: + # At the start of a run, clean up state. Useful for test reruns. + - name: local artifacts directory exists + local_action: file path="{{ artifacts }}" state=directory + + - name: remove stale log files + local_action: shell rm -f {{ artifacts }}/test*.log + + - name: clear test results (test.log) + local_action: command truncate --size=0 {{ artifacts }}/test.log + + - name: clear test results (results.yml) + local_action: copy content="results:\n" dest={{ artifacts }}/results.yml + + # These are the actual tests: set cgroups vN, then run root/rootless tests. + # + # FIXME FIXME FIXME: 2020-05-21: 'loop' should be '2, 1' but there's some + # nightmarish bug in CI wherein reboots hang forever. There's a bug open[1] + # but it seems dead. Without a working reboot, there's no way to test v1. + # [1] https://redhat.service-now.com/surl.do?n=PNT0808530 + # I'm leaving this as a 'loop' in (foolish? vain?) hope that the bug will + # be fixed. Let's revisit this after, say, 2020-08. If the bug persists + # then let's just revert the entire cgroups v1 change, and go back to + # using standard-test-basic. + - name: set cgroups and run podman tests + include_tasks: test_podman_cgroups_vn.yml + loop: [ 2 ] + loop_control: + loop_var: want_cgroups + + - name: test podman-remote + include_tasks: test_podman_remote.yml + + - name: test toolbx + include_tasks: test_toolbx.yml + + # Postprocessing: check for FAIL or ERROR in any test, exit 1 if so + - name: check results + include_tasks: check_results.yml diff --git a/tests/test_podman_cgroups_vn.yml b/tests/test_podman_cgroups_vn.yml new file mode 100644 index 0000000..5d48663 --- /dev/null +++ b/tests/test_podman_cgroups_vn.yml @@ -0,0 +1,21 @@ +--- +# Requires: 'want_cgroups' variable set to 1 or 2 +- include_role: + name: set_cgroups +- include_role: + name: run_bats_tests + vars: + tests: + # Yes, this is horrible duplication, but trying to refactor in ansible + # yields even more horrible unreadable code. This is the lesser evil. + - name: podman root cgroupsv{{ want_cgroups }} + package: podman + environment: + PODMAN: /usr/bin/podman + QUADLET: /usr/libexec/podman/quadlet + - name: podman rootless cgroupsv{{ want_cgroups }} + package: podman + environment: + PODMAN: /usr/bin/podman + QUADLET: /usr/libexec/podman/quadlet + become: true diff --git a/tests/test_podman_remote.yml b/tests/test_podman_remote.yml new file mode 100644 index 0000000..204d137 --- /dev/null +++ b/tests/test_podman_remote.yml @@ -0,0 +1,19 @@ +--- +- name: "podman-remote | install" + dnf: name="podman-remote" state=installed + +- include_role: + name: run_bats_tests + vars: + tests: + - name: podman-remote root + package: podman + environment: + PODMAN: /usr/bin/podman-remote + QUADLET: /usr/libexec/podman/quadlet + - name: podman-remote rootless + package: podman + environment: + PODMAN: /usr/bin/podman-remote + QUADLET: /usr/libexec/podman/quadlet + become: true diff --git a/tests/test_toolbx.yml b/tests/test_toolbx.yml new file mode 100644 index 0000000..58494f4 --- /dev/null +++ b/tests/test_toolbx.yml @@ -0,0 +1,11 @@ +--- +- include_role: + name: run_bats_tests + vars: + tests: + - name: toolbx + package: toolbox + become: true + environment: + TMPDIR: /var/tmp + XDG_RUNTIME_DIR: /run/user/{{ rootless_uid }} diff --git a/tests/tests.yml b/tests/tests.yml new file mode 100644 index 0000000..80caee7 --- /dev/null +++ b/tests/tests.yml @@ -0,0 +1 @@ +- import_playbook: test_podman.yml