mirror of
https://github.com/appleboy/drone-scp.git
synced 2026-06-04 18:23:59 +08:00
Add variable to set temporary tar upload path (#100)
This commit is contained in:
@@ -193,6 +193,11 @@ func main() {
|
||||
EnvVar: "PLUGIN_TAR_EXEC,SCP_TAR_EXEC,INPUT_TAR_EXEC",
|
||||
Value: "tar",
|
||||
},
|
||||
cli.StringFlag{
|
||||
Name: "tar.tmp-path",
|
||||
Usage: "Temporary path for tar file on the dest host",
|
||||
EnvVar: "PLUGIN_TAR_TMP_PATH,SCP_TAR_TMP_PATH",
|
||||
},
|
||||
cli.BoolFlag{
|
||||
Name: "debug",
|
||||
Usage: "remove target folder before upload data",
|
||||
@@ -273,6 +278,7 @@ func run(c *cli.Context) error {
|
||||
Debug: c.Bool("debug"),
|
||||
StripComponents: c.Int("strip.components"),
|
||||
TarExec: c.String("tar.exec"),
|
||||
TarTmpPath: c.String("tar.tmp-path"),
|
||||
Proxy: easyssh.DefaultConfig{
|
||||
Key: c.String("proxy.ssh-key"),
|
||||
KeyPath: c.String("proxy.key-path"),
|
||||
|
||||
@@ -58,6 +58,7 @@ type (
|
||||
Remove bool
|
||||
StripComponents int
|
||||
TarExec string
|
||||
TarTmpPath string
|
||||
Proxy easyssh.DefaultConfig
|
||||
Debug bool
|
||||
}
|
||||
@@ -285,6 +286,9 @@ func (p *Plugin) Exec() error {
|
||||
},
|
||||
}
|
||||
|
||||
// upload file to the tmp path
|
||||
p.DestFile = fmt.Sprintf("%s%s", p.Config.TarTmpPath, p.DestFile)
|
||||
|
||||
// Call Scp method with file you want to upload to remote server.
|
||||
p.log(host, "scp file to server.")
|
||||
err := ssh.Scp(tar, p.DestFile)
|
||||
|
||||
Reference in New Issue
Block a user