Commit 67dddfbf authored by Sven-Hendrik Haase's avatar Sven-Hendrik Haase
Browse files

Merge branch 'fix/apiPagination' into 'master'

Always retrieve the latest package from the API, add error handling

See merge request archlinux/archlinux-docker!50
parents 73504a73 c1cc41db
......@@ -4,6 +4,18 @@ set -eu
package_id=$(curl -sSf --header "PRIVATE-TOKEN: ${GITLAB_PROJECT_TOKEN}" "${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages" | jq ".[] | select(.version == \"${BUILD_VERSION}\") | .id")
package_id=$(curl -sSf --header "PRIVATE-TOKEN: ${GITLAB_PROJECT_TOKEN}" "${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages?sort=desc&per_page=1" | jq ".[] | select(.version == \"${BUILD_VERSION}\") | .id")
if [[ -z "${package_id}" ]]; then
>&2 echo "Error: No package id found"
exit 1
package_file_id=$(curl -sSf --header "PRIVATE-TOKEN: ${GITLAB_PROJECT_TOKEN}" "${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/${package_id}/package_files" | jq ".[] | select(.file_name == \"$package_name\") | .id")
if [[ -z "${package_file_id}" ]]; then
>&2 echo "Error: No package file id found"
exit 1
echo "${package_file_id}/download"
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment