Skip to content
Snippets Groups Projects
Commit f4f9a4f8 authored by Kristian Klausen's avatar Kristian Klausen :tada:
Browse files

arch_boxes_sync: Handle delay between release and artifacts being ready gracefully

The releases are released/tagged and then built, so there is a delay
between releasing a release and the artifcats being ready, we should
handle that gracefully.
parent 7c2f70f4
No related branches found
No related tags found
1 merge request!330arch_boxes_sync: Handle delay between release and artifacts being ready gracefully
......@@ -19,7 +19,13 @@ readonly TMPDIR="$(mktemp --directory --tmpdir="/var/tmp")"
trap "rm -rf \"${TMPDIR}\"" EXIT
cd "${TMPDIR}"
curl --silent --show-error --fail --output "output.zip" "https://gitlab.archlinux.org/api/v4/projects/${PROJECT_ID}/jobs/artifacts/${LATEST_RELEASE_TAG}/download?job=${JOB_NAME}"
readonly HTTP_CODE="$(curl --silent --show-error --fail --output "output.zip" --write-out "%{http_code}" "https://gitlab.archlinux.org/api/v4/projects/${PROJECT_ID}/jobs/artifacts/${LATEST_RELEASE_TAG}/download?job=${JOB_NAME}")"
# The releases are released/tagged and then built, so the artifacts aren't necessarily ready (yet).
if (( HTTP_CODE == 404 )); then
echo "Skipping release: ${LATEST_RELEASE_TAG}, artifacts not ready (404)"
exit
fi
mkdir "${LATEST_RELEASE_TAG}"
unzip output.zip
# People should download the vagrant images from Vagrant Cloud
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment