Skip to content

Commit

Permalink
chore(ssh): remove comma splitting
Browse files Browse the repository at this point in the history
fix #10
  • Loading branch information
appleboy committed Nov 21, 2019
1 parent aa1ecdd commit 6f091cd
Show file tree
Hide file tree
Showing 3 changed files with 58 additions and 39 deletions.
8 changes: 5 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,9 @@ jobs:
# key: ${{ secrets.KEY }}
# port: ${{ secrets.PORT }}
# script_stop: true
# script: "mkdir abc/def,ls -al"
# script: |
# mkdir abc/def
# ls -al

- name: pass environment
uses: appleboy/ssh-action@master
Expand All @@ -56,5 +58,5 @@ jobs:
port: ${{ secrets.PORT }}
envs: FOO
script: |
echo "I am $FOO"
echo "I am $BAR"
echo "I am $FOO, thanks"
echo "I am $BAR, thanks"
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM appleboy/drone-ssh:1.5.2-linux-amd64
FROM appleboy/drone-ssh:1.5.3-linux-amd64

ADD entrypoint.sh /entrypoint.sh
RUN chmod +x /entrypoint.sh
Expand Down
87 changes: 52 additions & 35 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,9 @@ output:
whoami
======END======
out: ***
==========================================
Successfully executed commands to all host.
==========================================
==============================================
Successfully executed commands to all host.
==============================================
```

## Input variables
Expand Down Expand Up @@ -106,45 +106,62 @@ Multiple Commands
Multiple Hosts
```diff
uses: appleboy/ssh-action@master
with:
- host: "foo.com"
+ host: "foo.com,bar.com"
username: ${{ secrets.USERNAME }}
key: ${{ secrets.KEY }}
port: ${{ secrets.PORT }}
script: |
whoami
ls -al
- name: multiple host
uses: appleboy/ssh-action@master
with:
- host: "foo.com"
+ host: "foo.com,bar.com"
username: ${{ secrets.USERNAME }}
key: ${{ secrets.KEY }}
port: ${{ secrets.PORT }}
script: |
whoami
ls -al
```
Pass environment variable to shell script
```diff
uses: appleboy/ssh-action@master
+ env:
+ FOO: "BAR"
with:
host: ${{ secrets.HOST }}
username: ${{ secrets.USERNAME }}
key: ${{ secrets.KEY }}
port: ${{ secrets.PORT }}
+ envs: FOO
script: |
echo "I am $FOO"
echo "I am $BAR"
- name: pass environment
uses: appleboy/ssh-action@master
+ env:
+ FOO: "BAR"
with:
host: ${{ secrets.HOST }}
username: ${{ secrets.USERNAME }}
key: ${{ secrets.KEY }}
port: ${{ secrets.PORT }}
+ envs: FOO
script: |
echo "I am $FOO"
echo "I am $BAR"
```
Stop script after first failure. ex: missing `abc` folder

```yaml
- name: stop script if command error
uses: appleboy/ssh-action@master
with:
host: ${{ secrets.HOST }}
username: ${{ secrets.USERNAME }}
key: ${{ secrets.KEY }}
port: ${{ secrets.PORT }}
script_stop: true
script: "mkdir abc/def,ls -al"
```diff
- name: stop script if command error
uses: appleboy/ssh-action@master
with:
host: ${{ secrets.HOST }}
username: ${{ secrets.USERNAME }}
key: ${{ secrets.KEY }}
port: ${{ secrets.PORT }}
+ script_stop: true
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
```

0 comments on commit 6f091cd

Please sign in to comment.