ansible / ansible-documentation

Ansible community documentation
https://docs.ansible.com/
GNU General Public License v3.0
84 stars 502 forks source link

pip-compile workflows failing #2177

Open oraNod opened 1 week ago

oraNod commented 1 week ago

from @felixfontein in https://github.com/ansible/ansible-documentation/pull/1920#issuecomment-2480693020

it's no longer possible to run the update dependency tasks for stable-2.17 and stable-2.16 in CI. On these two branches the workflows have been deleted, and if you try to run them from devel, it tries to run the update for Python 3.11, while both branches use other Python versions. This makes the workflow fail:

https://github.com/ansible/ansible-documentation/actions/runs/11872098104/job/33085392232
https://github.com/ansible/ansible-documentation/actions/runs/11872098212/job/33085392580
oraNod commented 1 week ago

@felixfontein and @gotmax23

What about adding an input to set the Python version?

python-version:
        required: true
        type: choice
        options:
          - '3.11'
          - '3.10'
        default: '3.11'

Then we should be able to update the nox args with something like this:

nox-args: >-
  -e
  'pip-compile-${{ inputs.python-version || '3.11' }}(requirements)'
  'pip-compile-${{ inputs.python-version || '3.11' }}(requirements-relaxed)'
felixfontein commented 1 week ago

I've thought about that; alternatively we could automatically figure out the right version from the branch. But I guess making the Python version configurable would be a first step, we can always improve it later on :)

gotmax23 commented 6 days ago

I think we can actually fix the noxfile to not require specifying a Python version in the session name. I'll take a look (probably this weekend).

gotmax23 commented 2 days ago

I think we can actually fix the noxfile to not require specifying a Python version in the session name.

diff --git a/noxfile.py b/noxfile.py
index 9b53bc1d65..7904ab49e8 100644
--- a/noxfile.py
+++ b/noxfile.py
@@ -155,7 +155,7 @@ requirements_files = list(
 )

-@nox.session(name="pip-compile", python=["3.11"])
+@nox.session(name="pip-compile", python="3.11")
 @nox.parametrize(["req"], requirements_files, requirements_files)
 def pip_compile(session: nox.Session, req: str):
     """

and then

$ nox -l | grep pip-compile
- pip-compile(requirements-relaxed)
- pip-compile(requirements)
- pip-compile(pr_labeler)
- pip-compile(spelling)
- pip-compile(formatters)
- pip-compile(tag)
- pip-compile(static)
- pip-compile(typing)

as opposed to the previous

$ nox -l | grep pip-compile
- pip-compile-3.11(typing)
- pip-compile-3.11(pr_labeler)
- pip-compile-3.11(spelling)
- pip-compile-3.11(static)
- pip-compile-3.11(formatters)
- pip-compile-3.11(tag)
- pip-compile-3.11(requirements)
- pip-compile-3.11(requirements-relaxed)