pypa / twine

Utilities for interacting with PyPI
https://twine.readthedocs.io/
Apache License 2.0
1.61k stars 308 forks source link

The upload --skip-existing command does not work on a Nexus Repository instance with a PostgreSQL database #1044

Open StykMartin opened 10 months ago

StykMartin commented 10 months ago

Is there an existing issue for this?

What keywords did you use to search existing issues?

nexus PostgreSQL skip-existing

Please describe why your using this option

Hello maintainers,

We recently migrated from OrientDB to the PostgreSQL database for Nexus Repository Pro (without upgrading Nexus version). We noticed that the --skip-existing option does not work anymore. The problem is that the response from Nexus Repository Pro contains different error messages depending on the DB.

OrientDB

Repository does not allow updating assets: pypi-hosted

PostgreSQL

pypi-hosted/packages/<package>/<version>/<package>-<version>-py3-none-any.whl cannot be updated

Current logic does not cover this behavior https://github.com/pypa/twine/blob/fe1885f2bf896c1852dedea7733a582c5718bbbc/twine/commands/upload.py#L64-L65

Anything else you'd like to mention?

No response

sigmavirus24 commented 10 months ago

Frankly you're paying for Nexus and they're giving two very different messages for the same error. Given how tenuous our ability to detect this already is, I'd strongly push on Nexus fixing this instead of us.

andrewharle commented 3 months ago

Same issue with Nexus OSS (3.70.1-02) using the new embedded H2 database.

html output `twine upload --repository-url ${NEXUS_HOST_ADDR}/ --skip-existing $(ls *.whl)` ```html 400 - Sonatype Nexus Repository
Exclamation point Error 400 Bad Request
pypi-hosted/packages///--py3-none-any.whl cannot be updated
```
evgevyr commented 2 months ago

Same issue with Nexus OSS (3.71.0-06) using the new embedded H2 database.

twine upload --verbose --skip-existing ./wheels/* ```html 400 - Sonatype Nexus Repository
Exclamation point Error 400 Bad Request
pip-alpine/packages/django/5.0.8/Django-5.0.8-py3-none-any.whl cannot be updated
ERROR HTTPError: 400 Bad Request from https://localhost/repository/pip-alpine/ pip-alpine/packages/django/5.0.8/Django-5.0.8-py3-none-any.whl cannot be updated ```
StykMartin commented 2 months ago

Since the FOSS version is now affected, I think we should address this issue. I'll look into it and provide a patch to fix it.

sigmavirus24 commented 2 months ago

Glad to hear you're sending a fix to Nexus now that their broken code is open source

WatskeBart commented 1 week ago

Confirming here on Nexus-OSS v3.37.0-12 with embedded H2 db.

It seems like the changed output is since >=v3.71.0, everything before that also supported the OrientDB which is deprecated since then.

@StykMartin any luck on cooking up a patch?

StykMartin commented 1 week ago

@WatskeBart I have it in my backlog, but since everyone is experiencing the same problem, I will bump it up in priority. I'll cook it this week and see how it goes.