deploy.yml: a superseded run is a skip, not a failure (server-26#167)

The remote 'exit 0' came back as ssh exit 1 on the VM, and under bash -e
the step died before the SUPERSEDED check ran (runs 1139, 1144). Capture
the ssh status, check SUPERSEDED first, then fail on a non-zero status.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Logan Cusano
2026-10-04 18:40:27 -04:00
co-authored by Claude Opus 5.5
parent 99407c1df0
commit 73d692109c
+10 -1
View File
@@ -103,6 +103,7 @@ jobs:
id: deploy id: deploy
run: | run: |
set -o pipefail set -o pipefail
SSH_RC=0
OUTPUT=$(ssh -o StrictHostKeyChecking=no \ OUTPUT=$(ssh -o StrictHostKeyChecking=no \
-o HostKeyAlgorithms=ssh-ed25519,rsa-sha2-256,rsa-sha2-512 \ -o HostKeyAlgorithms=ssh-ed25519,rsa-sha2-256,rsa-sha2-512 \
-o ConnectTimeout=15 \ -o ConnectTimeout=15 \
@@ -212,14 +213,22 @@ jobs:
# the pre-pull prune above for why this can't touch anything live. # the pre-pull prune above for why this can't touch anything live.
docker image prune -af docker image prune -af
ENDSSH ENDSSH
) ) || SSH_RC=$?
echo "$OUTPUT" echo "$OUTPUT"
# server-26#167: check SUPERSEDED before the ssh exit status. The
# remote `exit 0` still came back as ssh exit 1 on the VM (runs 1139,
# 1144 on 2026-10-04), so under `bash -e` a correct skip was reported
# as a failed deploy. A superseded run touched nothing, whatever ssh says.
SUPERSEDED=$(printf '%s\n' "$OUTPUT" | grep '^SUPERSEDED=' | tail -n1 | cut -d'=' -f2 || true) SUPERSEDED=$(printf '%s\n' "$OUTPUT" | grep '^SUPERSEDED=' | tail -n1 | cut -d'=' -f2 || true)
if [ -n "$SUPERSEDED" ]; then if [ -n "$SUPERSEDED" ]; then
echo "main has moved on to $SUPERSEDED - this run (${{ gitea.sha }}) is superseded, nothing deployed." echo "main has moved on to $SUPERSEDED - this run (${{ gitea.sha }}) is superseded, nothing deployed."
echo "superseded=true" >> "$GITHUB_OUTPUT" echo "superseded=true" >> "$GITHUB_OUTPUT"
exit 0 exit 0
fi fi
if [ "$SSH_RC" -ne 0 ]; then
echo "Deploy SSH session failed (exit $SSH_RC)."
exit "$SSH_RC"
fi
PREV_TAG=$(printf '%s\n' "$OUTPUT" | grep '^PREV_TAG=' | tail -n1 | cut -d'=' -f2) PREV_TAG=$(printf '%s\n' "$OUTPUT" | grep '^PREV_TAG=' | tail -n1 | cut -d'=' -f2)
if [ -z "$PREV_TAG" ]; then if [ -z "$PREV_TAG" ]; then
echo "Could not determine the previous tag from deploy output - rollback target unknown." echo "Could not determine the previous tag from deploy output - rollback target unknown."