snok / install-poetry

Github action for installing and configuring Poetry
MIT License
572 stars 53 forks source link

Actions started failing recently. #131

Closed gitonthescene closed 1 year ago

gitonthescene commented 1 year ago

Hi there, I'm not really sure how to debug this but my actions recently have started failing while installing poetry.

I believe I've set it up right.

  #----------------------------------------------
  #  -----  install & configure poetry  -----      
  #----------------------------------------------
  - name: Install Poetry
    uses: snok/install-poetry@v1
    with:
      virtualenvs-in-project: true

I'm not sure where to look for the logs mentioned in the action.

Poetry installation failed.
See /home/runner/work/csv-reconcile/csv-reconcile/poetry-installer-error-896tncri.log for error logs.
Error: Process completed with exit code 1.

I see there was a release recently, but it's not clear to me if I need to take any action. (No pun intended) Should I be pointing to 1.3.4 explicitly?

Poetry itself was also released recently and it looks like the action is trying to pull this version. Perhaps some incompatibility was introduced?

Sorry I can't be more helpful. Any advice you could offer would be appreciated. I'm happy to offer any information that might prove useful.

Regards

sondrelg commented 1 year ago

Hi @gitonthescene! Thanks for reporting, and your setup looks good to me :+1:

I see there was a release recently, but it's not clear to me if I need to take any action. (No pun intended) Should I be pointing to 1.3.4 explicitly?

No, v1 and v1.3.4 should be the same :+1:

Poetry itself was also released recently and it looks like the action is trying to pull this version. Perhaps some incompatibility was introduced?

Yeah this could be. Would you mind trying to run the action with version: 1.5.1, or some older version, to see if it fails then?

gitonthescene commented 1 year ago

Not at all. WiIl post back shortly...

gitonthescene commented 1 year ago

That seemed to work. It took me a minute to realize that rerunning the broken action wasn't pulling in the changes to the workflow, but...

I'm curious how you debug this. Do you just run that bash script in a Docker container or something?

sondrelg commented 1 year ago

It's possible to use act to test the workflow locally, but I've mostly just tested in CI in the past.

For this issue, I wonder if it would be worth trying to:

..to see if the requests requirement is what breaks things

gitonthescene commented 1 year ago

That seemed to work just fine. I didn't change the version of poetry in this run, but assume that wasn't the point because this gets run before installing poetry.

sondrelg commented 1 year ago

Ah sorry, I think we'd need to check with poetry v1.6.1 to check whether it fixes your original problem. I suspect Github runners might not ship with the correct version of requests.

gitonthescene commented 1 year ago

Oh, okay. That seems not to have worked with the v1.6.1.

sondrelg commented 1 year ago

How odd, thanks for checking! I guess running the action locally with act, or running the shell script steps manually might be the best way to debug this further - and checking the generated poetry installer logs. Feel free to take a stab at that if you have time! If not I might be able to later tonight :slightly_smiling_face:

gitonthescene commented 1 year ago

I tried looking at this but it's hard to know how much of the environment is expected inside of the github action. I made a Dockerfile which looks like this:

FROM ubuntu:latest
RUN apt-get -y update && \
    apt-get -y install curl && \
    apt-get -y install python3 && \
    apt-get -y install pip

ENV GITHUB_PATH=/usr/src/myapp/github
ENV GITHUB_ENV=/usr/src/myapp/githubenv

And ran it inside a clone of this repository like this:

docker run -it --rm -v "$PWD":/usr/src/myapp snoktest /bin/sh

If that's reasonable I think the issue is missing defaults in the main.sh file. The following diff seems to work with this setup:

-poetry config virtualenvs.create "$VIRTUALENVS_CREATE"
-poetry config virtualenvs.in-project "$VIRTUALENVS_IN_PROJECT"
-poetry config virtualenvs.path "$VIRTUALENVS_PATH"
+poetry config virtualenvs.create "${VIRTUALENVS_CREATE:-true}"
+poetry config virtualenvs.in-project "${VIRTUALENVS_IN_PROJECT:-true}"
+poetry config virtualenvs.path "${VIRTUALENVS_PATH:-$INSTALL_PATH/venv}"

config="$(poetry config --list)"

if echo "$config" | grep -q -c "installer.parallel"; then
-   poetry config installer.parallel "$INSTALLER_PARALLEL"
+   poetry config installer.parallel "${INSTALLER_PARALLEL:-false}"

Let me know if this helps.

Regards

sondrelg commented 1 year ago

Hmm :thinking: I think these values will be set in practice, as the action has defaults, and the shell script is always invoked like this: https://github.com/snok/install-poetry/blob/main/action.yml#L31:L43

gitonthescene commented 1 year ago

Perhaps this environment doesn’t exactly replicate how it should work, but it worked in this environment. Hmm.. Maybe I should try a different os than Ubuntu.

gitonthescene commented 1 year ago

Maybe change the script to be invoked with bash -x so we can see what's being run inside the action?

Or maybe add a signal trap and print the log before failing??

sondrelg commented 1 year ago

Looks like Poetry v1.6.0 and above no longer supports Python 3.7:

