upload-pypi: always test upload

Simplify the update procedure by tagging the checkout with the current
unix timestamp, so we should always having an increasing version
number.  This means we can do the test upload unconditionally in the
check gate.  Given this runs very infrequently, this shouldn't be a
burden.

Change-Id: I12c222802297d760296d35651db8d22fedb6dab4
This commit is contained in:
Ian Wienand 2022-07-15 09:45:10 +10:00
parent 673a499e7b
commit cf74d70961
2 changed files with 3 additions and 15 deletions

View File

@ -1,8 +1,3 @@
# NOTE(ianw) 2022-07 : If you modify this, see the comments about
# testing in test-playbooks/python/upload-pypi.yaml. Once the change
# is finalised, you should do one run that uploads the sandbox project
# to test.pypi.org to validate the full path.
- name: Validate password/token combo
fail:
msg: 'Specify either username/password or api_token'

View File

@ -29,23 +29,17 @@
msg: 'upload-pypi did not fail as it should'
when: _role_failed is not true
# We tag this with the unix timestamp so that the upload always
# has an increasing version number.
- name: Import sandbox project
shell: |
git clone https://opendev.org/opendev/sandbox
pushd sandbox
git tag $(date '+%s')
python3 setup.py bdist_wheel
args:
executable: '/bin/bash'
# NOTE(ianw) 2022-07 : You can not upload the same release twice,
# so this is disabled by default. Before we commit changes to the
# upload-pypi role, we should do one test run with this
# uncommented to validate the entire path, then re-comment it for
# the final commit.
- name: Run full upload
set_fact:
_run_full_upload: false
# This value is restricted to uploading the sandbox package to
# test.pypi.org; it is not kept in plain text to avoid things that
# grep for accidentally committed tokens finding it, but it is not
@ -67,4 +61,3 @@
api_token: '{{ _api_token | b64decode }}'
repository: testpypi
pypi_path: '{{ ansible_user_dir }}/sandbox/dist'
when: _run_full_upload