zuul-jobs/playbooks/python/tarball-post.yaml
James E. Blair acbe2849da download-artifacts: only consider the most recent build
If the download-artifacts query returns more than one build, only
use the most recent one, as earlier builds may be for failed gate
runs and fetching them may fail.

Also, fix one more location which was missing an "artifacts/"
path prefix when returing artifacts.

Change-Id: If988d1f2bea863e0dad267359515018aae25ad45
2019-06-11 08:42:51 -07:00

52 lines
1.4 KiB
YAML

- hosts: all
tasks:
- name: Find tarballs and wheels in dist folder.
find:
file_type: file
paths: "src/{{ zuul.project.canonical_name }}/dist"
patterns: "*.tar.gz,*.whl"
register: result
- name: Display stat for tarballs and wheels.
stat:
path: "{{ item.path }}"
with_items: "{{ result.files }}"
- name: Create destination directory on executor
delegate_to: localhost
file:
path: "{{ zuul.executor.work_root }}/artifacts"
state: directory
- name: Collect tarball artifacts.
synchronize:
dest: "{{ zuul.executor.work_root }}/artifacts"
mode: pull
src: "{{ item.path }}"
verify_host: true
with_items: "{{ result.files }}"
- name: Return sdist artifacts to Zuul
loop: "{{ result.files }}"
when: "item.path.endswith('.tar.gz')"
zuul_return:
data:
zuul:
artifacts:
- name: "python_sdist"
url: "artifacts/{{ item.path | basename }}"
metadata:
type: python_sdist
- name: Return wheel artifacts to Zuul
loop: "{{ result.files }}"
when: "item.path.endswith('.whl')"
zuul_return:
data:
zuul:
artifacts:
- name: "python_wheel"
url: "artifacts/{{ item.path | basename }}"
metadata:
type: python_wheel