mirror of
https://github.com/appleboy/ssh-action.git
synced 2024-12-19 20:29:05 +00:00
commit
d520c19f4f
53
README.md
53
README.md
@ -58,6 +58,16 @@ See [action.yml](./action.yml) for more detailed information.
|
|||||||
* envs - pass environment variable to shell script
|
* envs - pass environment variable to shell script
|
||||||
* debug - enable debug mode
|
* debug - enable debug mode
|
||||||
|
|
||||||
|
SSH Proxy Setting:
|
||||||
|
|
||||||
|
* proxy_host - proxy host
|
||||||
|
* proxy_port - proxy port, default is `22`
|
||||||
|
* proxy_username - proxy username
|
||||||
|
* proxy_password - proxy password
|
||||||
|
* proxy_timeout - timeout for ssh to proxy host, default is `30s`
|
||||||
|
* proxy_key - content of ssh proxy private key.
|
||||||
|
* proxy_key_path - path of ssh proxy private key
|
||||||
|
|
||||||
### Example
|
### Example
|
||||||
|
|
||||||
Executing remote ssh commands using password.
|
Executing remote ssh commands using password.
|
||||||
@ -165,3 +175,46 @@ ls -al
|
|||||||
err: mkdir: cannot create directory ‘abc/def’: No such file or directory
|
err: mkdir: cannot create directory ‘abc/def’: No such file or directory
|
||||||
##[error]Docker run failed with exit code 1
|
##[error]Docker run failed with exit code 1
|
||||||
```
|
```
|
||||||
|
|
||||||
|
How to connect remote server using `ProxyCommand`?
|
||||||
|
|
||||||
|
```bash
|
||||||
|
+--------+ +----------+ +-----------+
|
||||||
|
| Laptop | <--> | Jumphost | <--> | FooServer |
|
||||||
|
+--------+ +----------+ +-----------+
|
||||||
|
```
|
||||||
|
|
||||||
|
in your `~/.ssh/config`, you will see the following.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
Host Jumphost
|
||||||
|
HostName Jumphost
|
||||||
|
User ubuntu
|
||||||
|
Port 22
|
||||||
|
IdentityFile ~/.ssh/keys/jump_host.pem
|
||||||
|
|
||||||
|
Host FooServer
|
||||||
|
HostName FooServer
|
||||||
|
User ubuntu
|
||||||
|
Port 22
|
||||||
|
ProxyCommand ssh -q -W %h:%p Jumphost
|
||||||
|
```
|
||||||
|
|
||||||
|
How to convert to YAML format of GitHubActions.
|
||||||
|
|
||||||
|
```diff
|
||||||
|
- name: ssh proxy command
|
||||||
|
uses: appleboy/ssh-action@master
|
||||||
|
with:
|
||||||
|
host: ${{ secrets.HOST }}
|
||||||
|
username: ${{ secrets.USERNAME }}
|
||||||
|
key: ${{ secrets.KEY }}
|
||||||
|
port: ${{ secrets.PORT }}
|
||||||
|
+ proxy_host: ${{ secrets.PROXY_HOST }}
|
||||||
|
+ proxy_username: ${{ secrets.PROXY_USERNAME }}
|
||||||
|
+ proxy_key: ${{ secrets.PROXY_KEY }}
|
||||||
|
+ proxy_port: ${{ secrets.PROXY_PORT }}
|
||||||
|
script: |
|
||||||
|
mkdir abc/def
|
||||||
|
ls -al
|
||||||
|
```
|
||||||
|
16
action.yml
16
action.yml
@ -21,6 +21,22 @@ inputs:
|
|||||||
description: 'content of ssh private key. ex raw content of ~/.ssh/id_rsa'
|
description: 'content of ssh private key. ex raw content of ~/.ssh/id_rsa'
|
||||||
key_path:
|
key_path:
|
||||||
description: 'path of ssh private key'
|
description: 'path of ssh private key'
|
||||||
|
proxy_host:
|
||||||
|
description: 'ssh proxy remote host'
|
||||||
|
proxy_port:
|
||||||
|
description: 'ssh proxy remote port'
|
||||||
|
default: 22
|
||||||
|
proxy_username:
|
||||||
|
description: 'ssh proxy username'
|
||||||
|
proxy_password:
|
||||||
|
description: 'ssh proxy password'
|
||||||
|
proxy_timeout:
|
||||||
|
description: 'timeout for ssh to proxy host'
|
||||||
|
default: "30s"
|
||||||
|
proxy_key:
|
||||||
|
description: 'content of ssh proxy private key. ex raw content of ~/.ssh/id_rsa'
|
||||||
|
proxy_key_path:
|
||||||
|
description: 'path of ssh proxy private key'
|
||||||
script:
|
script:
|
||||||
description: 'execute commands'
|
description: 'execute commands'
|
||||||
script_stop:
|
script_stop:
|
||||||
|
Loading…
Reference in New Issue
Block a user