summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZuul <zuul@review.openstack.org>2019-02-05 16:11:34 +0000
committerGerrit Code Review <review@openstack.org>2019-02-05 16:11:34 +0000
commitbb0788ff0c1cab900dda6a631d329f2f5e36485b (patch)
tree3dcccd5c7d0edf6ff47b304cf01e90aad3f3734d
parent58cf603ce7120de2be1ba069805c754f3c6c50dc (diff)
parentfa9cb2f468eb4d8a45c7cc0aef4afe8070ffb55a (diff)
Merge "upload-pypi: add option to register packages"
-rw-r--r--roles/upload-pypi/README.rst6
-rw-r--r--roles/upload-pypi/defaults/main.yaml1
-rw-r--r--roles/upload-pypi/tasks/main.yaml12
3 files changed, 19 insertions, 0 deletions
diff --git a/roles/upload-pypi/README.rst b/roles/upload-pypi/README.rst
index cbcc0da..aba4b56 100644
--- a/roles/upload-pypi/README.rst
+++ b/roles/upload-pypi/README.rst
@@ -35,3 +35,9 @@ Upload python packages to PyPI
35 :default: twine 35 :default: twine
36 36
37 Path to twine executable. 37 Path to twine executable.
38
39.. zuul:rolevar:: pypi_register_first
40 :default: false
41
42 Whether the role should register the package before uploading it. This may
43 be required when uploading for the first time to a devPI instance.
diff --git a/roles/upload-pypi/defaults/main.yaml b/roles/upload-pypi/defaults/main.yaml
index c0cb93b..1d4b750 100644
--- a/roles/upload-pypi/defaults/main.yaml
+++ b/roles/upload-pypi/defaults/main.yaml
@@ -3,3 +3,4 @@ pypi_path: "src/{{ zuul.project.canonical_name }}/dist"
3pypi_repository: "{{ pypi_info.repository|default('pypi') }}" 3pypi_repository: "{{ pypi_info.repository|default('pypi') }}"
4pypi_repository_url: "{{ pypi_info.repository_url|default(None) }}" 4pypi_repository_url: "{{ pypi_info.repository_url|default(None) }}"
5pypi_twine_executable: twine 5pypi_twine_executable: twine
6pypi_register_first: false
diff --git a/roles/upload-pypi/tasks/main.yaml b/roles/upload-pypi/tasks/main.yaml
index 864fe4d..fb5c10c 100644
--- a/roles/upload-pypi/tasks/main.yaml
+++ b/roles/upload-pypi/tasks/main.yaml
@@ -20,6 +20,11 @@
20 msg: "Found no wheels to upload: {{found_wheels.msg}}" 20 msg: "Found no wheels to upload: {{found_wheels.msg}}"
21 when: found_wheels.files == [] 21 when: found_wheels.files == []
22 22
23- name: Register packages on the PyPI server (via wheels)
24 command: "{{ pypi_twine_executable }} register --config-file {{ _pypirc_tmp.path }} --repository {{ pypi_repository }} {{ item.path }}"
25 with_items: "{{ found_wheels.files }}"
26 when: pypi_register_first
27
23- name: Upload wheel with twine before tarballs 28- name: Upload wheel with twine before tarballs
24 command: "{{ pypi_twine_executable }} upload --config-file {{ _pypirc_tmp.path }} -r {{ pypi_repository }} {{ item.path }}" 29 command: "{{ pypi_twine_executable }} upload --config-file {{ _pypirc_tmp.path }} -r {{ pypi_repository }} {{ item.path }}"
25 with_items: "{{ found_wheels.files }}" 30 with_items: "{{ found_wheels.files }}"
@@ -35,6 +40,13 @@
35 msg: "Found no tarballs to upload: {{found_tarballs.msg}}" 40 msg: "Found no tarballs to upload: {{found_tarballs.msg}}"
36 when: found_tarballs.files == [] 41 when: found_tarballs.files == []
37 42
43- name: Register packages on the PyPI server (via tarballs)
44 command: "{{ pypi_twine_executable }} register --config-file {{ _pypirc_tmp.path }} --repository {{ pypi_repository }} {{ item.path }}"
45 with_items: "{{ found_tarballs.files }}"
46 when:
47 - pypi_register_first
48 - found_wheels.files == []
49
38- name: Upload tarballs with twine 50- name: Upload tarballs with twine
39 command: "{{ pypi_twine_executable }} upload --config-file {{ _pypirc_tmp.path }} -r {{ pypi_repository }} {{ item.path }}" 51 command: "{{ pypi_twine_executable }} upload --config-file {{ _pypirc_tmp.path }} -r {{ pypi_repository }} {{ item.path }}"
40 with_items: "{{ found_tarballs.files }}" 52 with_items: "{{ found_tarballs.files }}"