Skip to content

Commit

Permalink
Only fetch artifacts from matching branch (#53)
Browse files Browse the repository at this point in the history
* Filter bucket by prefix

* use artifacts_branch as prefix

* Add assertion to validate artifacts found

* Only check assertion if download_artifacts == true

* Remove space
  • Loading branch information
velomatt authored Aug 29, 2023
1 parent 18b8ea9 commit 7aeac41
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion roles/download_artifacts/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

- name: Fetch contents of dss-artifacts bucket
ansible.builtin.uri:
url: " {{ artifacts_url }}"
url: "{{ artifacts_url }}?prefix={{ artifacts_branch }}"
method: GET
return_content: true
validate_certs: "{{ artifacts_validate_certs }}"
Expand All @@ -18,6 +18,17 @@
run_once: true
when: download_artifacts | bool

- name: Check artifacts found
ansible.builtin.assert:
that: dss_artifacts_list | length > 0
fail_msg: |
No artifacts found. Check vars:
artifacts_url: {{ artifacts_url }}
artifacts_branch: {{ artifacts_branch }}
quiet: true
run_once: true
when: download_artifacts | bool

- name: Download artifacts from dss-artifacts bucket
ansible.builtin.get_url:
url: "{{ artifacts_url }}/{{ item }}"
Expand Down

0 comments on commit 7aeac41

Please sign in to comment.