Bo-Yi Wu 2019-09-29 12:29:29 +08:00
parent 79584d6cfa
commit 553894abe6

162
DOCS.md
View File

@ -11,123 +11,110 @@ image: appleboy/drone-ssh
Use the SSH plugin to execute commands on a remote server. The below pipeline configuration demonstrates simple usage: Use the SSH plugin to execute commands on a remote server. The below pipeline configuration demonstrates simple usage:
```yaml ```yaml
pipeline: - name: ssh commands
ssh: image: appleboy/drone-ssh
image: appleboy/drone-ssh settings:
settings: host: foo.com
host: foo.com username: root
username: root password: 1234
password: 1234 port: 22
port: 22 script:
script: - echo hello
- echo hello - echo world
- echo world
``` ```
Example configuration in your `.drone.yml` file for multiple hosts: Example configuration in your `.drone.yml` file for multiple hosts:
```diff ```diff
pipeline: image: appleboy/drone-ssh
ssh: 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
pipeline: image: appleboy/drone-ssh
ssh: settings:
image: appleboy/drone-ssh host: foo.com
settings: username: root
host: foo.com password: 1234
username: root port: 22
password: 1234
port: 22
+ command_timeout: 2m + command_timeout: 2m
script: script:
- echo hello - echo hello
- echo world - 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
pipeline: image: appleboy/drone-ssh
ssh: 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
pipeline: image: appleboy/drone-ssh
ssh: 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
pipeline: image: appleboy/drone-ssh
ssh: 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
pipeline: image: appleboy/drone-ssh
ssh: 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
``` ```
## Secret Reference ## Secret Reference
@ -176,6 +163,9 @@ envs
script script
: execute commands on a remote server : execute commands on a remote server
script_stop
: stop script after first failure
timeout timeout
: Timeout is the maximum amount of time for the TCP connection to establish. : Timeout is the maximum amount of time for the TCP connection to establish.