Hi Miro,

I cannot help with the ansible magic but if you do not have STI as a hard requirement I think there might be a relatively straightforward way to cover your use case using tmt as it allows to set an environment variable for the whole plan. Your rpms/python3.11 config could look like this:

discover:
    how: fmf
    url: https://src.fedoraproject.org/tests/python
    filter: component:python311
prepare:
    how: install
    package:
      - python3.11
      - python3.11-test
      - python3.11-tkinter
environment:
    VERSION: "3.11"
execute:
    how: tmt

In this way you would specify the python version and the proper package list only once. The test metadata could be shared from the tests namespace, no need to repeat the list again and again in individual rpms namespace branches. I've outlined a simple setup in the following pull request:

https://src.fedoraproject.org/tests/python/pull-request/47

If this sounds like a viable solution feel free to ping me or anybody on the #tmt channel for details. We'll be glad to help you with the config.

psss...

On Wed, 22 Jun 2022 at 12:56, Miro Hrončok <mhroncok@redhat.com> wrote:
Hello,

please bare with me because my Ansible skills are close to none. I only use it
for Fedora CI.

I've read
https://docs.ansible.com/ansible/latest/user_guide/playbooks_variables.html#defining-simple-variables

I have this (simplified) tests.yml:

     ---
     - hosts: localhost
       roles:
       - role: standard-test-basic
         tests:
         - smoke:
             dir: python/smoke
             run: VERSION=3.11 ./venv.sh
         required_packages:
         - python3.11
         - python3.11-devel

Full version in
https://src.fedoraproject.org/rpms/python3.11/blob/rawhide/f/tests/tests.yml

I would like to replace all occurrences of 3.11 with a variable:


     ---
     - hosts: localhost
       roles:
       - role: standard-test-basic
         tests:
         - smoke:
             dir: python/smoke
             run: VERSION={{ pybasever }} ./venv.sh
         required_packages:
         - python{{ pybasever }}
         - python{{ pybasever }}-devel


But where do I put pybasever: '3.11' exactly?


Bonus question: Can I read the tested package name and regex it into the variable?

     pybasever:  {{ xxx_package_name|pex_regex_replace('^python', '') }}

Thanks,
--
Miro Hrončok
--
Phone: +420777974800
IRC: mhroncok
_______________________________________________
CI mailing list -- ci@lists.fedoraproject.org
To unsubscribe send an email to ci-leave@lists.fedoraproject.org
Fedora Code of Conduct: https://docs.fedoraproject.org/en-US/project/code-of-conduct/
List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines
List Archives: https://lists.fedoraproject.org/archives/list/ci@lists.fedoraproject.org
Do not reply to spam on the list, report it: https://pagure.io/fedora-infrastructure