infra: fly-shadow-run check reads fly.env as KEY=VALUE lines, never sources it
fly.env is systemd EnvironmentFile syntax; GAME_TITLE=Pokemon Red is valid there and a shell error when sourced. The v0.7.3 cutover's check died on it (exit 127) after a passing verdict. Parse it as fly-runtime does; lint refuses any infra/bin script that sources fly.env.
This commit is contained in:
parent
16cb3b754b
commit
390d118460
2 changed files with 24 additions and 5 deletions
|
|
@ -549,11 +549,20 @@ PY
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
[ -x "$BIN" ] || die "$BIN is missing"
|
[ -x "$BIN" ] || die "$BIN is missing"
|
||||||
# The live service's configuration, for its compatibility string.
|
# The live service's configuration, for its compatibility string. fly.env is systemd's
|
||||||
set -a
|
# EnvironmentFile syntax (GAME_TITLE=Pokemon Red is valid there), so it is read as KEY=VALUE
|
||||||
# shellcheck disable=SC1090,SC1091
|
# lines, as fly-runtime does, never sourced as shell.
|
||||||
. "${FLY_ENV_FILE:-/etc/fly/fly.env}"
|
local line key value env_file="${FLY_ENV_FILE:-/etc/fly/fly.env}"
|
||||||
set +a
|
if [ -f "$env_file" ]; then
|
||||||
|
while IFS= read -r line || [ -n "$line" ]; do
|
||||||
|
[[ "$line" =~ ^[A-Za-z_][A-Za-z0-9_]*= ]] || continue
|
||||||
|
key="${line%%=*}"
|
||||||
|
value="${line#*=}"
|
||||||
|
value="${value%\"}"
|
||||||
|
value="${value#\"}"
|
||||||
|
export "${key}=${value}"
|
||||||
|
done <"$env_file"
|
||||||
|
fi
|
||||||
# The release CUT-01 switches into and the binary it switches to: SERVE-01's service there.
|
# The release CUT-01 switches into and the binary it switches to: SERVE-01's service there.
|
||||||
"$BIN" check --verdict "$SHADOW_DIR/verdict.json" --current "${FLY_CURRENT_DIR:-/opt/fly/current}" \
|
"$BIN" check --verdict "$SHADOW_DIR/verdict.json" --current "${FLY_CURRENT_DIR:-/opt/fly/current}" \
|
||||||
--binary flysim-session "$@"
|
--binary flysim-session "$@"
|
||||||
|
|
|
||||||
|
|
@ -2355,6 +2355,16 @@ else
|
||||||
fail "loop recovery tests failed; run python3 -m unittest discover -s infra/tests -p test_loop_recover.py -v"
|
fail "loop recovery tests failed; run python3 -m unittest discover -s infra/tests -p test_loop_recover.py -v"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
echo "--- fly.env is read, never sourced ---"
|
||||||
|
# fly.env is systemd EnvironmentFile syntax: GAME_TITLE=Pokemon Red is valid there and a shell
|
||||||
|
# error when sourced (the v0.7.3 cutover's check died on it). Scripts parse KEY=VALUE lines.
|
||||||
|
sourced="$(grep -n -E '^[[:space:]]*(\.|source)[[:space:]]+.*(fly\.env|FLY_ENV_FILE)' "$REPO_ROOT"/infra/bin/* 2>/dev/null || true)"
|
||||||
|
if [ -z "$sourced" ]; then
|
||||||
|
pass "no infra/bin script sources fly.env"
|
||||||
|
else
|
||||||
|
fail "fly.env sourced as shell (parse KEY=VALUE lines instead): $sourced"
|
||||||
|
fi
|
||||||
|
|
||||||
echo "==="
|
echo "==="
|
||||||
if [ "$FAILED" -eq 0 ]; then
|
if [ "$FAILED" -eq 0 ]; then
|
||||||
echo "lint.sh: ALL CHECKS PASSED"
|
echo "lint.sh: ALL CHECKS PASSED"
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue