fix build issue
Build & Push / Pipeline Tests (push) Successful in 1m47s
Test / Type Check (all packages) (push) Successful in 55s
Build & Push / Build & Push Docker Image (push) Failing after 34s
Test / API Unit Tests (push) Successful in 1m9s
Test / Homepage Unit Tests (push) Successful in 49s
Test / Carplace Unit Tests (push) Successful in 45s
Test / Admin Unit Tests (push) Successful in 44s
Test / Dashboard Unit Tests (push) Successful in 44s
Test / API Integration Tests (push) Successful in 1m10s

This commit is contained in:
root
2026-07-29 16:25:03 -04:00
parent 7bc1dd338a
commit 300c9dc694
3 changed files with 130 additions and 89 deletions
+11 -89
View File
@@ -447,101 +447,18 @@ jobs:
ENV_DOCKER_PRODUCTION_RAW_B64="$(printf '%s' "$ENV_DOCKER_PRODUCTION" | base64 | tr -d '\n')"
STRIPE_API_KEY_B64="$(printf '%s' "$STRIPE_API_KEY" | base64 | tr -d '\n')"
STRIPE_WEBHOOK_SECRET_B64="$(printf '%s' "$STRIPE_WEBHOOK_SECRET" | base64 | tr -d '\n')"
validate_stripe_secret_inputs() {
local env_file stripe_api_key stripe_webhook_secret
env_file="$(mktemp)"
trap 'rm -f "$env_file"' EXIT
if [ -n "$ENV_DOCKER_PRODUCTION_B64_CLEAN" ]; then
if ! printf '%s' "$ENV_DOCKER_PRODUCTION_B64_CLEAN" | base64 -d > "$env_file"; then
echo "::error::ENV_DOCKER_PRODUCTION_B64 is not valid base64"
exit 1
fi
elif [ -n "$ENV_DOCKER_PRODUCTION" ]; then
printf '%s' "$ENV_DOCKER_PRODUCTION" > "$env_file"
else
: > "$env_file"
fi
read_env_key() {
local key="$1"
awk -F= -v key="$key" '
/^[[:space:]]*#/ || index($0, "=") == 0 {
next
}
{
name = $1
sub(/^[[:space:]]*export[[:space:]]+/, "", name)
gsub(/^[[:space:]]+|[[:space:]]+$/, "", name)
if (name == key) {
value = substr($0, index($0, "=") + 1)
}
}
END {
print value
}
' "$env_file"
}
normalize_secret() {
local value="$1"
value="${value%$'\r'}"
value="${value#"${value%%[![:space:]]*}"}"
value="${value%"${value##*[![:space:]]}"}"
if [[ "$value" == \"*\" && "$value" == *\" ]]; then
value="${value#\"}"
value="${value%\"}"
elif [[ "$value" == \'*\' && "$value" == *\' ]]; then
value="${value#\'}"
value="${value%\'}"
fi
printf '%s' "$value"
}
stripe_api_key="$(normalize_secret "${STRIPE_API_KEY:-$(read_env_key STRIPE_API_KEY)}")"
stripe_webhook_secret="$(normalize_secret "${STRIPE_WEBHOOK_SECRET:-$(read_env_key STRIPE_WEBHOOK_SECRET)}")"
case "$stripe_api_key" in
sk_live_*|rk_live_*) ;;
"")
echo "::error::STRIPE_API_KEY is missing. Add a live sk_live_ or restricted rk_live_ key to the STRIPE_API_KEY secret, ENV_DOCKER_PRODUCTION, or ENV_DOCKER_PRODUCTION_B64."
exit 1
;;
placeholder|replace-with-*|*changeme*|*change-me*)
echo "::error::STRIPE_API_KEY is still a placeholder. Replace it with a live sk_live_ or restricted rk_live_ key in Gitea Actions secrets."
exit 1
;;
*)
echo "::error::STRIPE_API_KEY must start with sk_live_ or rk_live_ for production billing."
exit 1
;;
esac
case "$stripe_webhook_secret" in
whsec_*) ;;
"")
echo "::error::STRIPE_WEBHOOK_SECRET is missing. Add the Stripe webhook signing secret to the STRIPE_WEBHOOK_SECRET secret, ENV_DOCKER_PRODUCTION, or ENV_DOCKER_PRODUCTION_B64."
exit 1
;;
placeholder|replace-with-*|*changeme*|*change-me*)
echo "::error::STRIPE_WEBHOOK_SECRET is still a placeholder. Replace it with the Stripe webhook signing secret in Gitea Actions secrets."
exit 1
;;
*)
echo "::error::STRIPE_WEBHOOK_SECRET must start with whsec_."
exit 1
;;
esac
}
validate_stripe_secret_inputs
REGISTRY_USERNAME="${REGISTRY_USERNAME:-${REGISTRY_USER:-}}"
REGISTRY_PASSWORD="${REGISTRY_PASSWORD:-${REGISTRY_TOKEN:-}}"
REGISTRY_PASSWORD_B64="$(printf '%s' "$REGISTRY_PASSWORD" | base64 | tr -d '\n')"
ssh $SSH_OPTIONS "${{ secrets.VPS_USER }}@$VPS_HOST" "
set -e
mkdir -p '$DEPLOY_ROOT' '$REMOTE_BUILD_DIR'
previous_env_file=''
if [ -f '$DEPLOY_ROOT/.env.docker.production' ]; then
previous_env_file=\"\$(mktemp)\"
cp '$DEPLOY_ROOT/.env.docker.production' \"\$previous_env_file\"
trap 'rm -f \"\$previous_env_file\"' EXIT
fi
if [ -n '$ENV_DOCKER_PRODUCTION_B64_CLEAN' ]; then
printf '%s' '$ENV_DOCKER_PRODUCTION_B64_CLEAN' | base64 -d > '$DEPLOY_ROOT/.env.docker.production'
chmod 600 '$DEPLOY_ROOT/.env.docker.production'
@@ -557,9 +474,14 @@ jobs:
cp '$DEPLOY_ROOT/.env.docker.production' '$REMOTE_BUILD_DIR/.env.docker.production'
chmod 600 '$REMOTE_BUILD_DIR/.env.docker.production'
cd '$REMOTE_BUILD_DIR'
if [ -n \"\$previous_env_file\" ]; then
bash scripts/preserve-env-values.sh \"\$previous_env_file\" .env.docker.production STRIPE_API_KEY STRIPE_WEBHOOK_SECRET
fi
export STRIPE_API_KEY_B64='$STRIPE_API_KEY_B64'
export STRIPE_WEBHOOK_SECRET_B64='$STRIPE_WEBHOOK_SECRET_B64'
bash scripts/apply-env-secret-overrides.sh .env.docker.production STRIPE_API_KEY STRIPE_WEBHOOK_SECRET
cp .env.docker.production '$DEPLOY_ROOT/.env.docker.production'
chmod 600 '$DEPLOY_ROOT/.env.docker.production'
export APP_IMAGE='$DEPLOY_REGISTRY_HOST/$IMAGE_REPOSITORY'
export IMAGE_TAG='$IMAGE_TAG'
export REGISTRY_HOST='$DEPLOY_REGISTRY_HOST'