kielabokkie / ssh-key-and-known-hosts-action

Setup private key and add host to known hosts

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Clashes with previous runs

Jamesking56 opened this issue · comments

On shared runners, this action clashes with previous runs:

image

It appears to leave behind /tmp/ssh-auth.sock, it would be much better if this was more randomly named (unique to the process) and removed once the actions run has finished

@Jamesking56 Thanks for the report. This is an interesting one because the last release actually added a cleanup script that is supposed to kill the ssh-server (see #11). Did the run prior to this one fail or completed successfully?

The run prior failed, but I actually think the cause is on shared runners running this directly on the host with multiple builds running simultaneously.

I have other projects using this and if they trigger this action at the same time, I think that's what causes this since the socket file shares the same name.

I think this action should create a unique socket file with a unique filename so no clashes occur.

I have the same issue. Wouldn't it be possible to simply fetch the SSH_AUTH_SOCK env var (instead of overriding it) to get a user-defined filename? Like so:

     - uses: kielabokkie/ssh-key-and-known-hosts-action@v1
       env:
         SSH_AUTH_SOCK: /tmp/ssh_agent_${{ github.sha }}.sock

@Jamesking56 @jguillon You can now customise the socket to prevent issues with multiple simultaneous builds:

uses: kielabokkie/ssh-key-and-known-hosts-action@v1
with:
  ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }}
  ssh-host: your-server.com
  ssh-socket: /tmp/ssh_agent_${{ github.sha }}.sock

Let me know if that works or if you still encounter any issues.