Update download-artifact to use zuul.artifacts

Also support the ability for child_jobs to fetch artifacts.

Change-Id: I0e2d43873410a095771503da712e67db5b64f25f
Signed-off-by: Paul Belanger <pabelanger@redhat.com>
This commit is contained in:
Paul Belanger 2019-11-25 22:21:29 -05:00
parent 26cadea6af
commit 272cfbee78
1 changed files with 24 additions and 6 deletions

View File

@ -1,10 +1,28 @@
---
- name: Query inventory for artifact information
block:
- name: Parse inventory response
set_fact:
build: "{{ zuul.artifacts }}"
when: zuul.artifacts is defined
- name: Query Zuul API for artifact information
uri:
url: "{{ download_artifact_api }}/builds?{{ download_artifact_query }}"
register: build
- name: Parse build response
set_fact:
build: "{{ build.json[0] }}"
block:
- name: Fetch info from Zuul API
uri:
url: "{{ download_artifact_api }}/builds?{{ download_artifact_query }}"
register: build
- name: Parse build response
set_fact:
build: "{{ build.json[0] }}"
when: download_artifact_api is defined
- name: Ensure artifacts directory exists
file:
path: "{{ download_artifact_directory }}"
state: directory
- name: Download archive by type
uri:
url: "{{ artifact.url }}"