mirror of
https://github.com/appleboy/drone-ssh.git
synced 2025-05-09 18:23:21 +08:00
docs: [ci skip] add drone document. (#39)
This commit is contained in:
parent
a8cc62009f
commit
3943bd28ff
105
DOCS.md
105
DOCS.md
@ -1,30 +1,14 @@
|
|||||||
Use the SSH plugin to execute commands on a remote server. You will need to
|
---
|
||||||
supply Drone with a private SSH key to being able to connect to a host.
|
date: 2017-01-29T00:00:00+00:00
|
||||||
|
title: SSH
|
||||||
|
author: appleboy
|
||||||
|
tags: [ publish, ssh ]
|
||||||
|
repo: appleboy/drone-ssh
|
||||||
|
logo: term.svg
|
||||||
|
image: appleboy/drone-ssh
|
||||||
|
---
|
||||||
|
|
||||||
## Config
|
Use the SSH plugin to execute commands on a remote server. The below pipeline configuration demonstrates simple usage:
|
||||||
|
|
||||||
The following parameters are used to configure the plugin:
|
|
||||||
|
|
||||||
* **host** - address or IP of the remote machine
|
|
||||||
* **port** - port to connect to on the remote machine
|
|
||||||
* **user** - user to log in as on the remote machine
|
|
||||||
* **passsword** - password to log in as on the remote machine
|
|
||||||
* **key** - private SSH key for the remote machine
|
|
||||||
* **timeout** - timeout for the tcp connection attempt
|
|
||||||
* **script** - list of commands to execute
|
|
||||||
|
|
||||||
The following secret values can be set to configure the plugin.
|
|
||||||
|
|
||||||
* **SSH_HOST** - corresponds to **host**
|
|
||||||
* **SSH_PORT** - corresponds to **port**
|
|
||||||
* **SSH_USER** - corresponds to **user**
|
|
||||||
* **SSH_PASSWORD** - corresponds to **password**
|
|
||||||
* **SSH_KEY** - corresponds to **key**
|
|
||||||
* **SSH_TIMEOUT** - corresponds to **timeout**
|
|
||||||
|
|
||||||
## Examples
|
|
||||||
|
|
||||||
Example configuration in your .drone.yml file for a single host:
|
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
pipeline:
|
pipeline:
|
||||||
@ -39,15 +23,15 @@ pipeline:
|
|||||||
- echo world
|
- echo world
|
||||||
```
|
```
|
||||||
|
|
||||||
Example configuration in your .drone.yml file for multiple hosts:
|
Example configuration in your `.drone.yml` file for multiple hosts:
|
||||||
|
|
||||||
```yaml
|
```diff
|
||||||
pipeline:
|
pipeline:
|
||||||
ssh:
|
ssh:
|
||||||
image: appleboy/drone-ssh
|
image: appleboy/drone-ssh
|
||||||
host:
|
host:
|
||||||
- foo.com
|
+ - foo.com
|
||||||
- bar.com
|
+ - bar.com
|
||||||
user: root
|
user: root
|
||||||
port: 22
|
port: 22
|
||||||
script:
|
script:
|
||||||
@ -55,7 +39,60 @@ pipeline:
|
|||||||
- echo world
|
- echo world
|
||||||
```
|
```
|
||||||
|
|
||||||
In the above example Drone executes the commands on multiple hosts
|
Example configuration for success build:
|
||||||
sequentially. If the commands fail on a single host this plugin exits
|
|
||||||
immediatly, and will not run your commands on the remaining hosts in the
|
```diff
|
||||||
list.
|
pipeline:
|
||||||
|
ssh:
|
||||||
|
image: appleboy/drone-ssh
|
||||||
|
host: foo.com
|
||||||
|
user: root
|
||||||
|
password: 1234
|
||||||
|
port: 22
|
||||||
|
script:
|
||||||
|
- echo hello
|
||||||
|
- echo world
|
||||||
|
+ when:
|
||||||
|
+ status: success
|
||||||
|
```
|
||||||
|
|
||||||
|
Example configuration for tag event:
|
||||||
|
|
||||||
|
```diff
|
||||||
|
pipeline:
|
||||||
|
ssh:
|
||||||
|
image: appleboy/drone-ssh
|
||||||
|
host: foo.com
|
||||||
|
user: root
|
||||||
|
password: 1234
|
||||||
|
port: 22
|
||||||
|
script:
|
||||||
|
- echo hello
|
||||||
|
- echo world
|
||||||
|
+ when:
|
||||||
|
+ status: success
|
||||||
|
+ event: tag
|
||||||
|
```
|
||||||
|
|
||||||
|
# Parameter Reference
|
||||||
|
|
||||||
|
host
|
||||||
|
: target hostname or IP
|
||||||
|
|
||||||
|
port
|
||||||
|
: ssh port of target host
|
||||||
|
|
||||||
|
user
|
||||||
|
: account for target host user
|
||||||
|
|
||||||
|
password
|
||||||
|
: password for target host user
|
||||||
|
|
||||||
|
key
|
||||||
|
: plain text of user private key
|
||||||
|
|
||||||
|
script
|
||||||
|
: execute commands on a remote server
|
||||||
|
|
||||||
|
timeout
|
||||||
|
: Timeout is the maximum amount of time for the TCP connection to establish.
|
||||||
|
Loading…
Reference in New Issue
Block a user