Skip to content

fix: install runtime collections to /collections in EE containers - #9863

Open
rut31337 wants to merge 3 commits into
developmentfrom
fix/ee-collection-install-path
Open

fix: install runtime collections to /collections in EE containers#9863
rut31337 wants to merge 3 commits into
developmentfrom
fix/ee-collection-install-path

Conversation

@rut31337

Copy link
Copy Markdown
Collaborator

Summary

Fix silent failure of ansible-galaxy collection install in EE containers.

ansible-galaxy exits 0 on PermissionError when the target path is not
writable (ansible bug).
This means git-based collections (e.g. rhpds.assisted_installer) silently
fail to install, and the destroy job later fails with:

ERROR! couldn't resolve module/action 'rhpds.assisted_installer.list_clusters'

Root cause

The EE's COLLECTIONS_PATHS are:

  1. /home/runner/.ansible/collections - may not be writable under OCP random UIDs
  2. /collections - does not exist
  3. /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 PermissionError but exits 0. The command module sees rc=0
and reports changed.

Fix

  • Install to /collections (path 2) — already in the EE search path, just needs
    to be created. Guaranteed writable on the container overlay.
  • failed_when checks stderr for PermissionError / Permission denied since
    ansible-galaxy doesn't set a non-zero exit code on write failures.
  • GIT_TERMINAL_PROMPT=0 prevents git from hanging on credential prompts for
    unreachable collection repos.

Test plan

  • Verify osp-on-ocp-cnv destroy job installs rhpds.assisted_installer and resolves the module
  • Verify standard (non-git) collections still work via EE filter
  • Verify failed_when catches actual permission errors instead of silent success

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.
@rut31337
rut31337 requested a review from a team as a code owner July 10, 2026 12:24
@github-actions github-actions Bot added the core label Jul 10, 2026
rut31337 added 2 commits July 10, 2026 07:26
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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant