zuul-jobs/roles/upload-pypi/README.rst
Jeremy Stanley 4a04383076 pypi-upload: support twine --skip-existing option
Warehouse (the software implementing the PyPI service) expressly
disallows reuploading any file which is already present, and returns
an error if you attempt to do so. Under normal circumstances this is
desirable feedback, but if you're using this role to upload a batch
of files and encounter a network or service error partway through,
you can be left in a position where it's impossible to rerun the job
for those same artifacts later in order to correct the issue.

Add a pypi_twine_skip_existing boolean toggle to the pypi-upload
role, which will allow callers to indicate to twine that errors from
PyPI indicating a file is already present are to be treated as a
non-fatal condition so that it can proceed with uploading any which
do exist. Set its default to false, preserving the existing behavior
for the sake of backward compatibility.

In addition to the previously stated use case, this also makes it
possible to build different architecture-specific wheels in separate
jobs without needing to worry about deciding which one will include
the sdist, since they can all try to upload it safely.

Change-Id: I66a8ffce47eb5e856c3b481c20841b92e060b532
2022-11-08 13:26:22 +00:00

56 lines
1.4 KiB
ReStructuredText

Upload python packages to PyPI
**Role Variables**
.. zuul:rolevar:: pypi_info
Complex argument which contains the information about the PyPI
server as well as the authentication information needed. It is
expected that this argument comes from a `Secret`.
.. zuul:rolevar:: api_token
:default: None
PyPi API token to use for upload. If specified, ``username`` and
``password`` should be empty.
.. zuul:rolevar:: username
Username to use to log in to PyPI. `Note` PyPi reccommends using
two-factor auth and generating an API token for uploading.
.. zuul:rolevar:: password
Password to use to log in to PyPI.
.. zuul:rolevar:: repository
:default: pypi
Name of the repository to upload to.
.. zuul:rolevar:: repository_url
:default: The built-in twine default for the production pypi.org service.
URL of the PyPI repostory.
.. zuul:rolevar:: pypi_path
:default: src/{{ zuul.project.canonical_name }}/dist
Path containing artifacts to upload.
.. zuul:rolevar:: pypi_twine_executable
:default: twine
Path to twine executable.
.. zuul:rolevar:: pypi_twine_skip_existing
:default: false
Skip uploading any file which already exists, rather than failing.
.. zuul:rolevar:: pypi_register_first
:default: false
Whether the role should register the package before uploading it. This may
be required when uploading for the first time to a devPI instance.