Skip to content
This repository has been archived by the owner on Jan 12, 2023. It is now read-only.

Fix deprecated poetry install method #631

Merged
merged 3 commits into from
Sep 1, 2022
Merged

Conversation

bfreeds
Copy link
Contributor

@bfreeds bfreeds commented Sep 1, 2022

What's this PR do?

Patches/fixes broken poetry installation by:

  • Explicitly declaring version 1.1.14 (currently deployed version)
  • Setting an environment variable to ignore poetry deprecation warnings

Why are we doing this? How does it help us?

Starting 9/1, the build started failing due to a poetry deprecation of their installation process. @SimmonsRitchie hit this error when running make dev-shell:

Build fail output
=> ERROR [5/6] RUN curl -sSL https://raw.githubusercontent.com/python-poetry/poetry/master/get-poetry.py  3.1s
------                                                                                                          
 > [5/6] RUN curl -sSL https://raw.githubusercontent.com/python-poetry/poetry/master/get-poetry.py | python -   && poetry config virtualenvs.create false --local   && poetry install --no-dev:                                 
#9 3.066 Retrieving Poetry metadata                                                                             
#9 3.066                                                                                                        
#9 3.066 This installer is deprecated, and cannot install Poetry 1.2.0a1 or newer.
#9 3.066 Additionally, Poetry installations created by this installer cannot `self update` to 1.2.0a1 or later.
#9 3.066 You should migrate to https://install.python-poetry.org/ instead. Instructions are available at https://python-poetry.org/docs/#installation.
#9 3.066 
#9 3.066 This installer will now exit. If you understand the above warning and wish to proceed anyway, set GET_POETRY_IGNORE_DEPRECATION=1 in the environment and run this installer again.
#9 3.081 /bin/sh: 1: poetry: not found
------
executor failed running [/bin/sh -c curl -sSL https://raw.githubusercontent.com/python-poetry/poetry/master/get-poetry.py | python -   && poetry config virtualenvs.create false --local   && poetry install --no-dev]: exit code: 127
make: *** [base-image] Error 1

Previously we did not specify the version of poetry we were installing, so it implicitly upgraded to a breaking version 1.2. This is a temporary patch that gives us time to follow the upgrade to 1.2 and make the change to the new installation.

If applicable, what PR is this associated with in the texastribune repo?

https://github.com/texastribune/texastribune/pull/4744

Are there any smells or added technical debt to note?

Yes, we're using a now deprecated install method for poetry.

What are the relevant tickets?

TODOs / next steps:

  • your TODO here

This commit updates the URL we use to get poetry, after they deprecated
the old URL.

See: https://python-poetry.org/docs/

After this update, make dev-image-no-cache fails on an ssl error:

10 0.389 curl: (60) SSL certificate problem: certificate has expired
10 0.389 More details here: https://curl.haxx.se/docs/sslcerts.html
10 0.390
10 0.390 curl performs SSL certificate verification by default, using a "bundle"
10 0.390  of Certificate Authority (CA) public keys (CA certs). If the default
10 0.390  bundle file isn't adequate, you can specify an alternate file
10 0.390  using the --cacert option.
10 0.390 If this HTTPS server uses a certificate signed by a CA represented in
10 0.390  the bundle, the certificate verification probably failed due to a
10 0.390  problem with the certificate (it might be expired, or the name might
10 0.390  not match the domain name in the URL).
10 0.391 If you'd like to turn off curl's verification of the certificate, use
10 0.391  the -k (or --insecure) option.
10 0.399 /bin/sh: 1: poetry: not found
This commit uses an environment variable to pin the Poetry install to
1.1.14, the current version deployed in production and on staging.
This is to avoid imperative upgrades when we don't specificy an explicit version.

Want to set the version at our current version to rule that out in
troubleshooting the poetry install.
This commit uses the old, deprecated poetry install URL, but explicitly
uses older poetry 1.1.14 which does not break the build, and ignores
poetry deprecation warnings.

Poetry's new installation method breaks at version 1.2, so staying at
version 1.1.14 with the older URL should work for now.  Longer term fix
will be to upgrade the poetry installation method, but was hitting
SSL Certificate errors with the new method.

Bumping the python base version to 3.8.6 worked around the SSL Certificate
issue (I'm assuming with some update in the system packages that
held the new/updated certificates), but opened a new path of errors
raised around psycopg that will need to be investigated before bumping
poetry.
@SimmonsRitchie
Copy link
Contributor

I just tried this fix and it's working for me locally. No more problems with poetry installation. 🎉🎉🎉

Unless we have reason to believe this might fail in other environments, perhaps we're good to merge?

@bfreeds
Copy link
Contributor Author

bfreeds commented Sep 1, 2022

@SimmonsRitchie Thank you for trying locally and glad that this works! Yes, we're good to merge. I created a texastribune PR, and will bump the base version and merge over there to finish this PR.

@bfreeds bfreeds marked this pull request as ready for review September 1, 2022 20:43
@bfreeds bfreeds merged commit 42f0699 into master Sep 1, 2022
@bfreeds bfreeds deleted the fix-deprecated-poetry-install branch September 1, 2022 20:45
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants