Jan Kundrát | 1e38b3d | 2019-02-26 19:37:49 +0100 | [diff] [blame] | 1 | - fail: |
| 2 | msg: "This job only works in the 'promote' pipeline." |
| 3 | when: zuul.pipeline != 'promote' |
| 4 | |
Jan Kundrát | 3f9aa4b | 2019-06-05 23:25:38 +0200 | [diff] [blame] | 5 | - name: Ensure artifacts directory exists |
| 6 | delegate_to: localhost |
| 7 | file: |
| 8 | path: "{{ zuul.executor.work_root }}/artifacts" |
| 9 | state: directory |
| 10 | |
Jan Kundrát | 1e38b3d | 2019-02-26 19:37:49 +0100 | [diff] [blame] | 11 | - name: Retrieve artifacts built within the check pipeline |
| 12 | shell: | |
| 13 | set -ex |
Jan Kundrát | 3f9aa4b | 2019-06-05 23:25:38 +0200 | [diff] [blame] | 14 | CHECKS_JSON={{ zuul.executor.work_root }}/check_jobs_for_change.json |
| 15 | curl "{{ zuul_root_url }}/api/tenant/{{ zuul.tenant }}/builds?pipeline=check&change={{ zuul.change }}&patchset={{ zuul.patchset }}" --output ${CHECKS_JSON} |
| 16 | ALL_JOBS=$(jq -r '.[].job_name' < ${CHECKS_JSON} | sort | uniq) |
Jan Kundrát | 1e38b3d | 2019-02-26 19:37:49 +0100 | [diff] [blame] | 17 | for JOB_NAME in ${ALL_JOBS}; do |
Jan Kundrát | 3f9aa4b | 2019-06-05 23:25:38 +0200 | [diff] [blame] | 18 | ARTIFACTS_URL=$(jq -r ". | map(select(.job_name == \"${JOB_NAME}\"))[0].artifacts[].url" < ${CHECKS_JSON}) |
| 19 | mkdir {{ zuul.executor.work_root }}/artifacts/${JOB_NAME} |
| 20 | pushd {{ zuul.executor.work_root }}/artifacts/${JOB_NAME} |
Jan Kundrát | 1e38b3d | 2019-02-26 19:37:49 +0100 | [diff] [blame] | 21 | for ONE_URL in ${ARTIFACTS_URL}; do |
| 22 | curl -O "${ONE_URL}" |
| 23 | done |
| 24 | popd |
| 25 | done |
Jan Kundrát | 3f9aa4b | 2019-06-05 23:25:38 +0200 | [diff] [blame] | 26 | rm -f ${CHECKS_JSON} |