mirror of
https://github.com/TrezOne/docker-mods-uptime-kuma-timeout-fix.git
synced 2026-07-19 09:53:02 -04:00
Replace echoes into jq with here strings
This commit is contained in:
+12
-12
@@ -213,27 +213,27 @@ get_blob_sha() {
|
|||||||
--header "Authorization: Bearer ${1}" \
|
--header "Authorization: Bearer ${1}" \
|
||||||
--user-agent "${MOD_UA}" \
|
--user-agent "${MOD_UA}" \
|
||||||
"${2}/${3}")
|
"${2}/${3}")
|
||||||
if echo "${MULTIDIGEST}" | jq -e '.layers // empty' >/dev/null 2>&1; then
|
if jq -e '.layers // empty' <<< "${MULTIDIGEST}" >/dev/null 2>&1; then
|
||||||
# If there's a layer element it's a single-arch manifest so just get that digest
|
# If there's a layer element it's a single-arch manifest so just get that digest
|
||||||
echo "${MULTIDIGEST}" | jq -r '.layers[0].digest';
|
jq -r '.layers[0].digest' <<< "${MULTIDIGEST}";
|
||||||
else
|
else
|
||||||
# Otherwise it's multi-arch or has an attestation manifest
|
# Otherwise it's multi-arch or has a manifest annotations
|
||||||
if echo "${MULTIDIGEST}" | jq -e '.manifests[]?.annotations // empty' >/dev/null 2>&1; then
|
if jq -e '.manifests[]?.annotations // empty' <<< "${MULTIDIGEST}" >/dev/null 2>&1; then
|
||||||
# Check for attestation manifest and delete if found
|
# Check for manifest annotations and delete if found
|
||||||
write_mod_debug "Mod has an attestation-manifest" >&2
|
write_mod_debug "Mod has one or more manifest annotations" >&2
|
||||||
MULTIDIGEST=$(echo "${MULTIDIGEST}" | jq 'del(.manifests[] | select(.annotations))')
|
MULTIDIGEST=$(jq 'del(.manifests[] | select(.annotations))' <<< "${MULTIDIGEST}")
|
||||||
fi
|
fi
|
||||||
if [[ $(echo "${MULTIDIGEST}" | jq '.manifests | length') -gt 1 ]]; then
|
if [[ $(jq '.manifests | length' <<< "${MULTIDIGEST}") -gt 1 ]]; then
|
||||||
# If there's still more than one manifest, it's multi-arch
|
# If there's still more than one digest, it's multi-arch
|
||||||
write_mod_debug "Mod has a multi-arch manifest" >&2
|
write_mod_debug "Mod has a multi-arch manifest" >&2
|
||||||
MULTIDIGEST=$(echo "${MULTIDIGEST}" | jq -r ".manifests[] | select(.platform.architecture == \"${4}\").digest?")
|
MULTIDIGEST=$(jq -r ".manifests[] | select(.platform.architecture == \"${4}\").digest?" <<< "${MULTIDIGEST}")
|
||||||
if [[ -z "${MULTIDIGEST}" ]]; then
|
if [[ -z "${MULTIDIGEST}" ]]; then
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
# Otherwise it's single arch
|
# Otherwise it's single arch
|
||||||
write_mod_debug "Mod only has a single arch manifest" >&2
|
write_mod_debug "Mod only has a single arch manifest" >&2
|
||||||
MULTIDIGEST=$(echo "${MULTIDIGEST}" | jq -r ".manifests[].digest?")
|
MULTIDIGEST=$(jq -r ".manifests[].digest?" <<< "${MULTIDIGEST}")
|
||||||
fi
|
fi
|
||||||
if DIGEST=$(curl -f --retry 10 --retry-max-time 60 --retry-connrefused \
|
if DIGEST=$(curl -f --retry 10 --retry-max-time 60 --retry-connrefused \
|
||||||
${CURL_NOISE_LEVEL} \
|
${CURL_NOISE_LEVEL} \
|
||||||
@@ -243,7 +243,7 @@ get_blob_sha() {
|
|||||||
--header "Authorization: Bearer ${1}" \
|
--header "Authorization: Bearer ${1}" \
|
||||||
--user-agent "${MOD_UA}" \
|
--user-agent "${MOD_UA}" \
|
||||||
"${2}/${MULTIDIGEST}"); then
|
"${2}/${MULTIDIGEST}"); then
|
||||||
echo "${DIGEST}" | jq -r '.layers[0].digest';
|
jq -r '.layers[0].digest' <<< "${DIGEST}";
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user