Download-artifact: use the artifact type rather than name
So that the artifact "name" may be used for human consumption, switch the download-artifact role to use the metadata.type attribute of the artifact. This deprecates the download_artifact_name role variable and adds _type as a replacement. Change-Id: I1c4a4be7d1599b233b56fe73117ff097b8ad381a
This commit is contained in:
parent
02d9a29562
commit
87b391c84a
@ -20,8 +20,16 @@ many artifacts as match the selection criteria.
|
||||
|
||||
.. zuul:rolevar:: download_artifact_name
|
||||
|
||||
.. warning:: This field is deprecated and will be removed. Use
|
||||
``download_artifact_type`` instead.
|
||||
|
||||
The artifact name. This can be a string or a list of strings.
|
||||
|
||||
.. zuul:rolevar:: download_artifact_type
|
||||
|
||||
The artifact type. This is the value of the ``type`` field in the
|
||||
artifact metadata. 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 }}
|
||||
|
||||
|
@ -5,11 +5,23 @@
|
||||
- name: Parse build response
|
||||
set_fact:
|
||||
build: "{{ build.json[0] }}"
|
||||
- name: Download archive
|
||||
- name: Download archive by name
|
||||
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)"
|
||||
when:
|
||||
- "download_artifact_name is defined"
|
||||
- "artifact.name == download_artifact_name or ((download_artifact_name | type_debug) == 'list' and artifact.name in download_artifact_name))"
|
||||
- name: Download archive by type
|
||||
uri:
|
||||
url: "{{ artifact.url }}"
|
||||
dest: "{{ download_artifact_directory }}"
|
||||
loop: "{{ build.artifacts }}"
|
||||
loop_control:
|
||||
loop_var: artifact
|
||||
when:
|
||||
- "download_artifact_type is defined"
|
||||
- "'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
Block a user