| - fail: |
| msg: "This job only works in the 'promote' pipeline." |
| when: zuul.pipeline != 'promote' |
| |
| - name: Ensure artifacts directory exists |
| delegate_to: localhost |
| file: |
| path: "{{ zuul.executor.work_root }}/artifacts" |
| state: directory |
| |
| - name: Retrieve artifacts built within the check pipeline |
| shell: | |
| set -ex |
| CHECKS_JSON={{ zuul.executor.work_root }}/check_jobs_for_change.json |
| curl "{{ zuul_root_url }}/api/tenant/{{ zuul.tenant }}/builds?pipeline=check&change={{ zuul.change }}&patchset={{ zuul.patchset }}" --output ${CHECKS_JSON} |
| ALL_JOBS=$(jq -r '.[].job_name' < ${CHECKS_JSON} | sort | uniq) |
| for JOB_NAME in ${ALL_JOBS}; do |
| ARTIFACTS_URL=$(jq -r ". | map(select(.job_name == \"${JOB_NAME}\"))[0].artifacts[].url" < ${CHECKS_JSON}) |
| mkdir {{ zuul.executor.work_root }}/artifacts/${JOB_NAME} |
| pushd {{ zuul.executor.work_root }}/artifacts/${JOB_NAME} |
| for ONE_URL in ${ARTIFACTS_URL}; do |
| curl -O "${ONE_URL}" |
| done |
| popd |
| done |
| rm -f ${CHECKS_JSON} |