Allow download-artifact to download multiple files
In order to support downloading artifacts from a python build job, which mayb produce multiple sdist tarballs and wheels, allow this role to download as many files as match the input parameters. Change-Id: I59de60127b1e8499ae3e48f2a1bc56c7a36b7425
This commit is contained in:
parent
2f2d6ce3f7
commit
6523b6a530
@ -1,7 +1,8 @@
|
||||
Download an artifact from a completed build of a Zuul job
|
||||
Download artifacts from a completed build of a Zuul job
|
||||
|
||||
Given a change downloads an artifact from a previous build (by default
|
||||
of the current change) into the work directory.
|
||||
Given a change, downloads artifacts from a previous build (by default
|
||||
of the current change) into the work directory. This will download as
|
||||
many artifacts as match the selection criteria.
|
||||
|
||||
**Role Variables**
|
||||
|
||||
@ -19,10 +20,14 @@ of the current change) into the work directory.
|
||||
|
||||
.. zuul:rolevar:: download_artifact_name
|
||||
|
||||
The artifact name.
|
||||
The artifact name. This can be a string or a list of strings.
|
||||
|
||||
.. zuul:rolevar:: download_artifact_query
|
||||
:default: change={{ zuul.change }}&patchset={{ zuul.patchset }}&pipeline={{ download_artifact_pipeline }}&job_name={{ download_artifact_job }}
|
||||
|
||||
The query to use to find the build. This should return exactly one
|
||||
result. Normally the default is used.
|
||||
The query to use to find the build. Normally the default is used.
|
||||
|
||||
.. zuul:rolevar:: download_artifact_directory
|
||||
:default: {{ zuul.executor.work_root }}
|
||||
|
||||
The directory in which to place the downloaded artifacts.
|
||||
|
@ -1,2 +1,3 @@
|
||||
---
|
||||
download_artifact_query: "change={{ zuul.change }}&patchset={{ zuul.patchset }}&pipeline={{ download_artifact_pipeline }}&job_name={{ download_artifact_job }}"
|
||||
download_artifact_directory: "{{ zuul.executor.work_root }}"
|
||||
|
8
roles/download-artifact/tasks/inner.yaml
Normal file
8
roles/download-artifact/tasks/inner.yaml
Normal file
@ -0,0 +1,8 @@
|
||||
- name: Download archive
|
||||
uri:
|
||||
url: "{{ artifact.url }}"
|
||||
dest: "{{ download_artifact_directory }}"
|
||||
loop: "{{ (build.artifacts }}"
|
||||
loop_control:
|
||||
loop_var: artifact
|
||||
when: "artifact.name == download_artifact_name or ((download_artifact_name | type_debug) == 'list' and artifact.name in download_artifact_name)"
|
@ -5,7 +5,8 @@
|
||||
- name: Extract artifact URL
|
||||
set_fact:
|
||||
archive_url: "{{ (build.json[0].artifacts | selectattr('name', 'equalto', download_artifact_name) | list)[0].url }}"
|
||||
- name: Download archive
|
||||
uri:
|
||||
url: "{{ archive_url }}"
|
||||
dest: "{{ zuul.executor.work_root }}"
|
||||
- name: Process build
|
||||
loop: "{{ build.json }}"
|
||||
loop_control:
|
||||
loop_var: build
|
||||
include_tasks: inner.yaml
|
||||
|
Loading…
Reference in New Issue
Block a user