From e9a0088549b420d22d2432ae4bde38456d676efe Mon Sep 17 00:00:00 2001 From: Lokesh Mandvekar Date: Tue, 24 Dec 2024 15:25:08 +0530 Subject: [PATCH] [skip-ci] TMT: system tests This commit adds TMT jobs for system tests triggered via Packit for all active Fedora and CentOS Stream releases on x86_64 and aarch64. Official Fedora and CentOS Stream spec and gating test configs can be synced from upstream by Packit, effectively upstreaming almost all mainteenance. Signed-off-by: Lokesh Mandvekar --- .fmf/version | 1 + .packit.yaml | 76 ++++++++++++++++++++++++++++++++++++++++++-- plans/main.fmf | 42 ++++++++++++++++++++++++ rpm/gating.yaml | 16 ++++++++++ tests/tmt/system.fmf | 18 +++++++++++ tests/tmt/system.sh | 18 +++++++++++ 6 files changed, 168 insertions(+), 3 deletions(-) create mode 100644 .fmf/version create mode 100644 plans/main.fmf create mode 100644 rpm/gating.yaml create mode 100644 tests/tmt/system.fmf create mode 100644 tests/tmt/system.sh diff --git a/.fmf/version b/.fmf/version new file mode 100644 index 00000000000..d00491fd7e5 --- /dev/null +++ b/.fmf/version @@ -0,0 +1 @@ +1 diff --git a/.packit.yaml b/.packit.yaml index 1c751afc5bd..3ccfd0cb229 100644 --- a/.packit.yaml +++ b/.packit.yaml @@ -5,6 +5,27 @@ downstream_package_name: buildah 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: tests/tmt/ + dest: tests/tmt/ + delete: true + mkpath: true + - src: .fmf/ + dest: .fmf/ + delete: true + - .packit.yaml + packages: buildah-fedora: pkg_tool: fedpkg @@ -25,13 +46,13 @@ jobs: notifications: &copr_build_failure_notification failure_comment: message: "Ephemeral COPR build failed. @containers/packit-build please check." - targets: + targets: &fedora_copr_targets - fedora-all-x86_64 - fedora-all-aarch64 enable_net: true - job: copr_build - trigger: pull_request + trigger: ignore packages: [buildah-eln] notifications: *copr_build_failure_notification targets: @@ -47,7 +68,7 @@ jobs: trigger: pull_request packages: [buildah-centos] notifications: *copr_build_failure_notification - targets: + targets: ¢os_copr_targets - centos-stream-9-x86_64 - centos-stream-9-aarch64 - centos-stream-10-x86_64 @@ -66,6 +87,55 @@ jobs: project: podman-next enable_net: true + - job: tests + trigger: pull_request + packages: [buildah-fedora] + targets: *fedora_copr_targets + require: &dev_tests + label: + absent: + - release + 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 + identifier: "dev" + + - job: tests + trigger: pull_request + packages: [buildah-fedora] + targets: *fedora_copr_targets + require: &release_tests + label: + present: + - release + preserve_project: true + identifier: "release" + + # FIXME: Enable centos stream tests after containers-common is fixed + # FIXME: centos stream 10 currently also lacks bats + # https://bugzilla.redhat.com/show_bug.cgi?id=2329315 + - job: tests + trigger: pull_request + packages: [buildah-centos] + targets: *centos_copr_targets + require: *dev_tests + 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 + identifier: "dev" + + - job: tests + trigger: pull_request + packages: [buildah-centos] + targets: *centos_copr_targets + require: *release_tests + preserve_project: true + identifier: "release" + # Sync to Fedora - job: propose_downstream trigger: release diff --git a/plans/main.fmf b/plans/main.fmf new file mode 100644 index 00000000000..1cb8da92aca --- /dev/null +++ b/plans/main.fmf @@ -0,0 +1,42 @@ +discover: + how: fmf +execute: + how: tmt +adjust: + - when: "initiator == packit" + because: "We need to test with updated packages from rhcontainerbot/podman-next copr" + prepare+: + how: shell + script: | + sed -i -n '/^priority=/!p;$apriority=1' /etc/yum.repos.d/*podman-next*.repo + dnf -y upgrade --allowerasing + order: 30 + # FIXME: Use epel10 once bats is available there + - when: distro == centos-stream-10 or distro == rhel-10 + because: "bats isn't yet available on epel10" + prepare+: + how: install + copr: rhcontainerbot/bats-el10 + package: bats + order: 30 + - when: distro == centos-stream or distro == rhel + because: "bats is present on EPEL on rhel9 / c9s" + how: feature + epel: enabled + order: 20 + +/upstream: + summary: Run tests on upstream PRs + discover+: + filter: tag:upstream + adjust+: + - enabled: false + when: revdeps == yes or initiator is not defined or initiator != packit + +/downstream: + summary: Run tests on bodhi / errata and dist-git PRs + discover+: + filter: tag:downstream + adjust+: + - enabled: false + when: initiator == packit diff --git a/rpm/gating.yaml b/rpm/gating.yaml new file mode 100644 index 00000000000..1fb3172f4d6 --- /dev/null +++ b/rpm/gating.yaml @@ -0,0 +1,16 @@ +--- !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} + +--- !Policy +product_versions: + - rhel-* +decision_context: osci_compose_gate +rules: + - !PassingTestCaseRule {test_case_name: osci.brew-build.tier0.functional} diff --git a/tests/tmt/system.fmf b/tests/tmt/system.fmf new file mode 100644 index 00000000000..3a7aee0061c --- /dev/null +++ b/tests/tmt/system.fmf @@ -0,0 +1,18 @@ +require: + - buildah-tests + - git-daemon + - slirp4netns + +environment: + BUILDAH_BINARY: /usr/bin/buildah + IMGTYPE_BINARY: /usr/bin/buildah-imgtype + INET_BINARY: /usr/bin/buildah-inet + COPY_BINARY: /usr/bin/buildah-copy + TUTORIAL_BINARY: /usr/bin/buildah-tutorial + TMPDIR: /var/tmp + +/local/root: + tag: [ downstream, upstream ] + summary: System test + test: bash ./system.sh + duration: 60m diff --git a/tests/tmt/system.sh b/tests/tmt/system.sh new file mode 100644 index 00000000000..73553aafd86 --- /dev/null +++ b/tests/tmt/system.sh @@ -0,0 +1,18 @@ +#!/usr/bin/env bash + +set -exo pipefail + +uname -r + +rpm -q \ + aardvark-dns \ + buildah \ + buildah-tests \ + conmon \ + container-selinux \ + containers-common \ + crun \ + netavark \ + systemd + +bats /usr/share/buildah/test/system