From e967649fbc346070d998c134875ab6d5d074be6f Mon Sep 17 00:00:00 2001 From: Maxwell G Date: Thu, 11 May 2023 22:52:54 +0000 Subject: [PATCH 1/8] remove unnecessary bashisms --- ansible-packaging.spec | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/ansible-packaging.spec b/ansible-packaging.spec index 3b8cd3f..03d5a78 100644 --- a/ansible-packaging.spec +++ b/ansible-packaging.spec @@ -114,18 +114,18 @@ errors rpm_eval -E '%%ansible_collection_url' echo echo echo "Ensure macro works when both arguments are passed and no control macros are set" -[[ $(rpm_eval -E '%%ansible_collection_url community general') == \ - "https://galaxy.ansible.com/community/general" ]] +[ "$(rpm_eval -E '%%ansible_collection_url community general')" = \ + "https://galaxy.ansible.com/community/general" ] echo echo "Ensure macro works with the control macros" -[[ $(rpm_eval -D 'collection_namespace ansible' -D 'collection_name posix' \ - -E '%%ansible_collection_url') == "https://galaxy.ansible.com/ansible/posix" ]] +[ "$(rpm_eval -D 'collection_namespace ansible' -D 'collection_name posix' \ + -E '%%ansible_collection_url')" = "https://galaxy.ansible.com/ansible/posix" ] echo echo "Ensure macro prefers the collection namespace and name passed as an argument over the control macros" -[[ $(rpm_eval -D 'collection_namespace ansible' -D 'collection_name posix' \ - -E '%%ansible_collection_url community general') == "https://galaxy.ansible.com/community/general" ]] +[ "$(rpm_eval -D 'collection_namespace ansible' -D 'collection_name posix' \ + -E '%%ansible_collection_url community general')" = "https://galaxy.ansible.com/community/general" ] From 62d087930acb128f13f8c096f1cf944ba6ffd7e0 Mon Sep 17 00:00:00 2001 From: Maxwell G Date: Thu, 11 May 2023 22:53:01 +0000 Subject: [PATCH 2/8] collection_install: disable GALAXY_COLLECTIONS_PATH_WARNING This silences spurious warnings when installing collections into a directory outside ansible's configured collections path. Relates: https://github.com/ansible/ansible/pull/78487 --- ansible-packaging.spec | 5 ++++- ansible_collection.py | 8 +++++++- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/ansible-packaging.spec b/ansible-packaging.spec index 03d5a78..1a5ec61 100644 --- a/ansible-packaging.spec +++ b/ansible-packaging.spec @@ -1,6 +1,6 @@ Name: ansible-packaging Version: 1 -Release: 9.1%{?dist} +Release: 10%{?dist} Summary: RPM packaging macros and generators for Ansible collections License: GPL-3.0-or-later @@ -149,6 +149,9 @@ echo "Ensure macro prefers the collection namespace and name passed as an argume %changelog +* Thu May 11 2023 Maxwell G - 1-10 +- %%ansible_collection_install - disable spurious collections path warnings + * Wed Jan 18 2023 Fedora Release Engineering - 1-9.1 - Rebuilt for https://fedoraproject.org/wiki/Fedora_38_Mass_Rebuild diff --git a/ansible_collection.py b/ansible_collection.py index 70093be..80c4b33 100755 --- a/ansible_collection.py +++ b/ansible_collection.py @@ -19,6 +19,7 @@ the provided arguments. """ import argparse +import os import shutil import subprocess import sys @@ -96,7 +97,12 @@ class AnsibleCollection: # Without this, the print statements are shown after the command # output when building in mock. sys.stdout.flush() - subprocess.run(args, cwd=temppath, check=True) + subprocess.run( + args, + cwd=temppath, + check=True, + env={**os.environ, "ANSIBLE_GALAXY_COLLECTIONS_PATH_WARNING": "0"}, + ) def parseargs() -> argparse.Namespace: From 4cecf06ccb82d5cdabd1bae98ffca56eb85eabe0 Mon Sep 17 00:00:00 2001 From: Maxwell G Date: Thu, 11 May 2023 22:54:29 +0000 Subject: [PATCH 3/8] tests: remove pytest-forked req with core 2.16 ansible-test units doesn't depend on pytest-forked as of https://github.com/ansible/ansible/commit/676b731e6f7d60ce6fd48c0d1c883fc85f5c6537. This is expected to land in ansible-core 2.16. --- ansible-packaging.spec | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/ansible-packaging.spec b/ansible-packaging.spec index 1a5ec61..e1b9a1f 100644 --- a/ansible-packaging.spec +++ b/ansible-packaging.spec @@ -48,7 +48,7 @@ Requires: /usr/bin/ansible-test Requires: %{py3_dist pytest} Requires: %{py3_dist pytest-mock} Requires: %{py3_dist pytest-xdist} -Requires: %{py3_dist pytest-forked} +Requires: (%{py3_dist pytest-forked} if ansible-core < 2.16~~) Requires: %{py3_dist pyyaml} # mock is included in the list upstream, but is deprecated in Fedora. # Maintainers should work with upstream to add compat code to support @@ -151,6 +151,7 @@ echo "Ensure macro prefers the collection namespace and name passed as an argume %changelog * Thu May 11 2023 Maxwell G - 1-10 - %%ansible_collection_install - disable spurious collections path warnings +- ansible-packaging-tests - don't depend on pytest-forked with ansible-core 2.16 * Wed Jan 18 2023 Fedora Release Engineering - 1-9.1 - Rebuilt for https://fedoraproject.org/wiki/Fedora_38_Mass_Rebuild From 64a06a48437baeb139bb660d8e03054e8b31009a Mon Sep 17 00:00:00 2001 From: Maxwell G Date: Thu, 11 May 2023 22:53:00 +0000 Subject: [PATCH 4/8] include LICENSE in ansible-srpm-macros --- ansible-packaging.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/ansible-packaging.spec b/ansible-packaging.spec index e1b9a1f..b3ca0dd 100644 --- a/ansible-packaging.spec +++ b/ansible-packaging.spec @@ -1,3 +1,5 @@ +%global _docdir_fmt ansible-packaging + Name: ansible-packaging Version: 1 Release: 10%{?dist} @@ -130,7 +132,6 @@ echo "Ensure macro prefers the collection namespace and name passed as an argume %files -%license COPYING %{_fileattrsdir}/ansible.attr %{_rpmmacrodir}/macros.ansible %{_rpmconfigdir}/ansible-generator @@ -138,6 +139,7 @@ echo "Ensure macro prefers the collection namespace and name passed as an argume %files -n ansible-srpm-macros +%license COPYING %{_rpmmacrodir}/macros.ansible-srpm # ansible-core in RHEL 8.6 is built against python38. In c8s and the next RHEL @@ -152,6 +154,7 @@ echo "Ensure macro prefers the collection namespace and name passed as an argume * Thu May 11 2023 Maxwell G - 1-10 - %%ansible_collection_install - disable spurious collections path warnings - ansible-packaging-tests - don't depend on pytest-forked with ansible-core 2.16 +- ansible-srpm-macros - include license file in the package * Wed Jan 18 2023 Fedora Release Engineering - 1-9.1 - Rebuilt for https://fedoraproject.org/wiki/Fedora_38_Mass_Rebuild From 280a87e80bbd3391297c87278fe123d1443b182e Mon Sep 17 00:00:00 2001 From: Maxwell G Date: Fri, 12 May 2023 17:37:06 +0000 Subject: [PATCH 5/8] add tmt tests to rebuild dependents --- .fmf/version | 1 + tests/rebuild.fmf | 16 ++++++++++++++++ tests/rebuild.sh | 27 +++++++++++++++++++++++++++ 3 files changed, 44 insertions(+) create mode 100644 .fmf/version create mode 100644 tests/rebuild.fmf create mode 100755 tests/rebuild.sh 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/tests/rebuild.fmf b/tests/rebuild.fmf new file mode 100644 index 0000000..a1414be --- /dev/null +++ b/tests/rebuild.fmf @@ -0,0 +1,16 @@ +summary: Rebuild dependents to ensure that builds pass +discover: + - name: Rebuild collection packages + how: shell + tests: + - name: Rebuild ansible-collection-community-docker + test: tests/rebuild.sh ansible-collection-community-docker + require: + - ansible-core + - ansible-packaging + - ansible-srpm-macros + - fedpkg + - rpm-build + - sudo +execute: + how: tmt diff --git a/tests/rebuild.sh b/tests/rebuild.sh new file mode 100755 index 0000000..fbbb8b8 --- /dev/null +++ b/tests/rebuild.sh @@ -0,0 +1,27 @@ +#!/usr/bin/bash -x +set -euo pipefail + +package="${1}" + +cat <<'EOF' > ~/.rpmmacros +%_topdir %(echo $HOME)/rpmbuild +%_sourcedir %(pwd) +%_srcrpmdir %(pwd) +%_rpmdir %(pwd)/rpms +EOF + +mkdir -p clones +cd clones +fedpkg clone -a "${package}" +cd "${package}" +fedpkg srpm +sudo dnf builddep -y *.src.rpm +rc=0 +rpmbuild --rebuild *.src.rpm | tee build.log || rc=$? + +# move the results to the artifacts directory, so we can examine them +artifacts="${TEST_ARTIFACTS:-/tmp/artifacts}" +mkdir -p "${artifacts}" +mv -v *.rpm rpms/*/* build.log "${artifacts}/" || : + +exit "${rc}" From 47142722f25e85e4e499f822a4848642916db9b7 Mon Sep 17 00:00:00 2001 From: Fedora Release Engineering Date: Wed, 19 Jul 2023 13:22:34 +0000 Subject: [PATCH 6/8] Rebuilt for https://fedoraproject.org/wiki/Fedora_39_Mass_Rebuild Signed-off-by: Fedora Release Engineering --- ansible-packaging.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/ansible-packaging.spec b/ansible-packaging.spec index b3ca0dd..6a0f9e7 100644 --- a/ansible-packaging.spec +++ b/ansible-packaging.spec @@ -2,7 +2,7 @@ Name: ansible-packaging Version: 1 -Release: 10%{?dist} +Release: 11%{?dist} Summary: RPM packaging macros and generators for Ansible collections License: GPL-3.0-or-later @@ -151,6 +151,9 @@ echo "Ensure macro prefers the collection namespace and name passed as an argume %changelog +* Wed Jul 19 2023 Fedora Release Engineering - 1-11 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_39_Mass_Rebuild + * Thu May 11 2023 Maxwell G - 1-10 - %%ansible_collection_install - disable spurious collections path warnings - ansible-packaging-tests - don't depend on pytest-forked with ansible-core 2.16 From 168a1f75355d4c80ef29f699d9abf3d98c3c7e4d Mon Sep 17 00:00:00 2001 From: Maxwell G Date: Tue, 5 Dec 2023 02:08:20 +0000 Subject: [PATCH 7/8] %ansible_collection_url: handle new URL scheme --- ansible-packaging.spec | 13 +++++++++---- macros.ansible-srpm | 6 +++++- 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/ansible-packaging.spec b/ansible-packaging.spec index 6a0f9e7..1bd86f3 100644 --- a/ansible-packaging.spec +++ b/ansible-packaging.spec @@ -2,7 +2,7 @@ Name: ansible-packaging Version: 1 -Release: 11%{?dist} +Release: 12%{?dist} Summary: RPM packaging macros and generators for Ansible collections License: GPL-3.0-or-later @@ -117,17 +117,19 @@ echo echo echo "Ensure macro works when both arguments are passed and no control macros are set" [ "$(rpm_eval -E '%%ansible_collection_url community general')" = \ - "https://galaxy.ansible.com/community/general" ] + "https://galaxy.ansible.com/ui/repo/published/community/general" ] echo echo "Ensure macro works with the control macros" [ "$(rpm_eval -D 'collection_namespace ansible' -D 'collection_name posix' \ - -E '%%ansible_collection_url')" = "https://galaxy.ansible.com/ansible/posix" ] + -E '%%ansible_collection_url')" = \ + "https://galaxy.ansible.com/ui/repo/published/ansible/posix" ] echo echo "Ensure macro prefers the collection namespace and name passed as an argument over the control macros" [ "$(rpm_eval -D 'collection_namespace ansible' -D 'collection_name posix' \ - -E '%%ansible_collection_url community general')" = "https://galaxy.ansible.com/community/general" ] + -E '%%ansible_collection_url community general')" = \ + "https://galaxy.ansible.com/ui/repo/published/community/general" ] @@ -151,6 +153,9 @@ echo "Ensure macro prefers the collection namespace and name passed as an argume %changelog +* Tue Dec 05 2023 Maxwell G - 1-12 +- %%ansible_collection_url: handle new URL scheme + * Wed Jul 19 2023 Fedora Release Engineering - 1-11 - Rebuilt for https://fedoraproject.org/wiki/Fedora_39_Mass_Rebuild diff --git a/macros.ansible-srpm b/macros.ansible-srpm index 0adacd7..fdf2ce5 100644 --- a/macros.ansible-srpm +++ b/macros.ansible-srpm @@ -8,6 +8,9 @@ # either or approach. Both arguments must be passed OR both control macros must # be defined. + +%__ansible_galaxy_collection_url https://galaxy.ansible.com/ui/repo/published + %ansible_collection_url() %{lua: local namespace_name = nil if rpm.expand("%collection_namespace") ~= "%collection_namespace" @@ -21,5 +24,6 @@ rpm.expand("%{error:%%ansible_collection_url: You must pass the collection " .. "namespace as the first arg and the collection name as the second}") end - print("https://galaxy.ansible.com/" .. namespace_name) + url = rpm.expand("%__ansible_galaxy_collection_url") + print(url .. "/" .. namespace_name) } From 313c537b697caa410101f4d5d19a72db9f8347f5 Mon Sep 17 00:00:00 2001 From: Maxwell G Date: Tue, 5 Dec 2023 02:10:18 +0000 Subject: [PATCH 8/8] add package gating configuration --- gating.yaml | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 gating.yaml diff --git a/gating.yaml b/gating.yaml new file mode 100644 index 0000000..5480e33 --- /dev/null +++ b/gating.yaml @@ -0,0 +1,10 @@ +--- !Policy +product_versions: + - fedora-* +decision_contexts: + - bodhi_update_push_testing + - bodhi_update_push_stable +subject_type: koji_build +rules: + - !PassingTestCaseRule {test_case_name: fedora-ci.koji-build.tier0.functional} +...