Ignore failures when trying to kill the ssh-agent (#33)

This commit is contained in:
Matthias Pigulla 2020-06-24 08:31:28 +02:00 committed by GitHub
parent 5ef9e0334a
commit ef0ce0cab8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 286 additions and 111 deletions

View file

@ -27,9 +27,9 @@ jobs:
...
steps:
- actions/checkout@v1
# Make sure the @v0.3.0 matches the current version of the
# Make sure the @v0.4.0 matches the current version of the
# action
- uses: webfactory/ssh-agent@v0.3.0
- uses: webfactory/ssh-agent@v0.4.0
with:
ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }}
- ... other steps
@ -44,7 +44,7 @@ In that case, you can set-up the different keys as multiple secrets and pass the
```yaml
# ... contens as before
- uses: webfactory/ssh-agent@v0.3.0
- uses: webfactory/ssh-agent@v0.4.0
with:
ssh-private-key: |
${{ secrets.FIRST_KEY }}
@ -55,10 +55,10 @@ In that case, you can set-up the different keys as multiple secrets and pass the
The `ssh-agent` will load all of the keys and try each one in order when establishing SSH connections.
There's one **caveat**, though: SSH servers may abort the connection attempt after a number of mismatching keys have been presented. So if, for example, you have
six different keys loaded into the `ssh-agent`, but the server aborts after five unknown keys, the last key (which might be the right one) will never even be tried.
six different keys loaded into the `ssh-agent`, but the server aborts after five unknown keys, the last key (which might be the right one) will never even be tried. If you don't need all of the keys at the same time, you could try to `run: kill $SSH_AGENT_PID` to kill the currently running `ssh-agent` and use the action again in a following step to start another instance.
## Exported variables
The action exports `SSH_AUTH_SOCK` and `SSH_AGENT_PID` through the Github Actions core module.
The action exports the `SSH_AUTH_SOCK` and `SSH_AGENT_PID` environment variables through the Github Actions core module.
The `$SSH_AUTH_SOCK` is used by several applications like git or rsync to connect to the SSH authentication agent.
The `$SSH_AGENT_PID` contains the process id of the agent. This is used to kill the agent in post job action.
@ -118,7 +118,7 @@ To actually grant the SSH key access, you can on GitHub use at least two
As a note to my future self, in order to work on this repo:
* Clone it
* Run `npm install` to fetch dependencies
* Run `yarn install` to fetch dependencies
* _hack hack hack_
* `node index.js`. Inputs are passed through `INPUT_` env vars with their names uppercased. Use `env "INPUT_SSH-PRIVATE-KEY=\`cat file\`" node index.js` for this action.
* Run `npm run build` to update `dist/*`, which holds the files actually run