Fix freeze

This commit is contained in:
Sage 2026-01-21 16:41:09 +00:00
parent 8307d2dc60
commit 6e7b541d65

View file

@ -113,7 +113,7 @@ _hr_freeze() {
uv pip install keyrings.google-artifactregistry-auth==1.1.2 keyring uv pip install keyrings.google-artifactregistry-auth==1.1.2 keyring
# Install project dependencies using the subprocess keyring provider # Install project dependencies using the subprocess keyring provider
uv pip install --no-cache -e .[test] --extra-index-url "${extra_index_url}" --keyring-provider subprocess uv pip install --no-cache -e ".[test]" --extra-index-url "${extra_index_url}" --keyring-provider subprocess
# Generate requirements.txt # Generate requirements.txt
echo "--extra-index-url ${extra_index_url}" >requirements.txt echo "--extra-index-url ${extra_index_url}" >requirements.txt
@ -128,18 +128,18 @@ _hr_add_json_field() {
# Check if explicit boolean # Check if explicit boolean
if [[ "$value" == "true" || "$value" == "false" ]]; then if [[ "$value" == "true" || "$value" == "false" ]]; then
jq_opt="--argjson" jq_opt="--argjson"
# Check if number (integer or float, no leading zeros unless just 0) # Check if number (integer or float, no leading zeros unless just 0)
elif [[ "$value" =~ ^-?(0|[1-9][0-9]*)(\.[0-9]+)?$ ]]; then elif [[ "$value" =~ ^-?(0|[1-9][0-9]*)(\.[0-9]+)?$ ]]; then
jq_opt="--argjson" jq_opt="--argjson"
# Check if object or array # Check if object or array
elif [[ "$value" == "["* || "$value" == "{"* ]]; then elif [[ "$value" == "["* || "$value" == "{"* ]]; then
if echo "$value" | jq empty >/dev/null 2>&1; then if echo "$value" | jq empty >/dev/null 2>&1; then
jq_opt="--argjson" jq_opt="--argjson"
else else
# Warn to stderr, but proceed as string # Warn to stderr, but proceed as string
echo "Warning: Value for '$key' looks like JSON but is invalid. Treating as string." >&2 echo "Warning: Value for '$key' looks like JSON but is invalid. Treating as string." >&2
fi fi
fi fi
# Apply the value at the path defined by the key (dot-notation supported) # Apply the value at the path defined by the key (dot-notation supported)
@ -181,16 +181,16 @@ _hr_call() {
fi fi
local json_payload="{}" local json_payload="{}"
while [[ $# -gt 0 ]]; do while [[ $# -gt 0 ]]; do
if [[ "$1" == -* ]]; then if [[ "$1" == -* ]]; then
local key="${1#-}" local key="${1#-}"
if [[ -z "$2" || "$2" == -* ]]; then if [[ -z "$2" || "$2" == -* ]]; then
echo "Error: Missing value for option $key" echo "Error: Missing value for option $key"
return 1 return 1
fi fi
local value="$2" local value="$2"
json_payload=$(_hr_add_json_field "$json_payload" "$key" "$value") json_payload=$(_hr_add_json_field "$json_payload" "$key" "$value")
shift 2 shift 2
else else
@ -200,10 +200,10 @@ _hr_call() {
done done
local url="https://${service_name}-${project_number}.europe-west1.run.app${url_path}" local url="https://${service_name}-${project_number}.europe-west1.run.app${url_path}"
echo "Calling $url..." echo "Calling $url..."
echo "$json_payload" echo "$json_payload"
curl "$url" \ curl "$url" \
-H "Authorization: bearer $(gcloud auth print-identity-token)" \ -H "Authorization: bearer $(gcloud auth print-identity-token)" \
-H "Content-Type: application/json" \ -H "Content-Type: application/json" \
@ -225,16 +225,16 @@ _hr_cf() {
fi fi
local json_payload="{}" local json_payload="{}"
while [[ $# -gt 0 ]]; do while [[ $# -gt 0 ]]; do
if [[ "$1" == -* ]]; then if [[ "$1" == -* ]]; then
local key="${1#-}" local key="${1#-}"
if [[ -z "$2" || "$2" == -* ]]; then if [[ -z "$2" || "$2" == -* ]]; then
echo "Error: Missing value for option $key" echo "Error: Missing value for option $key"
return 1 return 1
fi fi
local value="$2" local value="$2"
json_payload=$(_hr_add_json_field "$json_payload" "$key" "$value") json_payload=$(_hr_add_json_field "$json_payload" "$key" "$value")
shift 2 shift 2
else else
@ -244,10 +244,10 @@ _hr_cf() {
done done
local url="https://europe-west1-${PROJECT_ID}.cloudfunctions.net/${function_name}" local url="https://europe-west1-${PROJECT_ID}.cloudfunctions.net/${function_name}"
echo "Calling $url..." echo "Calling $url..."
echo "$json_payload" echo "$json_payload"
curl "$url" \ curl "$url" \
-H "Authorization: bearer $(gcloud auth print-identity-token)" \ -H "Authorization: bearer $(gcloud auth print-identity-token)" \
-H "Content-Type: application/json" \ -H "Content-Type: application/json" \