diff --git a/.fmf/version b/.fmf/version new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/.fmf/version @@ -0,0 +1 @@ +1 diff --git a/.gitignore b/.gitignore index e5c5c66..802337b 100644 --- a/.gitignore +++ b/.gitignore @@ -32,3 +32,15 @@ /aardvark-dns-v1.11.0-vendor.tar.gz /aardvark-dns-v1.12.1-vendor.tar.gz /v1.12.1.tar.gz +/v1.12.2.tar.gz +/aardvark-dns-v1.12.2-vendor.tar.gz +/v1.13.0.tar.gz +/aardvark-dns-v1.13.0-vendor.tar.gz +/v1.13.1.tar.gz +/aardvark-dns-v1.13.1-vendor.tar.gz +/v1.14.0.tar.gz +/aardvark-dns-v1.14.0-vendor.tar.gz +/v1.15.0.tar.gz +/aardvark-dns-v1.15.0-vendor.tar.gz +/v1.16.0.tar.gz +/aardvark-dns-v1.16.0-vendor.tar.gz diff --git a/.packit.yaml b/.packit.yaml index d13d559..42b0f7d 100644 --- a/.packit.yaml +++ b/.packit.yaml @@ -5,6 +5,27 @@ downstream_package_name: aardvark-dns 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: aardvark-dns-fedora: pkg_tool: fedpkg @@ -12,7 +33,7 @@ packages: aardvark-dns-centos: pkg_tool: centpkg specfile_path: rpm/aardvark-dns.spec - aardvark-dns-rhel: + aardvark-dns-eln: specfile_path: rpm/aardvark-dns.spec srpm_build_deps: @@ -27,9 +48,17 @@ jobs: notifications: &copr_build_failure_notification failure_comment: message: "Ephemeral COPR build failed. @containers/packit-build please check." + targets: &fedora_copr_targets + - fedora-all-x86_64 + - fedora-all-aarch64 + enable_net: true + osh_diff_scan_after_copr_build: false + + - job: copr_build + trigger: pull_request + packages: [aardvark-dns-eln] + notifications: *copr_build_failure_notification targets: - fedora-all-x86_64: {} - fedora-all-aarch64: {} fedora-eln-x86_64: additional_repos: - "https://kojipkgs.fedoraproject.org/repos/eln-build/latest/x86_64/" @@ -42,25 +71,17 @@ jobs: trigger: pull_request packages: [aardvark-dns-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 - centos-stream-10-aarch64 enable_net: true - - job: copr_build - trigger: pull_request - packages: [aardvark-dns-rhel] - notifications: *copr_build_failure_notification - targets: - - epel-9-x86_64 - - epel-9-aarch64 - enable_net: true - # Run on commit to main branch - job: copr_build trigger: commit + packages: [aardvark-dns-fedora] notifications: failure_comment: message: "podman-next COPR build failed. @containers/packit-build please check." @@ -69,102 +90,38 @@ jobs: project: podman-next enable_net: true - # Validate test - - job: tests - trigger: pull_request - skip_build: true - targets: - # Only need to test on one target - - fedora-latest-stable-x86_64 - identifier: validate_test - tmt_plan: "/plans/validate_test" - - # Unit tests on Fedora - - job: tests - trigger: pull_request - skip_build: true - notifications: &unit_test_failure_notification - failure_comment: - message: "Unit tests failed. @containers/packit-build please check." - targets: &pr_test_targets_fedora - - fedora-all-x86_64 - - fedora-all-aarch64 - identifier: unit_test_fedora - tmt_plan: "/plans/unit_test" - - # Unit tests on CentOS Stream - - job: tests - trigger: pull_request - skip_build: true - notifications: *unit_test_failure_notification - targets: &pr_test_targets_centos - - centos-stream-9-x86_64 - - centos-stream-9-aarch64 - # TODO: iptables kernel module is not available on rhel10. - # Enable these after netavark default is switched to nftables. - #- centos-stream-10-x86_64 - #- centos-stream-10-aarch64 - identifier: unit_test_centos - tmt_plan: "/plans/unit_test" - - # Unit tests on RHEL - - job: tests - trigger: pull_request - skip_build: true - notifications: *unit_test_failure_notification - use_internal_tf: true - targets: &pr_test_targets_rhel - epel-9-aarch64: - distros: [RHEL-9-Nightly,RHEL-9.4.0-Nightly] - epel-9-x86_64: - distros: [RHEL-9-Nightly,RHEL-9.4.0-Nightly] - # NOTE: Need to use centos-stream-10 until RHEL-10/EPEL-10 copr targets - # are available - # TODO: iptables kernel module is not available on rhel10. - # Enable these after netavark default is switched to nftables. - #centos-stream-10-aarch64: - # distros: [RHEL-10-Beta-Nightly] - #centos-stream-10-x86_64: - # distros: [RHEL-10-Beta-Nightly] - identifier: unit_test_rhel - tmt_plan: "/plans/unit_test" - - # Integration tests on Fedora + # Tests on Fedora - job: tests trigger: pull_request packages: [aardvark-dns-fedora] - notifications: &integration_test_failure_notification + notifications: &test_failure_notification failure_comment: - message: "Integration tests failed. @containers/packit-build please check." - targets: *pr_test_targets_fedora - identifier: integration_test_fedora - tmt_plan: "/plans/integration_test" + message: "Tests failed. @containers/packit-build please check." + 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 - # Integration tests on CentOS Stream + # Tests on CentOS Stream - job: tests trigger: pull_request packages: [aardvark-dns-centos] - notifications: *integration_test_failure_notification - targets: *pr_test_targets_centos - identifier: integration_test_centos - tmt_plan: "/plans/integration_test" - - # Integration tests on RHEL - - job: tests - trigger: pull_request - packages: [aardvark-dns-rhel] - notifications: *integration_test_failure_notification - use_internal_tf: true - targets: *pr_test_targets_rhel - identifier: integration_test_rhel - tmt_plan: "/plans/integration_test" + notifications: *test_failure_notification + 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 # Sync to Fedora - job: propose_downstream trigger: release packages: [aardvark-dns-fedora] update_release: false - dist_git_branches: + dist_git_branches: &fedora_targets - fedora-all # Sync to CentOS Stream @@ -174,16 +131,12 @@ jobs: update_release: false dist_git_branches: - c10s + - c9s - job: koji_build trigger: commit - dist_git_branches: - - fedora-all - - # NOTE: Bodhi update tasks are disabled to allow netavark and aardvark-dns X.Y - # builds in a single manual bodhi update. Leaving this commented out - # but not deleted so it's not forgotten. - #- job: bodhi_update - #trigger: commit - #dist_git_branches: - #- fedora-branched # rawhide updates are created automatically + packages: [aardvark-dns-fedora] + sidetag_group: netavark-releases + dependents: + - netavark + dist_git_branches: *fedora_targets diff --git a/README.packit b/README.packit index 2fa216c..3ad54d6 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 0.97.1.post1.dev4+g1268842e. +The file was generated using packit 1.11.0. diff --git a/aardvark-dns.spec b/aardvark-dns.spec index 8f62ce1..70ae11b 100644 --- a/aardvark-dns.spec +++ b/aardvark-dns.spec @@ -22,7 +22,7 @@ Epoch: 2 # 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: 1.12.1 +Version: 1.16.0 # The `AND` needs to be uppercase in the License for SPDX compatibility License: Apache-2.0 AND MIT AND Zlib Release: %autorelease @@ -53,6 +53,23 @@ BuildRequires: rust-srpm-macros Forwards other request to configured resolvers. Read more about configuration in `src/backend/mod.rs`. +%package tests +Summary: Tests for %{name} + +Requires: %{name} = %{epoch}:%{version}-%{release} +Requires: bats +Requires: bind-utils +Requires: jq +Requires: netavark +Requires: nmap-ncat +Requires: dnsmasq + +%description tests +%{summary} + +This package contains system tests for %{name} and is only intended to be used +for gating tests. + %prep %autosetup -Sgit %{name}-%{version} # Following steps are only required on environments like koji which have no @@ -60,27 +77,43 @@ Read more about configuration in `src/backend/mod.rs`. # dependencies directly from the network. %if !%{defined copr_username} tar fx %{SOURCE1} -mkdir -p .cargo - -cat >.cargo/config << EOF -[source.crates-io] -replace-with = "vendored-sources" - -[source.vendored-sources] -directory = "vendor" -EOF +%if 0%{?fedora} || 0%{?rhel} >= 10 +%cargo_prep -v vendor +%else +%cargo_prep -V 1 +%endif %endif %build %{__make} CARGO="%{__cargo}" build +%if (0%{?fedora} || 0%{?rhel} >= 10) && !%{defined copr_username} +%cargo_license_summary +%{cargo_license} > LICENSE.dependencies +%cargo_vendor_manifest +%endif %install %{__make} DESTDIR=%{buildroot} PREFIX=%{_prefix} install +%{__install} -d -p %{buildroot}%{_datadir}/%{name}/test +%{__cp} -rp test/* %{buildroot}%{_datadir}/%{name}/test/ +%{__rm} -rf %{buildroot}%{_datadir}/%{name}/test/tmt/ + +# Add empty check section to silence rpmlint warning. +# No tests meant to be run here. +%check + %files %license LICENSE +%if (0%{?fedora} || 0%{?rhel} >= 10) && !%{defined copr_username} +%license LICENSE.dependencies +%license cargo-vendor.txt +%endif %dir %{_libexecdir}/podman %{_libexecdir}/podman/%{name} +%files tests +%{_datadir}/%{name}/test + %changelog %autochangelog diff --git a/gating.yaml b/gating.yaml new file mode 100644 index 0000000..1fb3172 --- /dev/null +++ b/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/plans/main.fmf b/plans/main.fmf new file mode 100644 index 0000000..2b884e7 --- /dev/null +++ b/plans/main.fmf @@ -0,0 +1,33 @@ +discover: + how: fmf +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 + - when: initiator == packit + how: shell + script: | + COPR_REPO_FILE="/etc/yum.repos.d/*podman-next*.repo" + if compgen -G $COPR_REPO_FILE > /dev/null; then + sed -i -n '/^priority=/!p;$apriority=1' $COPR_REPO_FILE + fi + dnf -y upgrade --allowerasing + order: 20 + +/no-rpm: + summary: Run tests independent of rpm + discover+: + filter: tag:no-rpm + adjust+: + - enabled: false + when: initiator is not defined or initiator != packit + +/rpm: + summary: Run tests on the rpm + discover+: + filter: tag:rpm diff --git a/sources b/sources index 95eb2f7..164c3ca 100644 --- a/sources +++ b/sources @@ -1,2 +1,2 @@ -SHA512 (aardvark-dns-v1.12.1-vendor.tar.gz) = f4b7cfeface7c725201499f3a182ab1d3ad0aba9ad1fcfd364a8dc0684b31c42800c671e856f93634e71f1fb334121cf8dfc809f0e4a9bb14fe0cc493715dc43 -SHA512 (v1.12.1.tar.gz) = 63e10296b97791d23ae8714af99bc533bf01c4a584bc8bd9e2b935785a61eed58f96bb1e369fb46ed45dcc5ca0740fc3264315ad584a32212b49f5ee8e524881 +SHA512 (v1.16.0.tar.gz) = 6acdc06856e88f582f3eb651463dc627b4f33fe78605725f500ba21bd74385fe76bf2cb29adec356618a15b2f288b844e38cbd18c4522f7748b29c6d0ab7f59a +SHA512 (aardvark-dns-v1.16.0-vendor.tar.gz) = 60e31efef6b37f5856d59931372971134707d82794d1fbc2fc2e446bc079efa975dfe00c4c21813502cbab70a1caa58eee38a06b5927f155df80a1232ed4f917 diff --git a/test/tmt/tmt/main.fmf b/test/tmt/tmt/main.fmf new file mode 100644 index 0000000..9210cc8 --- /dev/null +++ b/test/tmt/tmt/main.fmf @@ -0,0 +1,26 @@ +/validate: + tag: [ no-rpm, validate ] + summary: Validate test + test: make -C ../.. validate + require: + - clippy + - rustfmt + +/unit: + tag: [ no-rpm, unit ] + summary: Unit tests + test: make -C ../.. unit + require: + - cargo + +/integration: + tag: [ rpm, integration ] + summary: Integration tests + test: bash test_integration.sh + environment: + AARDVARK: /usr/libexec/podman/aardvark-dns + require: + - aardvark-dns-tests + adjust: + duration: 10m + when: arch == aarch64 diff --git a/test/tmt/tmt/test_integration.sh b/test/tmt/tmt/test_integration.sh new file mode 100644 index 0000000..0839800 --- /dev/null +++ b/test/tmt/tmt/test_integration.sh @@ -0,0 +1,8 @@ +#!/usr/bin/env bash + +set -exo pipefail + +rpm -q aardvark-dns aardvark-dns-tests netavark + +cd /usr/share/aardvark-dns/ +bats test/