Debugging flaky specs in a Github Action (Flaky Specs, Part 4)
Run your spec directly in CI / Github Action
If you are unable to reproduce the error locally - try running your spec directly in CI. Github Actions and CI in general aren’t designed to allow you to SSH into them, but you can still do that with a couple of changes:
Upterm Github Action
The Upterm Github Action does both of these things for you:
- name: Setup upterm session
uses: lhotari/action-upterm@v1
if: failure()
with:
wait-timeout-minutes: 30
If your specs fail, this sets up upterm + tmux and provides an SSH connection string and force the container to stay alive for 30 minutes. To connect, watch your the build log untill you see:
=== F8S2LCNHYCL8S3WGMW72
Command: tmux new -s upterm -x 132 -y 43
Force Command: tmux attach -t upterm
Host: ssh://uptermd.upterm.dev:22
SSH Session: ssh F8S2LCn..........<REDACTED>...............FsOjIyMjI=@uptermd.upterm.dev
Then you can connect by copying the ssh
connection string, and run your tests directly on the Github Action container:
- For upterm, you can run your own uptermd
- Configure Github Actions to run on your own containers (via AWS/EC2 or similar), then connect directly