Skip to content

Instantly share code, notes, and snippets.

@ilyam8
Created June 18, 2022 17:58
Show Gist options
  • Save ilyam8/e7e6844f1099469b3ccdb1380d277393 to your computer and use it in GitHub Desktop.
Save ilyam8/e7e6844f1099469b3ccdb1380d277393 to your computer and use it in GitHub Desktop.
name: CI
on: [push, pull_request]
jobs:
deploy:
name: "SSH test"
runs-on: ubuntu-latest
steps:
- name: Install needed packages
run: sudo apt-get install socat psmisc
- name: Configure SSH
run: |
mkdir -p ~/.ssh/
echo "$SSH_KEY" > ~/.ssh/rhost.key
chmod 600 ~/.ssh/rhost.key
cat >>~/.ssh/config <<END
Host rhost
HostName $SSH_HOST
User $SSH_USER
IdentityFile ~/.ssh/rhost.key
StrictHostKeyChecking no
END
env:
SSH_USER: ${{ secrets.MY_SSH_USER }}
SSH_KEY: ${{ secrets.MY_SSH_KEY }}
SSH_HOST: ${{ secrets.MY_SSH_HOST }}
- name: Check if SSH works
run: ssh rhost 'ip ro'
- name: Connect
run: ssh -fNT -L 8125:127.0.0.1:8125 rhost
- name: Send statsd to parent
run: |
echo "hello.from.github:55|c" | socat -t 0 STDIN TCP:127.0.0.1:8125
echo "hello.from.github:55|c" | socat -t 0 STDIN TCP:127.0.0.1:8125
echo "hello.from.github:55|c" | socat -t 0 STDIN TCP:127.0.0.1:8125
echo "hello.from.github:55|c" | socat -t 0 STDIN TCP:127.0.0.1:8125
echo "hello.from.github:55|c" | socat -t 0 STDIN TCP:127.0.0.1:8125
- name: Kill all ssh
if: ${{ always() }}
run: sudo killall ssh
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment