Skip to content

Instantly share code, notes, and snippets.

@robertgzr
Created December 6, 2021 18:03
Show Gist options
  • Save robertgzr/ea9a8522e2b827874f56ba7bee22ca76 to your computer and use it in GitHub Desktop.
Save robertgzr/ea9a8522e2b827874f56ba7bee22ca76 to your computer and use it in GitHub Desktop.
query balena-cloud for images associated with a release
#!/bin/sh
set -e
[ -n "$DEBUG" ] && set -x
if [ "$1" = "-h" ]; then
printf "usage: %s TOKEN RELEASE_ID\n" "$0"
exit 0
fi
url=${BALENA_URL:-balena-cloud.com}
token=${1:?missing token}
releaseid=${2:?missing release id}
curl -Ls -H "Authorization: Bearer ${token}" -XGET "https://api.${url}/v6/image?%24expand=is_a_build_of__service&%24filter=is_part_of__release/release%20eq%20${releaseid}" -H "Content-Type:application/json" |
jq -r '.d[] | { image: .is_stored_at__image_location, service_name: .is_a_build_of__service[].service_name }'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment