Skip to content

Conversation

@michburk
Copy link
Contributor

@michburk michburk commented Sep 29, 2025

The reproducer role used a hardcoded zuul user and hardcoded /home/zuul path in several places, particularly when configuring controller-0. This patch pulls out this hardcoded data into default vars in the reproducer.
This patch also fixes a few incorrect assumptions that a var like ansible_user_id can be used when delegating to or configuring controller-0. For example, the ansible_user_id will not resolve to controller-0's user, and instead resolve to the host that the task is being delegated from. If there is a mismatch between these two users, this causes problems. This has mostly not been an issue because our ci assumes that there is a zuul user everywhere, but people running local deployments have encountered issues when using the framework on a hypervisor with a non-zuul user.

@openshift-ci
Copy link
Contributor

openshift-ci bot commented Sep 29, 2025

Skipping CI for Draft Pull Request.
If you want CI signal for your change, please convert it to an actual PR.
You can still manually trigger a test run with /test all

@openshift-ci
Copy link
Contributor

openshift-ci bot commented Sep 29, 2025

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:

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

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

@softwarefactory-project-zuul
Copy link

Build failed (check pipeline). Post recheck (without leading slash)
to rerun all jobs. Make sure the failure cause has been resolved before
you rerun jobs.

https://softwarefactory-project.io/zuul/t/rdoproject.org/buildset/a7738eda2d9e4d6b9ecbdac4b6cf2717

✔️ openstack-k8s-operators-content-provider SUCCESS in 1h 31m 14s
✔️ podified-multinode-edpm-deployment-crc SUCCESS in 1h 12m 31s
✔️ cifmw-crc-podified-edpm-baremetal SUCCESS in 1h 14m 24s
✔️ cifmw-pod-zuul-files SUCCESS in 4m 39s
✔️ noop SUCCESS in 0s
✔️ cifmw-pod-ansible-test SUCCESS in 8m 03s
✔️ cifmw-pod-pre-commit SUCCESS in 7m 37s
✔️ build-push-container-cifmw-client SUCCESS in 23m 09s
cifmw-molecule-reproducer FAILURE in 13m 06s

@michburk michburk force-pushed the main branch 6 times, most recently from 663c195 to 9466520 Compare October 14, 2025 18:39
@softwarefactory-project-zuul
Copy link

Build failed (check pipeline). Post recheck (without leading slash)
to rerun all jobs. Make sure the failure cause has been resolved before
you rerun jobs.

https://softwarefactory-project.io/zuul/t/rdoproject.org/buildset/34c153c78ef7406991c39d16c100ea72

✔️ cifmw-pod-zuul-files SUCCESS in 4m 45s
✔️ noop SUCCESS in 0s
✔️ cifmw-pod-ansible-test SUCCESS in 8m 51s
cifmw-pod-pre-commit FAILURE in 8m 01s
✔️ build-push-container-cifmw-client SUCCESS in 16m 46s
cifmw-molecule-reproducer FAILURE in 9m 33s

@michburk michburk force-pushed the main branch 2 times, most recently from 2f16f45 to 4822a60 Compare October 14, 2025 20:43
@michburk michburk changed the title WIP: Allow for non-zuul users in libvirt_manager and reproducer WIP: Allow for non-zuul users in reproducer role Oct 16, 2025
@michburk michburk changed the title WIP: Allow for non-zuul users in reproducer role WIP: Refactor hard-coded zuul user in reproducer role Oct 16, 2025
@michburk michburk marked this pull request as ready for review October 16, 2025 21:15
@michburk michburk requested a review from a team as a code owner October 16, 2025 21:15
Copy link
Contributor

@evallesp evallesp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM in general, not approving to hold on until more people chime in

@michburk michburk changed the title WIP: Refactor hard-coded zuul user in reproducer role Refactor hard-coded zuul user in reproducer role Oct 17, 2025
@danpawlik
Copy link
Contributor

I will pick that change in next iteration in tesstproject.
So far, it looks nice!

@evallesp
Copy link
Contributor

evallesp commented Oct 22, 2025

testproject in the task: OSPRH-19950

evallesp
evallesp previously approved these changes Oct 22, 2025
Copy link
Contributor

@evallesp evallesp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@michburk
Copy link
Contributor Author

temporarily adding dnm label, running test project against this slightly modified test pr to make sure the ['ansible_env']['USER'/'HOME'] approach works as expected

@michburk
Copy link
Contributor Author

Reverted back to using hostvars['controller-0']['ansible_ssh_user'] instead of trying to get USER/HOME from controller-0's env. I tried running a test project with cifmw_reproducer_controller_user: "{{ hostvars['controller-0']['ansible_env']['USER'] }}" (notice there is no | default('zuul')) and this failed.

if I understand correctly, controller-0's ansible env is not available by the time we first try to use cifmw_reproducer_controller_user, but ansible_ssh_user is available, as it is set in the ansible controller's dynamic inventory by the task Inject all VMs in the inventory in roles/libvirt_manager/tasks/generate_networking_data.yml

It was already technically possible to create a controller-0 vm with a
non-zuul user. This commit enables configuring controller-0 with a
non-zuul user by using controller-0's `ansible_ssh_user` from
`hostvars` in place of hardcoded `'zuul'`.

It is worth noting that we can't simply use vars like ansible_user_id
or ansible_user_dir with tasks that are delgated to controller-0.
If the host we are running the reproducer from has a different user
from controller-0, these vars will try to use the user from
the machine that is running the reproducer rather than controller-0's
user.

For example, let's say we are running the reproducer from a machine with
the user 'exampleuser' and we have the user 'zuul' on controller-0.
If we have some task that is delegated to controller-0 and
tries to create some file in the controller-0 user's home directory, we
can't simply do:

```
- name: Create some file
  delegate_to: controller-0
  ansible.builtin.file:
    path: "{{ ansible_user_dir }}/some_file.txt"
    state: touch
```

`ansible_user_dir` resolves to `/home/exampleuser`. This path does not
exist on controller-0, so this task would fail.
Previously, the check for `common-requirements.txt` would check if
common requirements exists on localhost at a given path. This path is
based on the home directory on localhost.
If the file did exist, it would use that same path to try to install the
requirements on controller-0. This causes issues when localhost and
controller-0 do not have the same users and home directories.
@michburk
Copy link
Contributor Author

michburk commented Oct 28, 2025

uni alpha passed with #3433 (the same as this patch but without | default('zuul') when defining cifmw_reproducer_controller_user), see jira for test project links + some more explanation

Copy link
Contributor

@danpawlik danpawlik left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

06 and 04 (AFAIK) pass the CI.

@danpawlik
Copy link
Contributor

danpawlik commented Oct 30, 2025

@fultonj wanna test this change on local setup?

EDIT: doing it now

EDIT
Eh, I forget that I was doing test on my BM and I re-provision the BM...

@michburk michburk merged commit fd957cc into openstack-k8s-operators:main Nov 3, 2025
6 of 8 checks passed
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.

4 participants