From cf74d70961355fe191f7c395c97e8574d01c3832 Mon Sep 17 00:00:00 2001 From: Ian Wienand Date: Fri, 15 Jul 2022 09:45:10 +1000 Subject: [PATCH] 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 --- roles/upload-pypi/tasks/main.yaml | 5 ----- test-playbooks/python/upload-pypi.yaml | 13 +++---------- 2 files changed, 3 insertions(+), 15 deletions(-) diff --git a/roles/upload-pypi/tasks/main.yaml b/roles/upload-pypi/tasks/main.yaml index b3917705f..10e67f25a 100644 --- a/roles/upload-pypi/tasks/main.yaml +++ b/roles/upload-pypi/tasks/main.yaml @@ -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' diff --git a/test-playbooks/python/upload-pypi.yaml b/test-playbooks/python/upload-pypi.yaml index ee2e0ffe4..3a0e67317 100644 --- a/test-playbooks/python/upload-pypi.yaml +++ b/test-playbooks/python/upload-pypi.yaml @@ -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