From c92c69f13a0f18cbf862b935a19b7f4ec252b239 Mon Sep 17 00:00:00 2001 From: Lokesh Mandvekar Date: Thu, 28 Nov 2024 19:05:11 +0530 Subject: [PATCH] [skip-ci] [IGNORE] tmt for downstream gating sync Signed-off-by: Lokesh Mandvekar --- .packit.yaml | 67 ++++++++++++++++++++++++++++++++++++++++---- Makefile | 19 +++++++------ plans/main.fmf | 26 +++++++++++++++++ rpm/gating.yaml | 18 ++++++++++++ rpm/podman.spec | 8 ++++++ test/system/main.fmf | 41 +++++++++++++++++++++++++++ test/tmt/main.fmf | 6 ++++ 7 files changed, 172 insertions(+), 13 deletions(-) create mode 100644 plans/main.fmf create mode 100644 rpm/gating.yaml create mode 100644 test/system/main.fmf create mode 100644 test/tmt/main.fmf diff --git a/.packit.yaml b/.packit.yaml index 637e02041b..607b607687 100644 --- a/.packit.yaml +++ b/.packit.yaml @@ -5,6 +5,25 @@ downstream_package_name: podman 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 + mkpath: true + - src: plans/main.fmf + dest: plans/main.fmf + delete: true + mkpath: true + - src: .fmf/ + dest: .fmf/ + delete: true + mkpath: true + - .packit.yaml + packages: podman-fedora: pkg_tool: fedpkg @@ -31,12 +50,12 @@ jobs: failure_comment: message: "Ephemeral COPR build failed. @containers/packit-build please check." enable_net: true - targets: + targets: &fedora_copr_targets - fedora-all-x86_64 - fedora-all-aarch64 - job: copr_build - trigger: pull_request + trigger: ignore packages: [podman-eln] notifications: *packit_build_failure_notification enable_net: true @@ -49,11 +68,11 @@ jobs: - "https://kojipkgs.fedoraproject.org/repos/eln-build/latest/aarch64/" - job: copr_build - trigger: pull_request + trigger: ignore packages: [podman-centos] notifications: *packit_build_failure_notification enable_net: true - targets: + targets: ¢os_copr_targets - centos-stream-9-x86_64 - centos-stream-9-aarch64 - centos-stream-10-x86_64 @@ -72,9 +91,47 @@ jobs: enable_net: true - job: tests - identifier: cockpit-revdeps trigger: pull_request packages: [podman-fedora] + targets: *fedora_copr_targets + tf_extra_params: + environments: + - artifacts: + - type: repository-file + id: https://copr.fedorainfracloud.org/coprs/rhcontainerbot/podman-next/repo/fedora-$releasever/rhcontainerbot-podman-next-fedora-$releasever.repo + + - job: tests + trigger: pull_request + packages: [podman-fedora] + targets: *fedora_copr_targets + require: + label: + present: + - release + + - job: tests + trigger: ignore + packages: [podman-centos] + targets: *centos_copr_targets + tf_extra_params: + environments: + - artifacts: + - type: repository-file + id: https://copr.fedorainfracloud.org/coprs/rhcontainerbot/podman-next/repo/centos-stream-$releasever/rhcontainerbot-podman-next-centos-stream-$releasever.repo + + - job: tests + trigger: ignore + packages: [podman-centos] + targets: *centos_copr_targets + require: + label: + present: + - release + + - job: tests + identifier: cockpit-revdeps + trigger: ignore + packages: [podman-fedora] notifications: failure_comment: message: "Cockpit tests failed for commit {commit_sha}. @martinpitt, @jelly, @mvollmer please check." diff --git a/Makefile b/Makefile index a17270fe78..20dbb35163 100644 --- a/Makefile +++ b/Makefile @@ -78,6 +78,9 @@ SED=sed GREP=grep MAN_L= man -l endif +PODMAN ?= $(CURDIR)/bin/podman +PODMAN_REMOTE ?= $(CURDIR)/bin/podman-remote +QUADLET ?= $(CURDIR)/bin/quadlet # This isn't what we actually build; it's a superset, used for target # dependencies. Basically: all *.go and *.c files, except *_test.go, @@ -706,8 +709,8 @@ localmachine: localsystem: # Wipe existing config, database, and cache: start with clean slate. $(RM) -rf ${HOME}/.local/share/containers ${HOME}/.config/containers - PODMAN=$(CURDIR)/bin/podman QUADLET=$(CURDIR)/bin/quadlet bats -T --filter-tags '!ci:parallel' test/system/ - PODMAN=$(CURDIR)/bin/podman QUADLET=$(CURDIR)/bin/quadlet bats -T --filter-tags ci:parallel -j $$(nproc) test/system/ + PODMAN=$(PODMAN) QUADLET=$(QUADLET) bats -T --filter-tags '!ci:parallel' test/system/ + PODMAN=$(PODMAN) QUADLET=$(QUADLET) bats -T --filter-tags ci:parallel -j $$(nproc) test/system/ .PHONY: remotesystem remotesystem: @@ -720,26 +723,26 @@ remotesystem: # . Stop server. rc=0;\ if timeout -v 1 true; then \ - if ./bin/podman-remote info; then \ + if $(PODMAN_REMOTE) info; then \ echo "Error: podman system service (not ours) is already running" >&2;\ exit 1;\ fi;\ - ./bin/podman system service --timeout=0 > $(if $(PODMAN_SERVER_LOG),$(PODMAN_SERVER_LOG),/dev/null) 2>&1 & \ + $(PODMAN) system service --timeout=0 > $(if $(PODMAN_SERVER_LOG),$(PODMAN_SERVER_LOG),/dev/null) 2>&1 & \ retry=5;\ while [ $$retry -ge 0 ]; do\ echo Waiting for server...;\ sleep 1;\ - ./bin/podman-remote info >/dev/null 2>&1 && break;\ + $(PODMAN_REMOTE) info >/dev/null 2>&1 && break;\ retry=$$(expr $$retry - 1);\ done;\ if [ $$retry -lt 0 ]; then\ - echo "Error: ./bin/podman system service did not come up" >&2;\ + echo "Error: $(PODMAN) system service did not come up" >&2;\ exit 1;\ fi;\ - env PODMAN="$(CURDIR)/bin/podman-remote" bats -T --filter-tags '!ci:parallel' test/system/ ;\ + env PODMAN="$(PODMAN_REMOTE)" bats -T --filter-tags '!ci:parallel' test/system/ ;\ rc=$$?; \ if [ $$rc -eq 0 ]; then \ - env PODMAN="$(CURDIR)/bin/podman-remote" bats -T --filter-tags ci:parallel -j $$(nproc) test/system/ ;\ + env PODMAN="$(PODMAN_REMOTE)" bats -T --filter-tags ci:parallel -j $$(nproc) test/system/ ;\ rc=$$?;\ fi; \ kill %1;\ diff --git a/plans/main.fmf b/plans/main.fmf new file mode 100644 index 0000000000..a5bd7d4de8 --- /dev/null +++ b/plans/main.fmf @@ -0,0 +1,26 @@ +discover: + how: fmf +execute: + how: tmt +prepare: + - how: shell + script: loginctl enable-linger fedora + +/upstream: + summary: Run tests on upstream PRs + discover+: + filter: tag:upstream + adjust+: + enabled: false + when: initiator is not defined or initiator != packit + +/downstream: + summary: Run tests on bodhi / errata and dist-git PRs + discover+: + filter: tag:downstream + dist-git-install-builddeps: true + dist-git-source: true + dist-git-remove-fmf-root: true + adjust+: + enabled: false + when: initiator == packit diff --git a/rpm/gating.yaml b/rpm/gating.yaml new file mode 100644 index 0000000000..ad0c790c44 --- /dev/null +++ b/rpm/gating.yaml @@ -0,0 +1,18 @@ +--- !Policy +product_versions: + - fedora-* +decision_contexts: + - bodhi_update_push_stable + - bodhi_update_push_testing +subject_type: koji_build +rules: + - !PassingTestCaseRule {test_case_name: fedora-ci.koji-build.tier0.functional} + +# recipients: jnovy, lsm5, santiago +--- !Policy +product_versions: + - rhel-10 + - rhel-9 +decision_context: osci_compose_gate +rules: + - !PassingTestCaseRule {test_case_name: osci.brew-build.tier0.functional} diff --git a/rpm/podman.spec b/rpm/podman.spec index 7333fc4ff2..2f73dd29c1 100644 --- a/rpm/podman.spec +++ b/rpm/podman.spec @@ -24,6 +24,8 @@ %if %{defined fedora} %define build_with_btrfs 1 +# No machine stuff for rhel +%define machine 1 %endif %if %{defined copr_username} @@ -179,6 +181,7 @@ 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]. +%if %{defined machine} %package machine Summary: Metapackage for setting up %{name} machine Requires: %{name} = %{epoch}:%{version}-%{release} @@ -189,6 +192,7 @@ Requires: virtiofsd %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} @@ -282,8 +286,10 @@ rm -f %{buildroot}%{_mandir}/man5/docker*.5 install -d -p %{buildroot}%{_datadir}/%{name}/test/system cp -pav test/system %{buildroot}%{_datadir}/%{name}/test/ +%if %{defined machine} # symlink virtiofsd in %%{name} libexecdir for machine subpackage ln -s ../virtiofsd %{buildroot}%{_libexecdir}/%{name} +%endif #define license tag if not already defined %{!?_licensedir:%global license %doc} @@ -338,9 +344,11 @@ ln -s ../virtiofsd %{buildroot}%{_libexecdir}/%{name} %{_bindir}/%{name}sh %{_mandir}/man1/%{name}sh.1* +%if %{defined machine} %files machine %dir %{_libexecdir}/%{name} %{_libexecdir}/%{name}/virtiofsd +%endif %changelog %autochangelog diff --git a/test/system/main.fmf b/test/system/main.fmf new file mode 100644 index 0000000000..a677dc4c7b --- /dev/null +++ b/test/system/main.fmf @@ -0,0 +1,41 @@ +require: + - bats + - golang + - httpd-tools + - make + - podman + - podman-remote + - podman-tests + - skopeo + - slirp4netns + - socat + +environment: + PODMAN: /usr/bin/podman + PODMAN_REMOTE: /usr/bin/podman-remote + PODMAN_TESTING: /usr/bin/podman-testing + QUADLET: /usr/libexec/podman/quadlet + +/local-root: + tag: [ downstream, upstream, centos, fedora, local, rootful ] + summary: rootful test + test: make -C ../.. localsystem + duration: 60m + +/local-rootless: + tag: [ downstream, upstream, centos, fedora, local, rootless ] + summary: rootless test + test: chown -Rf fedora:fedora ../../* /var/ARTIFACTS/* && runuser fedora -c 'make -C ../.. localsystem' + duration: 60m + +/remote-root: + tag: [ downstream, upstream, centos, fedora, remote, rootful ] + summary: remote rootful test + test: make -C ../.. remotesystem + duration: 60m + +/remote-rootless: + tag: [ downstream, upstream, centos, fedora, remote, rootless ] + summary: remote rootless test + test: chown -Rf fedora:fedora ../../* /var/ARTIFACTS/* && runuser fedora -c 'make -C ../.. remotesystem' + duration: 60m diff --git a/test/tmt/main.fmf b/test/tmt/main.fmf new file mode 100644 index 0000000000..653d0c29a9 --- /dev/null +++ b/test/tmt/main.fmf @@ -0,0 +1,6 @@ +tag: [centos] +summary: Make sure that container provision works +require: + - tmt+provision-container +test: + tmt run --verbose --remove provision --how container --image fedora login --command 'cat /etc/os-release' finish