render-secrets.sh: fix SC2015 in the mirror-write guard
All checks were successful
PR build (required check) / changes (pull_request) Successful in 21s
secrets-guard / encrypted (pull_request) Successful in 26s
shell-lint / shellcheck (pull_request) Successful in 23s
PR build (required check) / validate-observability (pull_request) Successful in 48s
PR build (required check) / build-frontend (pull_request) Successful in 2m14s
PR build (required check) / build-backend (pull_request) Successful in 2m46s
PR build (required check) / gate (pull_request) Successful in 2s

A && B || C isn't if-then-else -- C can run when A is true but B
fails too. Use an explicit if/else so an mkdir success + install
failure is still caught.
This commit is contained in:
Emi Griffith 2026-07-25 00:12:07 -07:00
parent 73cd6b7aae
commit 40d3b5f5dc

View file

@ -137,9 +137,11 @@ render_thermograph_secrets() {
# prod/beta (apt-installed Docker, no snap confinement) leave it unset and
# this is a no-op for them.
if [ "$rc" = 0 ] && [ -n "${THERMOGRAPH_SECRETS_ENV_FILE_MIRROR:-}" ]; then
mkdir -p "$(dirname "$THERMOGRAPH_SECRETS_ENV_FILE_MIRROR")" \
&& install -m 0600 "$tmp" "$THERMOGRAPH_SECRETS_ENV_FILE_MIRROR" \
|| { echo "!! cannot write mirror at $THERMOGRAPH_SECRETS_ENV_FILE_MIRROR" >&2; rc=1; }
if ! mkdir -p "$(dirname "$THERMOGRAPH_SECRETS_ENV_FILE_MIRROR")" \
|| ! install -m 0600 "$tmp" "$THERMOGRAPH_SECRETS_ENV_FILE_MIRROR"; then
echo "!! cannot write mirror at $THERMOGRAPH_SECRETS_ENV_FILE_MIRROR" >&2
rc=1
fi
fi
rm -f "$tmp"