drone-ssh/DOCS.md
Bo-Yi Wu 7e4e0224ee feat: Add time out flag. (#53)
* feat: Add time out flag.

* fix testing

Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com>
2017-03-04 17:50:05 +08:00

2.5 KiB

date title author tags repo logo image
2017-01-29T00:00:00+00:00 SSH appleboy
publish
ssh
appleboy/drone-ssh term.svg appleboy/drone-ssh

Use the SSH plugin to execute commands on a remote server. The below pipeline configuration demonstrates simple usage:

pipeline:
  ssh:
    image: appleboy/drone-ssh
    host: foo.com
    username: root
    password: 1234
    port: 22
    script:
      - echo hello
      - echo world

Example configuration in your .drone.yml file for multiple hosts:

pipeline:
  ssh:
    image: appleboy/drone-ssh
    host:
+    - foo.com
+    - bar.com
    username: root
    password: 1234
    port: 22
    script:
      - echo hello
      - echo world

Example configuration for login with user private key:

pipeline:
  ssh:
    image: appleboy/drone-ssh
    host: foo.com
    username: root
-   password: 1234
+   key: ${DEPLOY_KEY}
    port: 22
    script:
      - echo hello
      - echo world

Example configuration for login with file path of user private key:

pipeline:
  ssh:
    image: appleboy/drone-ssh
    host: foo.com
    username: root
-   password: 1234
+   key_path: ./deploy/key.pem
    port: 22
    script:
      - echo hello
      - echo world

Example configuration for command timeout (unit: second), default value is 60 seconds:

pipeline:
  ssh:
    image: appleboy/drone-ssh
    host: foo.com
    username: root
    password: 1234
    port: 22
+   command_timeout: 10
    script:
      - echo hello
      - echo world

Example configuration for success build:

pipeline:
  ssh:
    image: appleboy/drone-ssh
    host: foo.com
    username: root
    password: 1234
    port: 22
    script:
      - echo hello
      - echo world
+   when:
+     status: success

Example configuration for tag event:

pipeline:
  ssh:
    image: appleboy/drone-ssh
    host: foo.com
    username: 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
username
account for target host user
password
password for target host user
key
plain text of user private key
key_path
key path 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.
command_timeout
Command timeout is the maximum amount of time for the execute commands, default is 60 secs.