docs: update diff format

This commit is contained in:
Bo-Yi Wu 2019-10-18 22:37:47 +08:00
parent 414ebba911
commit 530cb1df6e

155
DOCS.md
View File

@ -26,110 +26,117 @@ Use the SSH plugin to execute commands on a remote server. The below pipeline co
Example configuration in your `.drone.yml` file for multiple hosts: Example configuration in your `.drone.yml` file for multiple hosts:
```diff ```diff
image: appleboy/drone-ssh - name: ssh commands
settings: image: appleboy/drone-ssh
host: settings:
+ - foo.com host:
+ - bar.com + - foo.com
username: root + - bar.com
password: 1234 username: root
port: 22 password: 1234
script: port: 22
- echo hello script:
- echo world - echo hello
- echo world
``` ```
Example configuration for command timeout, default value is 60 seconds: Example configuration for command timeout, default value is 60 seconds:
```diff ```diff
image: appleboy/drone-ssh - name: ssh commands
settings: image: appleboy/drone-ssh
host: foo.com settings:
username: root host: foo.com
password: 1234 username: root
port: 22 password: 1234
+ command_timeout: 2m port: 22
script: + command_timeout: 2m
- echo hello script:
- echo world - echo hello
- echo world
``` ```
Example configuration for execute commands on a remote server using SSHProxyCommand: Example configuration for execute commands on a remote server using SSHProxyCommand:
```diff ```diff
image: appleboy/drone-ssh - name: ssh commands
settings: image: appleboy/drone-ssh
host: foo.com settings:
username: root host: foo.com
password: 1234 username: root
port: 22 password: 1234
script: port: 22
- echo hello script:
- echo world - echo hello
+ proxy_host: 10.130.33.145 - echo world
+ proxy_user: ubuntu + proxy_host: 10.130.33.145
+ proxy_port: 22 + proxy_user: ubuntu
+ proxy_password: 1234 + proxy_port: 22
+ proxy_password: 1234
``` ```
Example configuration using password from secrets: Example configuration using password from secrets:
```diff ```diff
image: appleboy/drone-ssh - name: ssh commands
settings: image: appleboy/drone-ssh
host: foo.com settings:
username: root host: foo.com
+ password: username: root
+ from_secret: ssh_password + password:
port: 22 + from_secret: ssh_password
script: port: 22
- echo hello script:
- echo world - echo hello
- echo world
``` ```
Example configuration using ssh key from secrets: Example configuration using ssh key from secrets:
```diff ```diff
image: appleboy/drone-ssh - name: ssh commands
settings: image: appleboy/drone-ssh
host: foo.com settings:
username: root host: foo.com
port: 22 username: root
+ key: port: 22
+ from_secret: ssh_key + key:
script: + from_secret: ssh_key
- echo hello script:
- echo world - echo hello
- echo world
``` ```
Example configuration for exporting custom secrets: Example configuration for exporting custom secrets:
```diff ```diff
image: appleboy/drone-ssh - name: ssh commands
settings: image: appleboy/drone-ssh
host: foo.com settings:
username: root host: foo.com
password: 1234 username: root
port: 22 password: 1234
+ envs: port: 22
- aws_access_key_id + envs:
script: - aws_access_key_id
- export AWS_ACCESS_KEY_ID=$AWS_ACCESS_KEY_ID script:
- export AWS_ACCESS_KEY_ID=$AWS_ACCESS_KEY_ID
``` ```
Example configuration for stoping script after first failure: Example configuration for stoping script after first failure:
```diff ```diff
image: appleboy/drone-ssh - name: ssh commands
settings: image: appleboy/drone-ssh
host: foo.com settings:
username: root host: foo.com
password: 1234 username: root
port: 22 password: 1234
+ script_stop: true port: 22
script: + script_stop: true
- mkdir abc/def/efg script:
- echo "you can't see the steps." - mkdir abc/def/efg
- echo "you can't see the steps."
``` ```
## Secret Reference ## Secret Reference