chore: change command timeout flag

Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com>
This commit is contained in:
Bo-Yi Wu 2019-03-11 11:33:41 +08:00
parent 89fce5b1d3
commit 1098d26f7e
5 changed files with 46 additions and 24 deletions

View File

@ -17,6 +17,28 @@ information and a listing of the available options please take a look at [the do
![demo](./images/demo2017.05.10.gif)
## Breaking changes
`v1.5.0`: change command timeout flag to `Duration`. See the following setting:
```diff
pipeline:
scp:
image: appleboy/drone-scp
settings:
host:
- example1.com
- example2.com
username: ubuntu
password:
from_secret: ssh_password
port: 22
- command_timeout: 120
+ command_timeout: 2m
script:
- echo "Hello World"
```
## Build or Download a binary
The pre-compiled binaries can be downloaded from [release page](https://github.com/appleboy/drone-ssh/releases). Support the following OS type.

14
go.mod
View File

@ -1,12 +1,10 @@
module github.com/appleboy/drone-ssh
go 1.12
require (
github.com/appleboy/easyssh-proxy v0.0.0-20170516072225-33d87eae3a01
github.com/davecgh/go-spew v1.1.0 // indirect
github.com/joho/godotenv v0.0.0-20161216230537-726cc8b906e3
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/stretchr/testify v0.0.0-20170130113145-4d4bfba8f1d1
github.com/urfave/cli v0.0.0-20170215051705-2526b57c56f3
golang.org/x/crypto v0.0.0-20170413182223-cbc3d0884eac // indirect
golang.org/x/sys v0.0.0-20190303192550-c2f5717e611c // indirect
github.com/appleboy/easyssh-proxy v1.2.0
github.com/joho/godotenv v1.3.0
github.com/stretchr/testify v1.3.0
github.com/urfave/cli v1.20.0
)

25
go.sum
View File

@ -1,16 +1,17 @@
github.com/appleboy/easyssh-proxy v0.0.0-20170516072225-33d87eae3a01 h1:F7XJNUrMJTvV2TXiHndZWSpyLCGuc+TqQ46SYKE7I0Q=
github.com/appleboy/easyssh-proxy v0.0.0-20170516072225-33d87eae3a01/go.mod h1:bQbHdUQpAmc4Nv22/0slLXWdllbncGfA9ALkPuCe704=
github.com/appleboy/easyssh-proxy v1.2.0 h1:KvaUGC18WkBFet+N1oofQy03jkC5HaKFn2XGxFxCTtg=
github.com/appleboy/easyssh-proxy v1.2.0/go.mod h1:vHskChUNhxwW4dXMe2MNE/k+UBCkBagrQDm70UWZrS0=
github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8=
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/joho/godotenv v0.0.0-20161216230537-726cc8b906e3 h1:zShOjUfrFegEHgln4TPkWk3KkN9sug3Es3Ml6YpgFJI=
github.com/joho/godotenv v0.0.0-20161216230537-726cc8b906e3/go.mod h1:7hK45KPybAkOC6peb+G5yklZfMxEjkZhHbwpqxOKXbg=
github.com/joho/godotenv v1.3.0 h1:Zjp+RcGpHhGlrMbJzXTrZZPrWj+1vfm90La1wgB6Bhc=
github.com/joho/godotenv v1.3.0/go.mod h1:7hK45KPybAkOC6peb+G5yklZfMxEjkZhHbwpqxOKXbg=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/stretchr/testify v0.0.0-20170130113145-4d4bfba8f1d1 h1:Zx8Rp9ozC4FPFxfEKRSUu8+Ay3sZxEUZ7JrCWMbGgvE=
github.com/stretchr/testify v0.0.0-20170130113145-4d4bfba8f1d1/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
github.com/urfave/cli v0.0.0-20170215051705-2526b57c56f3 h1:XXFtT/u0D9gLQ7Cw/xA8KLFXegCx9Sxq1wUKosSkhYE=
github.com/urfave/cli v0.0.0-20170215051705-2526b57c56f3/go.mod h1:70zkFmudgCuE/ngEzBv17Jvp/497gISqfk5gWijbERA=
golang.org/x/crypto v0.0.0-20170413182223-cbc3d0884eac h1:XuNEIEGF9/ewb6jVpjEjwb46FsNjTtgWCseDgY136n0=
golang.org/x/crypto v0.0.0-20170413182223-cbc3d0884eac/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4=
golang.org/x/sys v0.0.0-20190303192550-c2f5717e611c h1:AXm9RSDBofvoECjrx/I1fceu1mdoJP5zCjxjsOmyGgI=
golang.org/x/sys v0.0.0-20190303192550-c2f5717e611c/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/testify v1.3.0 h1:TivCn/peBQ7UY8ooIcPgZFpTNSz0Q2U6UrFlUfqbe0Q=
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
github.com/urfave/cli v1.20.0 h1:fDqGv3UG/4jbVl/QkFwEdddtEDjh/5Ov6X+0B/3bPaw=
github.com/urfave/cli v1.20.0/go.mod h1:70zkFmudgCuE/ngEzBv17Jvp/497gISqfk5gWijbERA=
golang.org/x/crypto v0.0.0-20190228161510-8dd112bcdc25 h1:jsG6UpNLt9iAsb0S2AGW28DveNzzgmbXR+ENoPjUeIU=
golang.org/x/crypto v0.0.0-20190228161510-8dd112bcdc25/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a h1:1BGLXjeY4akVXGgbC9HugT3Jv3hCI0z56oJR5vAMgBU=
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=

View File

@ -3,6 +3,7 @@ package main
import (
"fmt"
"os"
"time"
"github.com/appleboy/easyssh-proxy"
"github.com/joho/godotenv"
@ -81,11 +82,11 @@ func main() {
Usage: "connection timeout",
EnvVar: "PLUGIN_TIMEOUT,SSH_TIMEOUT",
},
cli.IntFlag{
cli.DurationFlag{
Name: "command.timeout,T",
Usage: "command timeout",
EnvVar: "PLUGIN_COMMAND_TIMEOUT,SSH_COMMAND_TIMEOUT",
Value: 60,
Value: 60 * time.Second,
},
cli.StringSliceFlag{
Name: "script,s",
@ -200,7 +201,7 @@ func run(c *cli.Context) error {
Host: c.StringSlice("host"),
Port: c.Int("port"),
Timeout: c.Duration("timeout"),
CommandTimeout: c.Int("command.timeout"),
CommandTimeout: c.Duration("command.timeout"),
Script: c.StringSlice("script"),
ScriptStop: c.Bool("script.stop"),
Secrets: c.StringSlice("secrets"),

View File

@ -30,7 +30,7 @@ type (
Host []string
Port int
Timeout time.Duration
CommandTimeout int
CommandTimeout time.Duration
Script []string
ScriptStop bool
Secrets []string