fix: install runtime collections to /collections in EE containers - #9863
Open
rut31337 wants to merge 3 commits into
Open
fix: install runtime collections to /collections in EE containers#9863rut31337 wants to merge 3 commits into
rut31337 wants to merge 3 commits into
Conversation
ansible-galaxy exits 0 on PermissionError when the install path is not writable, silently failing to install git-based collections. This breaks destroy jobs that need rhpds.assisted_installer and other runtime deps. Changes: - Install to /collections instead of COLLECTIONS_PATHS[0] which may point to a non-writable path (/home/runner/.ansible/collections). /collections is already in the EE COLLECTIONS_PATHS search order but does not exist by default, so we create it first. - Add failed_when to catch PermissionError in stderr since ansible-galaxy does not set a non-zero exit code on write failures. - Add GIT_TERMINAL_PROMPT=0 to prevent git credential prompts from hanging the job when a collection repo URL is unreachable.
Use COLLECTIONS_PATHS[0] when writable, fall back to /collections when the default path is not writable (common in OCP EE containers with random UIDs).
Try each configured COLLECTIONS_PATH in order. Use the first one that is writable. If none are writable, create /tmp/collections as a last resort — /tmp is guaranteed writable in any container.
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.
Summary
Fix silent failure of
ansible-galaxy collection installin EE containers.ansible-galaxyexits 0 onPermissionErrorwhen the target path is notwritable (ansible bug).
This means git-based collections (e.g.
rhpds.assisted_installer) silentlyfail to install, and the destroy job later fails with:
Root cause
The EE's
COLLECTIONS_PATHSare:/home/runner/.ansible/collections- may not be writable under OCP random UIDs/collections- does not exist/usr/share/ansible/collections- read-only (EE image layer)The old code installed to
COLLECTIONS_PATHS[0]which could hit path 1 (not writable).Galaxy crashes with
PermissionErrorbut exits 0. Thecommandmodule sees rc=0and reports
changed.Fix
/collections(path 2) — already in the EE search path, just needsto be created. Guaranteed writable on the container overlay.
failed_whenchecks stderr forPermissionError/Permission deniedsinceansible-galaxydoesn't set a non-zero exit code on write failures.GIT_TERMINAL_PROMPT=0prevents git from hanging on credential prompts forunreachable collection repos.
Test plan
osp-on-ocp-cnvdestroy job installsrhpds.assisted_installerand resolves the modulefailed_whencatches actual permission errors instead of silent success