ERROR: Ignored the following versions that require a different python version: 1.6.0 Requires-Python >=3.8,<4.0; 1.6.1 Requires-Python >=3.8,<4.0
ERROR: Could not find a version that satisfies the requirement poetry==1.6.0 (from versions: 0.1.0, 0.2.0, 0.3.0, 0.4.0, 0.4.0.post1, 0.4.1, 0.4.2, 0.5.0b1, 0.5.0b2, 0.5.0, 0.6.0, 0.6.1, 0.6.2, 0.6.3b1, 0.6.3b2, 0.6.3b3, 0.6.3b4, 0.6.3b5, 0.6.3b6, 0.6.3b7, 0.6.3, 0.6.4b1, 0.6.4, 0.6.5, 0.7.0b1, 0.7.0b2, 0.7.0b3, 0.7.0b4, 0.7.0, 0.7.1, 0.8.0a0, 0.8.0a1, 0.8.0a2, 0.8.0a3, 0.8.0a4, 0.8.0, 0.8.1a0, 0.8.1, 0.8.2, 0.8.3, 0.8.4, 0.8.5a0, 0.8.5, 0.8.6, 0.9.0a0, 0.9.0a1, 0.9.0a2, 0.9.0a3, 0.9.0, 0.9.1, 0.10.0a0, 0.10.0a1, 0.10.0a2, 0.10.0a3, 0.10.0, 0.10.1, 0.10.2, 0.10.3, 0.11.0a0, 0.11.0a1, 0.11.0a2, 0.11.0a3, 0.11.0a4, 0.11.0, 0.11.1, 0.11.2, 0.11.3, 0.11.4, 0.11.5, 0.12.0a0, 0.12.0a1, 0.12.0a2, 0.12.0a3, 0.12.0a4, 0.12.0a5, 0.12.0, 0.12.1, 0.12.2, 0.12.3, 0.12.4, 0.12.5, 0.12.6, 0.12.7, 0.12.8, 0.12.9, 0.12.10, 0.12.11, 0.12.12, 0.12.13, 0.12.14, 0.12.15, 0.12.16, 0.12.17, 1.0.0a0, 1.0.0a1, 1.0.0a2, 1.0.0a3, 1.0.0a4, 1.0.0a5, 1.0.0b1, 1.0.0b2, 1.0.0b3, 1.0.0b4, 1.0.0b5, 1.0.0b6, 1.0.0b7, 1.0.0b8, 1.0.0b9, 1.0.0, 1.0.1, 1.0.2, 1.0.3, 1.0.4, 1.0.5, 1.0.6, 1.0.7, 1.0.8, 1.0.9, 1.0.10, 1.1.0a1, 1.1.0a2, 1.1.0a3, 1.1.0b1, 1.1.0b2, 1.1.0b3, 1.1.0b4, 1.1.0rc1, 1.1.0, 1.1.1, 1.1.2, 1.1.3, 1.1.4, 1.1.5, 1.1.6, 1.1.7, 1.1.8, 1.1.9, 1.1.10, 1.1.11, 1.1.12, 1.1.13, 1.1.14, 1.1.15, 1.2.0a1, 1.2.0a2, 1.2.0b1, 1.2.0b2, 1.2.0b3, 1.2.0rc1, 1.2.0rc2, 1.2.0, 1.2.1, 1.2.2, 1.3.0, 1.3.1, 1.3.2, 1.4.0, 1.4.1, 1.4.2, 1.5.0, 1.5.1)
ERROR: No matching distribution found for poetry==1.6.0

Traceback:

  File "/var/folders/24/8k48jl6d249_n_qfxwsl6xvm0000gn/T/tmp.qaP8pFtf", line 9[23](https://github.com/snok/install-poetry/actions/runs/6106514510/job/16571742739#step:5:24), in main
    return installer.run()
  File "/var/folders/[24](https://github.com/snok/install-poetry/actions/runs/6106514510/job/16571742739#step:5:25)/8k48jl6d249_n_qfxwsl6xvm0000gn/T/tmp.qaP8pFtf", line 560, in run
    self.install(version)
  File "/var/folders/24/8k48jl6d249_n_qfxwsl6xvm0000gn/T/tmp.qaP8pFtf", line 582, in install
    self.install_poetry(version, env)
  File "/var/folders/24/8k48jl6d249_n_qfxwsl6xvm0000gn/T/tmp.qaP8pFtf", line 685, in install_poetry
    env.pip("install", specification)
  File "/var/folders/24/8k48jl6d249_n_qfxwsl6xvm0000gn/T/tmp.qaP8pFtf", line 375, in pip
    return self.python("-m", "pip", *args, **kwargs)
  File "/var/folders/24/8k48jl6d249_n_qfxwsl6xvm0000gn/T/tmp.qaP8pFtf", line 372, in python
    return self.run(self._python, *args, **kwargs)
  File "/var/folders/24/8k48jl6d249_n_qfxwsl6xvm0000gn/T/tmp.qaP8pFtf", line [36](https://github.com/snok/install-poetry/actions/runs/6106514510/job/16571742739#step:5:37)7, in run
    log=completed_process.stdout.decode(),

Notice Requires-Python >=3.8,<4.0

sondrelg commented 1 year ago

See https://github.com/python-poetry/poetry/pull/7674 :+1:

gitonthescene commented 1 year ago

Ah! I’ll remove it from my matrix. Thanks.