ci: add ability to debug SSH sessions in CI (#47875)
Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com> Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
This commit is contained in:
parent
1bf39c1341
commit
2d855cd680
7 changed files with 214 additions and 0 deletions
21
.github/actions/ssh-debug/ssh-session.sh
vendored
Executable file
21
.github/actions/ssh-debug/ssh-session.sh
vendored
Executable file
|
@ -0,0 +1,21 @@
|
|||
#!/bin/bash
|
||||
|
||||
SSHD_PID=$1
|
||||
CLOUDFLARED_PID=$2
|
||||
SESSION_TIMEOUT=${3:-3600}
|
||||
|
||||
# Wait for timeout or until processes die.
|
||||
sleep "$SESSION_TIMEOUT" &
|
||||
SLEEP_PID=$!
|
||||
|
||||
# Monitor if SSH or cloudflared dies early.
|
||||
while kill -0 "$SSHD_PID" 2>/dev/null && kill -0 "$CLOUDFLARED_PID" 2>/dev/null && kill -0 "$SLEEP_PID" 2>/dev/null; do
|
||||
sleep 10
|
||||
done
|
||||
|
||||
# Cleanup.
|
||||
kill "$SLEEP_PID" 2>/dev/null || true
|
||||
kill "$SSHD_PID" 2>/dev/null || true
|
||||
kill "$CLOUDFLARED_PID" 2>/dev/null || true
|
||||
|
||||
echo "SSH session ended"
|
Loading…
Add table
Add a link
Reference in a new issue