Compare commits

..

10 Commits

Author SHA1 Message Date
Bo-Yi Wu 66579b6dae chore: add proxy variable 2019-05-11 19:51:39 +08:00
Bo-Yi Wu 06609f35cf add key variable
Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com>
2019-05-11 16:50:50 +08:00
Bo-Yi Wu c9771cce78 chore: add variable 2019-05-11 16:49:20 +08:00
Bo-Yi Wu 6088f7da5a chore: update build tag 2019-05-11 16:34:36 +08:00
Bo-Yi Wu 6de8f74170 docs: add ignore list example. 2019-05-11 14:34:40 +08:00
Bo-Yi Wu bb63d55f89 Update README.md 2019-05-09 14:08:52 +08:00
Bo-Yi Wu da44b071c4 chore: switch finished to struct{} for zero allocate (#96) 2019-03-30 07:26:53 +08:00
Bo-Yi Wu a7eddc4b11 docs: fix setting
Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com>
2019-03-11 17:22:33 +08:00
Bo-Yi Wu 813faf56be chore: remove build number 2019-03-10 23:43:06 +08:00
Bo-Yi Wu 4117d2ca30 fix: trigger build fail if error (#94)
fix #93
2019-03-10 23:41:21 +08:00
6 changed files with 49 additions and 38 deletions
+23 -1
View File
@@ -157,15 +157,37 @@ pipeline:
- example1.com
- example2.com
user: ubuntu
password:
from_secret: ssh_password
port: 22
- command_timeout: 120
+ command_timeout: 2m
from_secret: ssh_password
target: /home/deploy/web
source:
- release/*.tar.gz
```
Example configuration for ignore list:
```diff
pipeline:
scp:
image: appleboy/drone-scp
settings:
host:
- example1.com
- example2.com
user: ubuntu
password:
from_secret: ssh_password
port: 22
command_timeout: 2m
target: /home/deploy/web
source:
+ - !release/README.md
- release/*
```
# Parameter Reference
host
+3 -10
View File
@@ -43,11 +43,12 @@ pipeline:
host:
- example1.com
- example2.com
user: ubuntu
username: ubuntu
password:
from_secret: ssh_password
port: 22
- command_timeout: 120
+ command_timeout: 2m
from_secret: ssh_password
target: /home/deploy/web
source:
- release/*.tar.gz
@@ -88,14 +89,6 @@ Build the docker image with the following commands:
$ make docker
```
Please note incorrectly building the image for the correct x64 linux and with
CGO disabled will result in an error when running the Docker image:
```
docker: Error response from daemon: Container command
'/bin/drone-scp' not found or does not exist..
```
## Usage
There are three ways to send notification.
+17 -23
View File
@@ -13,16 +13,15 @@ import (
// Version set at compile-time
var (
Version string
BuildNum string
Version string
)
func main() {
app := cli.NewApp()
app.Name = "Drone SCP"
app.Usage = "Copy files and artifacts via SSH."
app.Copyright = "Copyright (c) 2017 Bo-Yi Wu"
app.Copyright = "Copyright (c) 2019 Bo-Yi Wu"
app.Version = Version
app.Authors = []cli.Author{
{
Name: "Bo-Yi Wu",
@@ -35,23 +34,23 @@ func main() {
cli.StringSliceFlag{
Name: "host, H",
Usage: "Server host",
EnvVar: "PLUGIN_HOST,SCP_HOST,SSH_HOST",
EnvVar: "PLUGIN_HOST,SCP_HOST,SSH_HOST,HOST",
},
cli.StringFlag{
Name: "port, P",
Value: "22",
Usage: "Server port, default to 22",
EnvVar: "PLUGIN_PORT,SCP_PORT,SSH_PORT",
EnvVar: "PLUGIN_PORT,SCP_PORT,SSH_PORT,PORT",
},
cli.StringFlag{
Name: "username, u",
Usage: "Server username",
EnvVar: "PLUGIN_USERNAME,PLUGIN_USER,SCP_USERNAME,SSH_USERNAME",
EnvVar: "PLUGIN_USERNAME,PLUGIN_USER,SCP_USERNAME,SSH_USERNAME,USERNAME",
},
cli.StringFlag{
Name: "password, p",
Usage: "Password for password-based authentication",
EnvVar: "PLUGIN_PASSWORD,SCP_PASSWORD,SSH_PASSWORD",
EnvVar: "PLUGIN_PASSWORD,SCP_PASSWORD,SSH_PASSWORD,PASSWORD",
},
cli.DurationFlag{
Name: "timeout",
@@ -67,7 +66,7 @@ func main() {
cli.StringFlag{
Name: "key, k",
Usage: "ssh private key",
EnvVar: "PLUGIN_KEY,SCP_KEY,SSH_KEY",
EnvVar: "PLUGIN_KEY,SCP_KEY,SSH_KEY,KEY",
},
cli.StringFlag{
Name: "key-path, i",
@@ -77,17 +76,17 @@ func main() {
cli.StringSliceFlag{
Name: "target, t",
Usage: "Target path on the server",
EnvVar: "PLUGIN_TARGET,SCP_TARGET",
EnvVar: "PLUGIN_TARGET,SCP_TARGET,TARGET",
},
cli.StringSliceFlag{
Name: "source, s",
Usage: "scp file list",
EnvVar: "PLUGIN_SOURCE,SCP_SOURCE",
EnvVar: "PLUGIN_SOURCE,SCP_SOURCE,SOURCE",
},
cli.BoolFlag{
Name: "rm, r",
Usage: "remove target folder before upload data",
EnvVar: "PLUGIN_RM,SCP_RM",
EnvVar: "PLUGIN_RM,SCP_RM,RM",
},
cli.StringFlag{
Name: "repo.owner",
@@ -149,7 +148,7 @@ func main() {
cli.StringFlag{
Name: "proxy.ssh-key",
Usage: "private ssh key of proxy",
EnvVar: "PLUGIN_PROXY_SSH_KEY,PLUGIN_PROXY_KEY,PROXY_SSH_KEY",
EnvVar: "PLUGIN_PROXY_SSH_KEY,PLUGIN_PROXY_KEY,PROXY_SSH_KEY,PROXY_KEY",
},
cli.StringFlag{
Name: "proxy.key-path",
@@ -159,23 +158,23 @@ func main() {
cli.StringFlag{
Name: "proxy.username",
Usage: "connect as user of proxy",
EnvVar: "PLUGIN_PROXY_USERNAME,PLUGIN_PROXY_USER,PROXY_SSH_USERNAME",
EnvVar: "PLUGIN_PROXY_USERNAME,PLUGIN_PROXY_USER,PROXY_SSH_USERNAME,PROXY_USERNAME",
Value: "root",
},
cli.StringFlag{
Name: "proxy.password",
Usage: "user password of proxy",
EnvVar: "PLUGIN_PROXY_PASSWORD,PROXY_SSH_PASSWORD",
EnvVar: "PLUGIN_PROXY_PASSWORD,PROXY_SSH_PASSWORD,PROXY_PASSWORD",
},
cli.StringFlag{
Name: "proxy.host",
Usage: "connect to host of proxy",
EnvVar: "PLUGIN_PROXY_HOST,PROXY_SSH_HOST",
EnvVar: "PLUGIN_PROXY_HOST,PROXY_SSH_HOST,PROXY_HOST",
},
cli.StringFlag{
Name: "proxy.port",
Usage: "connect to port of proxy",
EnvVar: "PLUGIN_PROXY_PORT,PROXY_SSH_PORT",
EnvVar: "PLUGIN_PROXY_PORT,PROXY_SSH_PORT,PROXY_PORT",
Value: "22",
},
cli.DurationFlag{
@@ -233,14 +232,9 @@ VERSION:
REPOSITORY:
Github: https://github.com/appleboy/drone-scp
`
app.Version = Version
if BuildNum != "" {
app.Version = app.Version + "+" + BuildNum
}
if err := app.Run(os.Args); err != nil {
log.Println(err)
log.Fatal(err)
}
}
+1 -1
View File
@@ -1,4 +1,4 @@
// +build darwin dragonfly freebsd linux nacl netbsd openbsd solaris
// +build !windows
package main
+3 -1
View File
@@ -1,6 +1,8 @@
package main
import "testing"
import (
"testing"
)
func TestGetRealPath(t *testing.T) {
type args struct {
+2 -2
View File
@@ -237,8 +237,8 @@ func (p *Plugin) Exec() error {
wg := sync.WaitGroup{}
wg.Add(len(p.Config.Host))
errChannel := make(chan error, 1)
finished := make(chan bool, 1)
errChannel := make(chan error)
finished := make(chan struct{})
for _, host := range p.Config.Host {
go func(host string) {
// Create MakeConfig instance with remote username, server address and path to private key.