twine icon indicating copy to clipboard operation
twine copied to clipboard

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

Open StykMartin opened this issue 1 year ago • 5 comments

Is there an existing issue for this?

  • [X] I have searched the existing issues (open and closed), and could not find an existing issue

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

StykMartin avatar Jan 09 '24 13:01 StykMartin

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.

sigmavirus24 avatar Jan 12 '24 16:01 sigmavirus24

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)

<!DOCTYPE html>
<html lang="en">
<head>
    <title>400 - Sonatype Nexus Repository</title>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>


    <link rel="icon" type="image/png" href="../../static/rapture/resources/safari-favicon-32x32.png?3.70.1-02" sizes="32x32">
    <link rel="mask-icon" href="../../static/rapture/resources/favicon-white.svg?3.70.1-02" color="#00bb6c">
    <link rel="icon" type="image/png" href="../../static/rapture/resources/favicon.svg?3.70.1-02" sizes="16x16">

    <link rel="stylesheet" type="text/css" href="../../static/css/nexus-content.css?3.70.1-02"/>
</head>
<body>
<div class="nexus-header">
    <a href="../..">
        <div class="product-logo">
            <img src="../../static/rapture/resources/nxrm-reverse-icon.png?3.70.1-02" alt="Product logo"/>
        </div>
        <div class="product-id">
            <div class="product-id__line-1">
                <span class="product-name">Sonatype Nexus Repository</span>
            </div>
            <div class="product-id__line-2">
                <span class="product-spec">OSS 3.70.1-02</span>
            </div>
        </div>
    </a>
</div>

<div class="nexus-body">
    <div class="content-header">
        <img src="../../static/rapture/resources/icons/x32/exclamation.png?3.70.1-02" alt="Exclamation point" aria-role="presentation"/>
        <span class="title">Error 400</span>
        <span class="description">Bad Request</span>
    </div>
    <div class="content-body">
        <div class="content-section">
            pypi-hosted/packages/<package>/<version>/<package>-<version>-py3-none-any.whl cannot be updated
        </div>
    </div>
</div>
</body>
</html>

andrewharle avatar Jul 27 '24 08:07 andrewharle

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

twine upload --verbose --skip-existing ./wheels/*
<!DOCTYPE html>
<html lang="en">
<head>
  <title>400 - Sonatype Nexus Repository</title>
  <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
  <link rel="icon" type="image/png" href="../../static/rapture/resources/safari-favicon-32x32.png?3.71.0-06" sizes="32x32">
  <link rel="mask-icon" href="../../static/rapture/resources/favicon-white.svg?3.71.0-06" color="#00bb6c">
  <link rel="icon" type="image/png" href="../../static/rapture/resources/favicon.svg?3.71.0-06" sizes="16x16">
  <link rel="stylesheet" type="text/css" href="../../static/css/nexus-content.css?3.71.0-06"/>
</head>
<body>
<div class="nexus-header">
  <a href="../..">
    <div class="product-logo">
      <img src="../../static/rapture/resources/nxrm-reverse-icon.png?3.71.0-06" alt="Product logo"/>
    </div>
    <div class="product-id">
      <div class="product-id__line-1">
        <span class="product-name">Sonatype Nexus Repository</span>
      </div>
      <div class="product-id__line-2">
        <span class="product-spec">OSS 3.71.0-06</span>
      </div>
    </div>
  </a>
</div>

<div class="nexus-body">
  <div class="content-header">
    <img src="../../static/rapture/resources/icons/x32/exclamation.png?3.71.0-06" alt="Exclamation point" aria-role="presentation"/>
    <span class="title">Error 400</span>
    <span class="description">Bad Request</span>
  </div>
  <div class="content-body">
    <div class="content-section">
      pip-alpine/packages/django/5.0.8/Django-5.0.8-py3-none-any.whl cannot be updated
    </div>
  </div>
</div>
</body>
</html>


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

evgevyr avatar Aug 16 '24 14:08 evgevyr