ci: update integration and coverage workflow python version#190
ci: update integration and coverage workflow python version#190brahmanim wants to merge 16 commits into
Conversation
077a5ae to
124720d
Compare
124720d to
cc939fe
Compare
135348c to
4d992dd
Compare
| cancel-in-progress: true | ||
|
|
||
| on: # yamllint disable-line rule:truthy | ||
| pull_request: |
There was a problem hiding this comment.
We decided that the coverage test should run on a PR push, not on each PR commit.
Please see the Slack chat: https://redhat-internal.slack.com/archives/CGUMLTNLS/p1783492350136339?thread_ts=1783440020.417639&cid=CGUMLTNLS
| @@ -1,5 +1,5 @@ | |||
| --- | |||
| deploy_flask_app_workers_ssh_private_key: /tmp/id_rsa | |||
There was a problem hiding this comment.
This appears to be a breaking change. Why are you changing this?
There was a problem hiding this comment.
Integration tests target test_deploy_flask_app, failed with error:
TASK [cloud.aws_ops.deploy_flask_app : Ensure SSH directory exists on bastion host] ***
[ERROR]: Task failed: Module failed: [Errno 1] Operation not permitted: b'/tmp'
Origin: /Users/brahmani/.ansible/collections/ansible_collections/cloud/aws_ops/roles/deploy_flask_app/tasks/setup_infra.yaml:40:3
38 register: deploy_flask_app__keypair_result
39
40 - name: Ensure SSH directory exists on bastion host
^ column 3
fatal: [localhost -> ec2-18-212-199-252-bastion(18.212.199.252)]: FAILED! => {"changed": false, "msg": "Task failed: Module failed: [Errno 1] Operation not permitted: b'/tmp'"}
AI suggested changing the deploy_flask_app_workers_ssh_private_key value to ~/.ssh/workers_id_rsa.
Do you have a solution that won't be a breaking change ( I will try to find one)?
There was a problem hiding this comment.
I override the integration test vars, tests/integration/targets/test_deploy_flask_app/roles/run_deploy_flask_app/vars/main.yaml, — not in role defaults — so existing consumers of /tmp/id_rsa are unchanged.
| path: "{{ deploy_flask_app_workers_ssh_private_key | dirname }}" | ||
| state: directory | ||
| mode: "0700" | ||
| delegate_to: "{{ deploy_flask_app__bastion_hostname }}" |
There was a problem hiding this comment.
| delegate_to: "{{ deploy_flask_app__bastion_hostname }}" | |
| ansible.builtin.file: | |
| path: "{{ deploy_flask_app_workers_ssh_private_key | expanduser | dirname }}" | |
| state: directory | |
| mode: "0700" | |
| when: (deploy_flask_app_workers_ssh_private_key | expanduser | dirname) not in ['/tmp', '/var/tmp', '/'] | |
| delegate_to: "{{ deploy_flask_app__bastion_hostname }}" |
Potentially a nitpick, but with deploy_flask_app_workers_ssh_private_key: /tmp/id_rsa, this task was effectively chmod 0700 /tmp, which fails on Fedora. Skipping the ensure-dir step for system parents (/tmp, /var/tmp, /), and using expanduser would resolve ~/.ssh/... correctly.
There was a problem hiding this comment.
You have a good point here. Althought the test does not use the default role dir /tmp; that will be good to skip the check if someone chooses to use the role default(not in the test).
I also added the /var/tmp dir as you suggested, althought usually this folder has 777 permissions.
There was a problem hiding this comment.
I chose not to use Jinja | expanduser here. And keep the tilde and skip only with | dirname.
The integration tests were failing with permission denied while using Jinja | expanduser.
The | expanduser runs on the controller, not the bastion, so:
~/.ssh/workers_id_rsa → /root/.ssh/workers_id_rsa
That absolute path is then delegate_to’d to the bastion as user fedora, which cannot create /root/.ssh.
Without expanduser, the path stays ~/.ssh. The file module expands ~ on the remote to /home/fedora/.ssh, which works.
| ansible_ssh_common_args: -o "UserKnownHostsFile=/dev/null" -o StrictHostKeyChecking=no -i {{ customized_ami_private_key_file }} | ||
| ansible_python_interpreter: auto | ||
|
|
||
| - name: Install coverage on remote host for coverage collection |
There was a problem hiding this comment.
Why is this needed? This modifies the behaviour of the role.
There was a problem hiding this comment.
When integration tests are running with --coverage flag, Ansible-core injects the coverage module into every Ansible module executed on remote hosts.
When tasks delegate_to EC2/bastion instances, those Fedora cloud hosts have Python 3.13 but no coverage package:
TASK [cloud.aws_ops.customized_ami : Gather facts from ec2 instance] ***********
[WARNING]: Host 'testhost' is using the discovered Python interpreter at '/usr/bin/python3.13', but future installation of another Python interpreter could cause a different interpreter to be discovered. See https://docs.ansible.com/ansible-core/devel/reference_appendices/interpreter_discovery.html for more information.
[ERROR]: Task failed: Module failed: No module named 'coverage'
Origin: /root/ansible_collections/cloud/aws_ops/roles/customized_ami/tasks/create_ec2_resources.yaml:88:3
86 ansible_python_interpreter: auto
87
88 - name: Gather facts from ec2 instance
^ column 3
fatal: [testhost -> ec2(32.192.24.200)]: FAILED! => {"ansible_facts": {"discovered_interpreter_python": "/usr/bin/python3.13"}, "changed": false, "msg": "Task failed: Module failed: No module named 'coverage'"}
In case installing the coverage package on the new Fedora instance changes the role behaviour, I can remove it from this PR, but we should find a solution for coverage integration tests in another PR.
I would love to have your opinion about that.
There was a problem hiding this comment.
I do not think this step should be into the role that a user will be using. Can't we add " Install coverage on remote host for coverage collection" as an additional step to the integration role instead?
| ansible_python_interpreter: /usr/bin/python3 | ||
| ansible_ssh_common_args: '-o "UserKnownHostsFile=/dev/null" -o StrictHostKeyChecking=no -i {{ deploy_flask_app_bastion_ssh_private_key_path }}' | ||
|
|
||
| - name: Install coverage on bastion host for coverage collection |
|



Resolves
ACA-6690
SUMMARY
Updates Python version to 3.13 in integration and coverage test workflows.
Changes:
Name: Fedora-Cloud-Base-.x86_64-4 (matches current Fedora 4x images, excludes ELN/Rawhide)
push, instead of each pull_request.test_backup_select_resources- update iam create role to include ansible-test prefix.test_deploy_flask_app- Gather information about RDS engine version instead of using a constant var value.test_deploy_flask_app- update bastion_host_iam_role iam create role to include ansible-test prefix.test_customized_ami- use setup_rsa_keys__path with ansible.builtin.file instead of tempfile.roles/deploy_flask_app- Move key path from /tmp/id_rsa → ~/.ssh/workers_id_rsatest_deploy_flask_app- Fixing bastion user_data in test_deploy_flask_app to use dnf and Fedora-appropriate packages.roles/customized_ami/tasks/create_ec2_resources.yamlandroles/deploy_flask_app/tasks/setup_infra.yaml- to install coverage on the bastion host for coverage collection.ngnix, instead of relying onpodmanbeing absent from the Fedora 4x base image.roles/manage_transit_gateway- updated debug message.ISSUE TYPE
Test Pull Request
COMPONENT NAME
CI/CD workflows
Reported CI Issues
Integration tests #184
Assisted-by: Claude Sonnet 4.5 (claude-sonnet-4-5@20250929)