Skip to content

Commit b7eceb4

Browse files
committed
fix(ci): target Testbox VM SSH sockets
1 parent a133f63 commit b7eceb4

2 files changed

Lines changed: 11 additions & 6 deletions

File tree

‎.github/workflows/ci-check-testbox.yml‎

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -195,14 +195,16 @@ jobs:
195195
run: |
196196
set -euo pipefail
197197
198-
runner_ssh_port="$(cat /tmp/.testbox/runner_ssh_port 2>/dev/null || true)"
199-
if [[ ! "$runner_ssh_port" =~ ^[0-9]+$ ]] ||
200-
(( runner_ssh_port < 1 || runner_ssh_port > 65535 )); then
201-
echo "No valid Testbox SSH port found; skipping session cleanup"
198+
# Testbox state stores Blacksmith's external forwarded port. Resolve
199+
# sshd's VM-local listener because that is the sport visible to ss.
200+
runner_ssh_local_port="$(sudo sshd -T 2>/dev/null | awk '$1 == "port" { print $2; exit }')"
201+
if [[ ! "$runner_ssh_local_port" =~ ^[0-9]+$ ]] ||
202+
(( runner_ssh_local_port < 1 || runner_ssh_local_port > 65535 )); then
203+
echo "No valid local SSH listener port found; skipping session cleanup"
202204
exit 0
203205
fi
204206
205207
# run-testbox has no post hook. Close only Testbox client sockets so
206208
# Blacksmith's runner teardown does not wait for its 290-second grace.
207209
timeout --signal=KILL 5s sudo ss -K state established \
208-
"( sport = :${runner_ssh_port} )" || true
210+
"( sport = :${runner_ssh_local_port} )" || true

‎test/scripts/package-acceptance-workflow.test.ts‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2417,7 +2417,10 @@ describe("package artifact reuse", () => {
24172417
expect(runTestboxStep.if).toBe("github.event_name == 'workflow_dispatch' && always()");
24182418
expect(closeTestboxSshStep.if).toBe("github.event_name == 'workflow_dispatch' && always()");
24192419
expect(closeTestboxSshStep.run).toContain(
2420-
'ss -K state established \\\n "( sport = :${runner_ssh_port} )"',
2420+
`sudo sshd -T 2>/dev/null | awk '$1 == "port" { print $2; exit }'`,
2421+
);
2422+
expect(closeTestboxSshStep.run).toContain(
2423+
'ss -K state established \\\n "( sport = :${runner_ssh_local_port} )"',
24212424
);
24222425
expect(checkTestboxSteps.indexOf(closeTestboxSshStep)).toBe(
24232426
checkTestboxSteps.indexOf(runTestboxStep) + 1,

0 commit comments

Comments
 (0)