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 f6598e3..edf038e 100644 --- a/.gitignore +++ b/.gitignore @@ -22,3 +22,27 @@ /v1.6.0.tar.gz /v1.7.0.tar.gz /aardvark-dns-v1.7.0-vendor.tar.gz +/v1.8.0.tar.gz +/aardvark-dns-v1.8.0-vendor.tar.gz +/v1.9.0.tar.gz +/aardvark-dns-v1.9.0-vendor.tar.gz +/v1.10.0.tar.gz +/aardvark-dns-v1.10.0-vendor.tar.gz +/v1.11.0.tar.gz +/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 +/v1.17.0.tar.gz +/aardvark-dns-v1.17.0-vendor.tar.gz diff --git a/.packit.yaml b/.packit.yaml index a4ed4b1..89d1cee 100644 --- a/.packit.yaml +++ b/.packit.yaml @@ -2,47 +2,147 @@ # See the documentation for more information: # https://packit.dev/docs/configuration/ -# COPR build targets can be found at: -# https://copr.fedorainfracloud.org/coprs/rhcontainerbot/packit-builds/ -# and -# https://copr.fedorainfracloud.org/coprs/rhcontainerbot/podman-next/ - -specfile_path: rpm/aardvark-dns.spec +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 + specfile_path: rpm/aardvark-dns.spec + aardvark-dns-centos: + pkg_tool: centpkg + specfile_path: rpm/aardvark-dns.spec + aardvark-dns-eln: + specfile_path: rpm/aardvark-dns.spec + +srpm_build_deps: + - cargo + - git-archive-all + - make + - openssl-devel + +# https://packit.dev/docs/configuration/actions +# fix-spec-file only operates on copr builds and doesn't affect official distro builds +actions: + fix-spec-file: "bash .packit-copr-rpm.sh" + jobs: - - &copr - job: copr_build + - job: copr_build trigger: pull_request - owner: rhcontainerbot - project: packit-builds + packages: [aardvark-dns-fedora] + 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 - srpm_build_deps: - - cargo - - make - - openssl-devel + osh_diff_scan_after_copr_build: false - - <<: *copr - # Run on commit to main branch + - job: copr_build + trigger: pull_request + packages: [aardvark-dns-eln] + notifications: *copr_build_failure_notification + 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/" + enable_net: true + + - job: copr_build + trigger: pull_request + packages: [aardvark-dns-centos] + notifications: *copr_build_failure_notification + 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 + + # 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." branch: main + owner: rhcontainerbot project: podman-next + enable_net: true + # Tests on Fedora + - job: tests + trigger: pull_request + packages: [aardvark-dns-fedora] + notifications: &test_failure_notification + failure_comment: + 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 + + # Tests on CentOS Stream + - job: tests + trigger: pull_request + packages: [aardvark-dns-centos] + 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: &fedora_targets + - fedora-all + + # Sync to CentOS Stream + - job: propose_downstream + trigger: release + packages: [aardvark-dns-centos] update_release: false dist_git_branches: - - fedora-all - actions: - pre-sync: - - "bash rpm/update-spec-provides.sh" + - c10s + - c9s - job: koji_build trigger: commit - dist_git_branches: - - fedora-all - - - 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 101115f..e03362b 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.77.0.post2+g06f877b. +The file was generated using packit 1.12.0.post1.dev13+gd51655c23. diff --git a/aardvark-dns.spec b/aardvark-dns.spec index 98dce4c..08b71ac 100644 --- a/aardvark-dns.spec +++ b/aardvark-dns.spec @@ -1,14 +1,6 @@ # trust-dns-{client,server} not available # using vendored deps -# RHEL doesn't include the package rust-packaging which provides %%__cargo macro, but EPEL -# does. So we set it separately here and skip rust-packaging dependency for RHEL. -# Buildability without EPEL is essential for packit builds. -# ELN doesn't need this. -%if %{defined rhel} && 0%{?rhel} < 10 -%define __cargo %{_bindir}/env CARGO_HOME=.cargo RUSTC_BOOTSTRAP=1 RUSTFLAGS='-Copt-level=3 -Cdebuginfo=2 -Ccodegen-units=1 -Clink-arg=-Wl,-z,relro -Clink-arg=-Wl,-z,now --cap-lints=warn' %{_bindir}/cargo -%endif - %global with_debug 1 %if 0%{?with_debug} @@ -18,31 +10,11 @@ %global debug_package %{nil} %endif -# copr_username is only set on copr environments owned by rhcontainerbot, -# not on other coprs or environments like koji. -%if %{defined copr_username} && "%{?copr_username}" == "rhcontainerbot" -%bcond_without copr -%else -%bcond_with copr -%endif - -# rhel 8 does not support %%autochangelog -%if %{defined rhel} && 0%{?rhel} <= 8 -%bcond_without manual_changelog -%else -%bcond_with manual_changelog -%endif - -# rhel does not define %%{golang_arches_future} -%if %{defined fedora} -%bcond_without golang_arches_future -%else -%bcond_with golang_arches_future -%endif - Name: aardvark-dns -%if %{with copr} +%if %{defined copr_username} Epoch: 102 +%else +Epoch: 2 %endif # DO NOT TOUCH the Version string! # The TRUE source of this specfile is: @@ -50,10 +22,11 @@ Epoch: 102 # 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.7.0 -License: Apache-2.0 and MIT and Zlib +Version: 1.17.0 +# The `AND` needs to be uppercase in the License for SPDX compatibility +License: Apache-2.0 AND MIT AND Zlib Release: %autorelease -%if %{with golang_arches_future} +%if %{defined golang_arches_future} ExclusiveArch: %{golang_arches_future} %else ExclusiveArch: aarch64 ppc64le s390x x86_64 @@ -67,13 +40,12 @@ BuildRequires: cargo BuildRequires: git-core BuildRequires: make %if %{defined rhel} +# rust-toolset requires the `local` repo enabled on non-koji ELN build environments BuildRequires: rust-toolset %else BuildRequires: rust-packaging BuildRequires: rust-srpm-macros %endif -# DO NOT DELETE BELOW LINE - used for updating downstream imports -# vendored libraries %description %{summary} @@ -81,34 +53,67 @@ 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: socat +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 # network access and thus depend on the vendored tarball. Copr pulls # dependencies directly from the network. -%if %{without copr} +%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 3dd3bb8..413dc03 100644 --- a/sources +++ b/sources @@ -1,2 +1,2 @@ -SHA512 (v1.7.0.tar.gz) = d829ac122f26f17ca44a41a48576ab8c4f9dd238bc52faee816833f63f9ff54e63f62610167e4619084263e61cdb1329c2e1d49f314c8b9e65e748df80fd5096 -SHA512 (aardvark-dns-v1.7.0-vendor.tar.gz) = 07d3ebc7504fc1e4c0fe9b5f3760bdbe9b4153678aae962c9e37a0097bee832b0e4e77fadfc475c82fa05ffaa1a04f53df8f92b63e23b09da05e5e2efaa07c94 +SHA512 (v1.17.0.tar.gz) = 42e3a261bb5b9df83b8bb853ed50dd7dfda643895262aedf5ccdc865c598e913996a244d234ac309a18ee1a884b7ba847679dfe5d8b6521e674114c8aba552da +SHA512 (aardvark-dns-v1.17.0-vendor.tar.gz) = b7ec2a2a34d5bb36dbcc55611dc9ec0ff2c1bed4469cc4b12d4eb0bd78bb7d6cae6f80a02ac32ade5c435fdd11e22ddd99646aa4de504c8369ee56cfa470e6a5 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/