Skip to content

ci_setup: pin ansible-core for local controller tools - #4304

Closed
Valkyrie00 wants to merge 1 commit into
openstack-k8s-operators:mainfrom
Valkyrie00:fix/ansible-core-local-tools-pin
Closed

Valkyrie00 wants to merge 1 commit into
openstack-k8s-operators:mainfrom
Valkyrie00:fix/ansible-core-local-tools-pin

Conversation

@Valkyrie00

Copy link
Copy Markdown
Contributor

Problem

Install Ansible tools for local controller operations used
ansible-core=={{ ansible_version.full }}.

In the premetal topology the controller is the hypervisor, so
ansible_version.full is the host's RHEL ansible-core 2.14.14, not the
migration's 2.16.19. The task then installs 2.14.14 into ~/.local
with /usr/bin/pip3.12 --user (Python 3.12). dev-scripts puts
~/.local/bin before /usr/local/bin, so this shadows the 2.15.13 that
dev-scripts installs and breaks:

ansible-galaxy collection install 'ansible.netcommon<8.0.0' ...
ERROR! ... Could not find ansible.netcommon<8.0.0.

Fix

Pin the task to ansible-core==2.16.19, matching
common-requirements.txt, instead of trusting the running controller
version. This installs a Python 3.12-compatible Ansible into ~/.local
and keeps the devscripts collection command working.

Validation

The ansible-version-shadow-check TP (testproject MR 2861) reproduces the
2.14.14/Python 3.12 state in an isolated HOME:

  • 2.14.14: the devscripts command fails with
    Could not find ansible.netcommon<8.0.0. (rc=1);
  • 2.16.19: the same command succeeds (rc=0) and installs
    ansible.posix, ansible.utils, ansible.netcommon and
    community.general.

A full premetal job with this change is the remaining integration check.

The task used ansible_version.full to install the same ansible-core version as the running controller. In premetal the controller is the hypervisor, so that value is the host RHEL ansible-core 2.14.14. The pip install then puts 2.14.14 in ~/.local under Python 3.12, where it shadows the 2.15.13 that dev-scripts installs in /usr/local/bin and breaks the devscripts collection command.

Pin the local tool install to the migration 2.16.19 instead, keeping it in sync with common-requirements.txt.
@openshift-ci

openshift-ci Bot commented Oct 27, 2026

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please assign nemarjan for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@qodo-code-review

Copy link
Copy Markdown

PR Summary by Qodo

Pin local controller Ansible tools to 2.16.19

🐞 Bug fix 🕐 Less than 10 minutes

Grey Divider

AI Description

• Pin the local controller’s ansible-core to 2.16.19 instead of the running host version.
• Prevent premetal’s host Ansible from shadowing dev-scripts tooling and breaking collection
 installation.
Diagram

graph TD
  A["Common requirements"] --> B["CI setup task"] --> C["pip3.12 user install"] --> D["Local Ansible tools"] --> E["Collection command"]
Loading
High-Level Assessment

Keep the explicit pin: using the controller’s runtime version reproduces the premetal failure, while reading the requirements file dynamically would add machinery for a single installation task. The comment identifies the version that must remain synchronized.

Files changed (1) +5 / -1

Bug fix (1) +5 / -1
packages.ymlPin user-local ansible-core to the migration version +5/-1

Pin user-local ansible-core to the migration version

• Replaces the controller-derived version with ansible-core 2.16.19, matching common-requirements.txt. Adds a comment explaining how the premetal host version can shadow dev-scripts tooling.

roles/ci_setup/tasks/packages.yml

@qodo-code-review

Copy link
Copy Markdown

Code Review by Qodo

🐞 Bugs (0) 📘 Rule violations (0) 📎 Requirement gaps (0)

Grey Divider

Great, no issues found!

Qodo reviewed your code and found no material issues that require review

Grey Divider

Tip of the day
💡 Did you know, you can describe a rule in plain language on the Rules page and Qodo drafts it for you

More tips ↗ | Customize Qodo ↗ | Qodo docs ↗

Grey Divider

Qodo Logo

@Valkyrie00 Valkyrie00 closed this Oct 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant