Fix some issues with local dev
This commit is contained in:
@@ -27,6 +27,8 @@ export SPOON_AGENT_WORKER_URL="${SPOON_AGENT_WORKER_URL:-http://localhost:${SPOO
|
||||
export SPOON_AGENT_WORKER_INTERNAL_TOKEN="${SPOON_AGENT_WORKER_INTERNAL_TOKEN:-${SPOON_WORKER_TOKEN:-}}"
|
||||
export SPOON_AGENT_WORKDIR="${SPOON_AGENT_LOCAL_WORKDIR:-.local/agent-work/${WITH_ENV_ENVIRONMENT:-dev}}"
|
||||
export SPOON_AGENT_JOB_IMAGE="${SPOON_AGENT_LOCAL_JOB_IMAGE:-spoon-agent-job:latest}"
|
||||
# Self-terminate if the dev runner dies, so the worker never orphans on port 3921.
|
||||
export SPOON_AGENT_DEV_WATCHDOG="${SPOON_AGENT_DEV_WATCHDOG:-1}"
|
||||
|
||||
if [[ "$SPOON_AGENT_CONTAINER_ACCESS" == "host_port" && -z "${SPOON_AGENT_KEEP_NETWORK:-}" ]]; then
|
||||
unset SPOON_AGENT_NETWORK
|
||||
|
||||
+19
-4
@@ -24,10 +24,25 @@ fi
|
||||
command -v infisical >/dev/null 2>&1 || { echo "export-env: Infisical CLI is required." >&2; exit 1; }
|
||||
"$ROOT_DIR/scripts/infisical-account" ensure
|
||||
|
||||
(cd "$ROOT_DIR" && infisical export --env="$INFISICAL_ENV" --format=dotenv --silent) || {
|
||||
echo "export-env: failed to export '$INFISICAL_ENV'; check login and project access." >&2
|
||||
exit 1
|
||||
}
|
||||
# Retry transient Infisical failures (e.g. 500s when several dev tasks fetch
|
||||
# concurrently at startup) so one flaky response doesn't kill the dev server.
|
||||
attempt=0
|
||||
while :; do
|
||||
attempt=$((attempt + 1))
|
||||
if EXPORT_OUT=$(cd "$ROOT_DIR" && infisical export --env="$INFISICAL_ENV" --format=dotenv --silent 2>"/tmp/export-env.$$.err"); then
|
||||
printf '%s\n' "$EXPORT_OUT"
|
||||
break
|
||||
fi
|
||||
if [ "$attempt" -ge 5 ]; then
|
||||
cat "/tmp/export-env.$$.err" >&2 2>/dev/null || true
|
||||
rm -f "/tmp/export-env.$$.err"
|
||||
echo "export-env: failed to export '$INFISICAL_ENV' after $attempt attempts; check login and project access." >&2
|
||||
exit 1
|
||||
fi
|
||||
echo "export-env: Infisical export failed (attempt $attempt/5), retrying in 2s..." >&2
|
||||
sleep 2
|
||||
done
|
||||
rm -f "/tmp/export-env.$$.err"
|
||||
|
||||
if [ -f "$STATE_FILE" ]; then
|
||||
printf '\n'
|
||||
|
||||
Reference in New Issue
Block a user