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:
parent
26cadea6af
commit
77b5d76112
|
@ -1,15 +1,33 @@
|
|||
---
|
||||
- name: Query inventory for artifact information
|
||||
block:
|
||||
- name: Parse inventory response
|
||||
set_fact:
|
||||
_artifacts: "{{ 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:
|
||||
_artifacts: "{{ build.json[0].artifacts }}"
|
||||
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 }}"
|
||||
dest: "{{ download_artifact_directory }}"
|
||||
loop: "{{ build.artifacts }}"
|
||||
loop: "{{ _artifacts }}"
|
||||
loop_control:
|
||||
loop_var: artifact
|
||||
when: "'metadata' in artifact and 'type' in artifact.metadata and (artifact.metadata.type == download_artifact_type or ((download_artifact_type | type_debug) == 'list' and artifact.metadata.type in download_artifact_type))"
|
||||
|
|
Loading…
Reference in New Issue