role_scan: credit container-template stream pins#2573
Closed
ideaship wants to merge 1 commit into
Closed
Conversation
iter_role_pins() decided whether an <alias>_tag pin found in a role's
defaults is stream-resolved (governed by a <name>_version release-stream
variable, hence not role-pinned) by reading only the generics manager
template, environments/manager/images.yml. That template omits a few
aliases -- notably cephclient and openstackclient -- whose tags are
stream-wired only in the authoritative container render template,
container-image-osism-ansible/files/src/templates/images.yml.j2, as
"{{ cephclient_version|default(ceph_version) }}" and
"{{ openstackclient_version|default(openstack_version) }}".
Because those two aliases were absent from the template consulted for
stream-resolution, their role-default tags were treated as canonical
role pins with no release base.yml entry, so role_unpinned reported them
as actionable drift. They are false positives: the release train governs
the deployed tag via ceph_version / openstack_version (the concrete pins
live in the train files, ceph-*.yml / openstack-*.yml), and the role
default is only a fallback.
Union the stream-resolved set from the container template on top of the
generics one in iter_role_pins(), so an alias stream-wired in either
template is recognised as stream-resolved. From the real container
template this adds exactly cephclient and openstackclient; no other
alias matches the <name>_version|default shape. role_shadows shares
iter_role_pins() and benefits identically.
The driver resolves source repos from each selected plugin's
INPUT_FILES, so also declare the container template there for
role_unpinned; otherwise running that plugin alone in remote mode would
read an unresolved repo. role_shadows already declared it.
Verified against the local checkouts: role_unpinned drops from 11 to 9
actionable findings (cephclient and openstackclient removed) while
role_shadows is unchanged. Adds two tests: a role stream-wired only in
the container template must not surface as unpinned, and role_unpinned
must declare the container template as an input.
Assisted-by: Claude:claude-opus-4-8
Signed-off-by: Roger Luethi <luethi@osism.tech>
Contributor
Author
|
Closing as superseded — the root cause is better fixed upstream. This PR suppressed the The follow-up fixes the actual cause instead:
With that, the role no longer holds a static literal, so:
So this change is no longer needed and would only add a permanent blind spot. Superseded by #2135. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
role_unpinnedreportscephclient(reef) andopenstackclient(
2024.2) as actionable drift — role-default<alias>_tagpins with nocanonical release pin. These are false positives.
Both tags are stream-wired in the authoritative container render
template (
container-image-osism-ansible/.../images.yml.j2):i.e. the release train governs the deployed tag (concrete pins live in
the train files
ceph-*.yml/openstack-*.yml), and the role defaultis only a fallback. But
iter_role_pins()decided stream-resolution byreading only the generics manager template
(
generics/environments/manager/images.yml), which omits these twoaliases — so their role defaults were treated as canonical role pins.
Fix
Union the stream-resolved set from the container template on top of the
generics one in
iter_role_pins(). From the real container templatethis adds exactly
cephclientandopenstackclient(nothing elsematches the
<name>_version|defaultshape).role_shadowssharesiter_role_pins()and benefits identically.Also declare the container template in
role_unpinned'sINPUT_FILES:the driver resolves source repos from each selected plugin's
INPUT_FILES, so without it, runningrole_unpinnedalone in remotemode would read an unresolved repo.
role_shadowsalready declared it.Verification
Against the local checkouts:
role_unpinneddrops from 11 to 9actionable findings (
cephclientandopenstackclientremoved);role_shadowsunchanged. Two new tests (a role stream-wired only in thecontainer template must not surface as unpinned;
role_unpinnedmustdeclare the container template as an input). Full suite 333 passed;
black + flake8 clean.