Skip to content

Instantly share code, notes, and snippets.

@JonathonReinhart
Last active October 3, 2021 03:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save JonathonReinhart/8593a00334da285e88b50724ac41ccf0 to your computer and use it in GitHub Desktop.
Save JonathonReinhart/8593a00334da285e88b50724ac41ccf0 to your computer and use it in GitHub Desktop.
Remotely debugging Travis CI

This is a method of using ngrok to live-debug a Travis CI build.

(This is from some terse notes I took while working on staticx and hasn't been re-verified.)

Add to .travis.yml:

env:
  NGROK_TOKEN=...

addons:
  apt:
    packages:
      - ssh 

after_script:
  - ./run_ngrok.sh

Here's run_ngrok.sh:

#!/bin/bash

curl -o ngrok.zip https://bin.equinox.io/c/4VmDzA7iaHb/ngrok-stable-linux-amd64.zip || exit $?
unzip ngrok.zip || exit $?
chmod +x ngrok

echo "ssh-rsa $YOUR_SSH_PUBLIC_KEY_GOES_HERE" > ~/.ssh/authorized_keys
chmod 600 ~/.ssh/authorized_keys
echo "Starting sshd..."
sudo systemctl start sshd || exit $?

echo "Starting ngrok..."
./ngrok tcp 22 --authtoken=$NGROK_TOKEN --log=stdout --log-level=debug
echo "ngrok exited $?" 

Then:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment