Skip to content

Commit eb7d75c

Browse files
miabbottsarmahaj
authored andcommitted
test(ostree): pin greenboot to exact Copr NEVR
Listing greenboot in the blueprint with version = "*" isn't enough: dnf always installs the highest NEVRA across all enabled repos, and Copr snapshot builds conventionally use a Release starting at "0.<timestamp>..." -- the same convention official pre-GA/rebuilt packages use. Whenever BaseOS/AppStream ships a greenboot release that outranks the current Copr build, dnf silently installs the stock package and the test exercises unpatched code. I first tried fixing this via blueprint [[customizations.repositories]] priority + install_from, since that's the field osbuild-composer exposes for repo precedence. Verified against a real osbuild-composer (v176) on CentOS Stream 9, with a synthetic competing repo publishing greenboot at a deliberately higher release, that those fields have no effect on build-time depsolve -- composer-cli accepts and forwards them fine, but the resolver still just picks the highest NEVRA regardless. They only affect the .repo files written into the resulting image for its own future dnf use. What does work: resolve the exact version-release dnf sees in the Copr repo via 'dnf repoquery --latest-limit=1' and pin both greenboot packages to it directly. Verified this reliably wins even against the adversarial higher-release competing repo. Assisted-by: OpenCode (Claude Sonnet 5) rh-pre-commit.version: 2.4.0 rh-pre-commit.check-secrets: ENABLED
1 parent 50447bd commit eb7d75c

1 file changed

Lines changed: 26 additions & 2 deletions

File tree

tests/greenboot-ostree.sh

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,30 @@ if [ "$copr_added" = false ]; then
150150
exit 1
151151
fi
152152

153+
# Listing greenboot as a blueprint package (version = "*") is not enough to
154+
# guarantee it comes from Copr: dnf always installs the highest NEVRA across
155+
# all enabled repos, and Copr snapshot builds conventionally use a Release
156+
# starting at "0.<timestamp>...", the same convention official pre-GA/rebuilt
157+
# packages use. Whenever BaseOS/AppStream ships a greenboot release that
158+
# outranks the current Copr build, dnf silently installs the stock package
159+
# instead. Pin the exact version-release dnf resolves in the Copr repo so
160+
# there is only one candidate to resolve to, regardless of what other repos
161+
# offer. (Verified: neither `composer-cli sources add` nor a blueprint's
162+
# `[[customizations.repositories]]` priority/install_from affect depsolve at
163+
# build time -- those only shape the .repo files written into the resulting
164+
# image for its own future dnf use.)
165+
greenprint "Looking up exact greenboot NEVR from Copr build"
166+
GREENBOOT_COPR_NEVR=$(sudo dnf repoquery \
167+
--repofrompath="greenboot-copr-lookup,${COPR_REPO_URL}" \
168+
--disablerepo='*' --enablerepo=greenboot-copr-lookup \
169+
--quiet --qf '%{version}-%{release}' --latest-limit=1 greenboot)
170+
171+
if [ -z "$GREENBOOT_COPR_NEVR" ]; then
172+
echo "Failed to resolve greenboot version-release from Copr repo ${COPR_REPO_URL}"
173+
exit 1
174+
fi
175+
greenprint "Pinning greenboot to Copr build ${GREENBOOT_COPR_NEVR}"
176+
153177
# Start firewalld
154178
greenprint "Start firewalld"
155179
sudo systemctl enable --now firewalld
@@ -381,11 +405,11 @@ version = "*"
381405
382406
[[packages]]
383407
name = "greenboot"
384-
version = "*"
408+
version = "${GREENBOOT_COPR_NEVR}"
385409
386410
[[packages]]
387411
name = "greenboot-default-health-checks"
388-
version = "*"
412+
version = "${GREENBOOT_COPR_NEVR}"
389413
390414
[customizations.services]
391415
enabled = ["greenboot-healthcheck.service", "greenboot-set-rollback-trigger.service", "greenboot-success.target"]

0 commit comments

Comments
 (0)