Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SSH into runners #730

Merged
merged 1 commit into from
Aug 31, 2024
Merged

SSH into runners #730

merged 1 commit into from
Aug 31, 2024

Conversation

makslevental
Copy link
Collaborator

@makslevental makslevental commented Aug 30, 2024

This PR adds the ability to SSH into runners using https://github.com/mxschmitt/action-tmate. The way it works is like this:

  1. You want to debug a runner either because it failed or for the heck of it;

  2. You go to the Actions tab and find the list of actions in the left colum and select Mac or Windows (but not Linux - see Notes below):
    Screenshot from 2024-08-30 17-28-05

  3. You then go to the far right and click the Run workflow dropdown:

    Screenshot from 2024-08-30 17-28-45
    Note, the Branch: dropdown - currently (because this PR hasn't landed) I can only do it for this branch. After this PR lands you'll be able to do it for any branch;

  4. You check either one of the options; hopefully the descriptions are sufficient - if not ask in this PR and I'll update the descriptions accordingly;

  5. The runner will run to completion or failure and then, at the end, start spamming

    Screenshot from 2024-08-30 17-32-06 Note, not indefinitely but 600 spams;

  6. Copy-paste and you'll arrive at a tmux session that looks like this:

    Screenshot from 2024-08-30 17-48-55

    Hit ctrl-c and you'll be dropped into tmux:

    Screenshot from 2024-08-30 17-50-15

  7. The job (not the whole action) exits/ends when you quit the session.

A few things to call out:

  1. You need an ssh key that's associated with your GH username (e.g., the one you're using to commit/push); Note you don't need to do the -i part, ssh will find it automatically if it's under ~/.ssh;
  2. This isn't enabled for the Linux runner. Why? I only added this to the free GitHub runners, not any nod runners, because this is clearly an attack vector. So don't add it to any of our runners (at least not until/unless I do this);
  3. Yes, this works on Windows too but you land in git-bash/mingw/msys. If you want powershell (or cmd) then you can do powershell (or cmd);
  4. If you don't know how to use tmux just refer to this cheatsheet.

Copy link
Collaborator

@jtuyls jtuyls left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice!

@jtuyls jtuyls merged commit e76600b into main Aug 31, 2024
6 checks passed
@jtuyls jtuyls deleted the makslevental/tmate branch August 31, 2024 08:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants