fix(ci): extract host and port from NAS_HOST secret

NAS_HOST can be either 'host' or 'host:port'. The previous workflow
passed the whole value as the SSH target, which fails with
'Could not resolve hostname 192.168.1.21:222' when the port is included.

Parse the secret into NAS_SSH_HOST and NAS_SSH_PORT and pass them
explicitly to ssh.
This commit is contained in:
2026-07-10 12:39:52 +00:00
parent 6ff7bc5fda
commit 94477d46ef
+8 -4
View File
@@ -82,8 +82,12 @@ jobs:
chmod 600 ~/.ssh/id_ed25519
echo "--- Pre-flight: ensure NAS is reachable ---"
ssh -o StrictHostKeyChecking=no -o ConnectTimeout=5 \
"$NAS_USER@$NAS_HOST" 'hostname && docker version --format "{{.Server.Version}}"' \
# NAS_HOST can be either "host" or "host:port"
NAS_SSH_PORT=$(echo "$NAS_HOST" | grep -q ':' && echo "${NAS_HOST##*:}" || echo "22")
NAS_SSH_HOST="${NAS_HOST%%:*}"
echo "Using NAS_SSH_HOST=$NAS_SSH_HOST NAS_SSH_PORT=$NAS_SSH_PORT"
ssh -o StrictHostKeyChecking=no -o ConnectTimeout=5 -p "$NAS_SSH_PORT" \
"$NAS_USER@$NAS_SSH_HOST" 'hostname && docker version --format "{{.Server.Version}}"' \
| head
echo "--- Reading docker-compose.prod.yml from the repo ---"
@@ -97,8 +101,8 @@ jobs:
# the compose file over SSH and let docker compose recreate the
# project. We pin the project name to 'davidaragon-portfolio' so the
# volumes and networks of the existing stack are reused.
cat "$COMPOSE_FILE" | ssh -o StrictHostKeyChecking=no \
"$NAS_USER@$NAS_HOST" \
cat "$COMPOSE_FILE" | ssh -o StrictHostKeyChecking=no -p "$NAS_SSH_PORT" \
"$NAS_USER@$NAS_SSH_HOST" \
"export PATH=/share/CACHEDEV1_DATA/.qpkg/container-station/usr/bin:\$PATH; cd /tmp && docker compose -p '$STACK_NAME' -f - up -d"
echo "--- Stack '$STACK_NAME' redeployed. Smoke-test: ---"