From 553894abe662e561f945df7dea827ce13ee4e00b Mon Sep 17 00:00:00 2001 From: Bo-Yi Wu Date: Sun, 29 Sep 2019 12:29:29 +0800 Subject: [PATCH] docs: update drone document fix: https://github.com/appleboy/drone-ssh/issues/144 fix: https://github.com/appleboy/drone-ssh/issues/146 --- DOCS.md | 162 ++++++++++++++++++++++++++------------------------------ 1 file changed, 76 insertions(+), 86 deletions(-) diff --git a/DOCS.md b/DOCS.md index c4a25cf..ca82630 100644 --- a/DOCS.md +++ b/DOCS.md @@ -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: ```yaml -pipeline: - ssh: - image: appleboy/drone-ssh - settings: - host: foo.com - username: root - password: 1234 - port: 22 - script: - - echo hello - - echo world +- name: ssh commands + image: appleboy/drone-ssh + settings: + host: foo.com + username: root + password: 1234 + port: 22 + script: + - echo hello + - echo world ``` Example configuration in your `.drone.yml` file for multiple hosts: ```diff -pipeline: - ssh: - image: appleboy/drone-ssh - settings: - host: -+ - foo.com -+ - bar.com - username: root - password: 1234 - port: 22 - script: - - echo hello - - echo world + image: appleboy/drone-ssh + settings: + host: ++ - foo.com ++ - bar.com + username: root + password: 1234 + port: 22 + script: + - echo hello + - echo world ``` Example configuration for command timeout, default value is 60 seconds: ```diff -pipeline: - ssh: - image: appleboy/drone-ssh - settings: - host: foo.com - username: root - password: 1234 - port: 22 + image: appleboy/drone-ssh + settings: + host: foo.com + username: root + password: 1234 + port: 22 + command_timeout: 2m - script: - - echo hello - - echo world + script: + - echo hello + - echo world ``` Example configuration for execute commands on a remote server using `SSHProxyCommand`: ```diff -pipeline: - ssh: - image: appleboy/drone-ssh - settings: - host: foo.com - username: root - password: 1234 - port: 22 - script: - - echo hello - - echo world -+ proxy_host: 10.130.33.145 -+ proxy_user: ubuntu -+ proxy_port: 22 -+ proxy_password: 1234 + image: appleboy/drone-ssh + settings: + host: foo.com + username: root + password: 1234 + port: 22 + script: + - echo hello + - echo world ++ proxy_host: 10.130.33.145 ++ proxy_user: ubuntu ++ proxy_port: 22 ++ proxy_password: 1234 ``` Example configuration using password from secrets: ```diff -pipeline: - ssh: - image: appleboy/drone-ssh - settings: - host: foo.com - username: root -+ password: -+ from_secret: ssh_password - port: 22 - script: - - echo hello - - echo world + image: appleboy/drone-ssh + settings: + host: foo.com + username: root ++ password: ++ from_secret: ssh_password + port: 22 + script: + - echo hello + - echo world ``` Example configuration using ssh key from secrets: ```diff -pipeline: - ssh: - image: appleboy/drone-ssh - settings: - host: foo.com - username: root - port: 22 -+ key: -+ from_secret: ssh_key - script: - - echo hello - - echo world + image: appleboy/drone-ssh + settings: + host: foo.com + username: root + port: 22 ++ key: ++ from_secret: ssh_key + script: + - echo hello + - echo world ``` Example configuration for exporting custom secrets: ```diff -pipeline: - ssh: - image: appleboy/drone-ssh - settings: - host: foo.com - username: root - password: 1234 - port: 22 -+ envs: - - aws_access_key_id - script: - - export AWS_ACCESS_KEY_ID=$AWS_ACCESS_KEY_ID + image: appleboy/drone-ssh + settings: + host: foo.com + username: root + password: 1234 + port: 22 ++ envs: + - aws_access_key_id + script: + - export AWS_ACCESS_KEY_ID=$AWS_ACCESS_KEY_ID ``` ## Secret Reference @@ -176,6 +163,9 @@ envs script : execute commands on a remote server +script_stop +: stop script after first failure + timeout : Timeout is the maximum amount of time for the TCP connection to establish.