Compare commits
4 Commits
Author | SHA1 | Date | |
---|---|---|---|
9085f3ea5b | |||
696aab4627 | |||
a88f6f2013 | |||
6f091cd9e3 |
8
.github/workflows/ci.yml
vendored
8
.github/workflows/ci.yml
vendored
@ -43,7 +43,9 @@ jobs:
|
|||||||
# key: ${{ secrets.KEY }}
|
# key: ${{ secrets.KEY }}
|
||||||
# port: ${{ secrets.PORT }}
|
# port: ${{ secrets.PORT }}
|
||||||
# script_stop: true
|
# script_stop: true
|
||||||
# script: "mkdir abc/def,ls -al"
|
# script: |
|
||||||
|
# mkdir abc/def
|
||||||
|
# ls -al
|
||||||
|
|
||||||
- name: pass environment
|
- name: pass environment
|
||||||
uses: appleboy/ssh-action@master
|
uses: appleboy/ssh-action@master
|
||||||
@ -56,5 +58,5 @@ jobs:
|
|||||||
port: ${{ secrets.PORT }}
|
port: ${{ secrets.PORT }}
|
||||||
envs: FOO
|
envs: FOO
|
||||||
script: |
|
script: |
|
||||||
echo "I am $FOO"
|
echo "I am $FOO, thanks"
|
||||||
echo "I am $BAR"
|
echo "I am $BAR, thanks"
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
FROM appleboy/drone-ssh:1.5.2-linux-amd64
|
FROM appleboy/drone-ssh:1.5.4-linux-amd64
|
||||||
|
|
||||||
ADD entrypoint.sh /entrypoint.sh
|
ADD entrypoint.sh /entrypoint.sh
|
||||||
RUN chmod +x /entrypoint.sh
|
RUN chmod +x /entrypoint.sh
|
||||||
|
99
README.md
99
README.md
@ -36,21 +36,21 @@ output:
|
|||||||
whoami
|
whoami
|
||||||
======END======
|
======END======
|
||||||
out: ***
|
out: ***
|
||||||
==========================================
|
==============================================
|
||||||
Successfully executed commands to all host.
|
✅ Successfully executed commands to all host.
|
||||||
==========================================
|
==============================================
|
||||||
```
|
```
|
||||||
|
|
||||||
## Input variables
|
## Input variables
|
||||||
|
|
||||||
see the [action.yml](./action.yml) file for more detail imformation.
|
See [action.yml](./action.yml) for more detailed information.
|
||||||
|
|
||||||
* host - scp remote host
|
* host - remote host
|
||||||
* port - scp remote port, default is `22`
|
* port - remote port, default is `22`
|
||||||
* username - scp username
|
* username - ssh username
|
||||||
* password - scp password
|
* password - ssh password
|
||||||
* timeout - timeout for ssh to remote host, default is `30s`
|
* timeout - timeout for ssh to remote host, default is `30s`
|
||||||
* command_timeout - timeout for scp command, default is `1m`
|
* command_timeout - timeout for ssh command, default is `10m`
|
||||||
* key - content of ssh private key. ex raw content of ~/.ssh/id_rsa
|
* key - content of ssh private key. ex raw content of ~/.ssh/id_rsa
|
||||||
* key_path - path of ssh private key
|
* key_path - path of ssh private key
|
||||||
* script - execute commands
|
* script - execute commands
|
||||||
@ -106,45 +106,62 @@ Multiple Commands
|
|||||||
Multiple Hosts
|
Multiple Hosts
|
||||||
|
|
||||||
```diff
|
```diff
|
||||||
uses: appleboy/ssh-action@master
|
- name: multiple host
|
||||||
with:
|
uses: appleboy/ssh-action@master
|
||||||
- host: "foo.com"
|
with:
|
||||||
+ host: "foo.com,bar.com"
|
- host: "foo.com"
|
||||||
username: ${{ secrets.USERNAME }}
|
+ host: "foo.com,bar.com"
|
||||||
key: ${{ secrets.KEY }}
|
username: ${{ secrets.USERNAME }}
|
||||||
port: ${{ secrets.PORT }}
|
key: ${{ secrets.KEY }}
|
||||||
script: |
|
port: ${{ secrets.PORT }}
|
||||||
whoami
|
script: |
|
||||||
ls -al
|
whoami
|
||||||
|
ls -al
|
||||||
```
|
```
|
||||||
|
|
||||||
Pass environment variable to shell script
|
Pass environment variable to shell script
|
||||||
|
|
||||||
```diff
|
```diff
|
||||||
uses: appleboy/ssh-action@master
|
- name: pass environment
|
||||||
+ env:
|
uses: appleboy/ssh-action@master
|
||||||
+ FOO: "BAR"
|
+ env:
|
||||||
with:
|
+ FOO: "BAR"
|
||||||
host: ${{ secrets.HOST }}
|
with:
|
||||||
username: ${{ secrets.USERNAME }}
|
host: ${{ secrets.HOST }}
|
||||||
key: ${{ secrets.KEY }}
|
username: ${{ secrets.USERNAME }}
|
||||||
port: ${{ secrets.PORT }}
|
key: ${{ secrets.KEY }}
|
||||||
+ envs: FOO
|
port: ${{ secrets.PORT }}
|
||||||
script: |
|
+ envs: FOO
|
||||||
echo "I am $FOO"
|
script: |
|
||||||
echo "I am $BAR"
|
echo "I am $FOO"
|
||||||
|
echo "I am $BAR"
|
||||||
```
|
```
|
||||||
|
|
||||||
Stop script after first failure. ex: missing `abc` folder
|
Stop script after first failure. ex: missing `abc` folder
|
||||||
|
|
||||||
```yaml
|
```diff
|
||||||
- name: stop script if command error
|
- name: stop script if command error
|
||||||
uses: appleboy/ssh-action@master
|
uses: appleboy/ssh-action@master
|
||||||
with:
|
with:
|
||||||
host: ${{ secrets.HOST }}
|
host: ${{ secrets.HOST }}
|
||||||
username: ${{ secrets.USERNAME }}
|
username: ${{ secrets.USERNAME }}
|
||||||
key: ${{ secrets.KEY }}
|
key: ${{ secrets.KEY }}
|
||||||
port: ${{ secrets.PORT }}
|
port: ${{ secrets.PORT }}
|
||||||
script_stop: true
|
+ script_stop: true
|
||||||
script: "mkdir abc/def,ls -al"
|
script: |
|
||||||
|
mkdir abc/def
|
||||||
|
ls -al
|
||||||
|
```
|
||||||
|
|
||||||
|
output:
|
||||||
|
|
||||||
|
```sh
|
||||||
|
======CMD======
|
||||||
|
mkdir abc/def
|
||||||
|
ls -al
|
||||||
|
|
||||||
|
======END======
|
||||||
|
2019/11/21 01:16:21 Process exited with status 1
|
||||||
|
err: mkdir: cannot create directory ‘abc/def’: No such file or directory
|
||||||
|
##[error]Docker run failed with exit code 1
|
||||||
```
|
```
|
||||||
|
@ -16,7 +16,7 @@ inputs:
|
|||||||
default: "30s"
|
default: "30s"
|
||||||
command_timeout:
|
command_timeout:
|
||||||
description: 'timeout for ssh command'
|
description: 'timeout for ssh command'
|
||||||
default: "1m"
|
default: "10m"
|
||||||
key:
|
key:
|
||||||
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:
|
||||||
|
Reference in New Issue
Block a user