Skip to content

Commit

Permalink
Merge pull request #154 from scality/improvement/COSI-57-add-detached…
Browse files Browse the repository at this point in the history
…-mode-to-ssh-runner

Add detached mode support to SSH-to-runner action
  • Loading branch information
anurag4DSB authored Nov 12, 2024
2 parents 8693054 + d177f8b commit 8c25111
Showing 1 changed file with 17 additions and 3 deletions.
20 changes: 17 additions & 3 deletions action-ssh-to-runner/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@ inputs:
tmate-server-ed25519-fingerprint:
description: Tmate server ed25510 key fingerprint
required: true
detached:
description: 'Run tmate in detached mode ("true" or "false", default: "false").'
required: false
default: "false"

runs:
using: "composite"
Expand Down Expand Up @@ -48,9 +52,10 @@ runs:
echo "TMATE_SOCK=$TMATE_SOCK" >> $GITHUB_ENV
nohup tmate -f ${{ env.TMATE_CONF }} -S ${TMATE_SOCK} -F > /dev/null &
echo "$!" > /tmp/tmate.pid
# We need to wait a bit for tmate to start.
sleep 5
tmate -f ${{ env.TMATE_CONF }} -S ${TMATE_SOCK} wait tmate-ready
if [[ "${{ inputs.detached }}" == "false" ]]; then
sleep 5
tmate -f $TMATE_CONF -S ${TMATE_SOCK} wait tmate-ready
fi
- name: "SSH to runner: Pause workflow and print connection instructions"
shell: bash
run: |
Expand All @@ -71,6 +76,15 @@ runs:
--------------------------------------------------
EOF
)
if [[ "${{ inputs.detached }}" == "true" ]]; then
echo "::notice title=SSH::Tmate started in detached mode. Connect using SSH: ${TMATE_SSH}"
echo "To connect you need:"
echo "- To be connected to the Scality VPN."
echo "- The SSH key associated with your GitHub account."
exit 0
fi
RESUME_FILE=${GITHUB_WORKSPACE}/resume
while [[ -S ${{ env.TMATE_SOCK }} ]]; do
echo "::notice title=SSH::${MESSAGE}"
Expand Down

0 comments on commit 8c25111

Please sign in to comment.