Add variable to set temporary tar upload path (#100)

This commit is contained in:
Ivo Nunes
2019-09-28 09:36:05 +01:00
committed by Bo-Yi Wu
parent 15344d67ae
commit 933b45bc15
2 changed files with 10 additions and 0 deletions
+6
View File
@@ -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"),
+4
View File
@@ -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)