I've always like the idea of being able to ssh into a running job to debug CI-specific things like firewall rules.
In GitHub Actions, the solution is super simple. Just use the action owenthereal/action-upterm
:
But with GitLab CI, Actions don't exist and you have to craft your own. To make things worse, you can't find examples of people using upterm
in their .gitlab-ci.yml
files since GitLab code search isn't available on the public gitlab.com instance… (one of the many reasons one should prefer GitHub over GitLab).
Tested on 7 March 2025.
Here is the commands I use. You can also copy-paste these commands into your job's script
block as long as it is an Alpine image. For Debian-based images, adjustments will need to be made.
Note that you can't just do:
Not sure why… but when trying to connect, you would get "Connection closed":