From a80347e6d4ac0e10a8339f33fc89002a3c11e8bc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Carvalho?= Date: Wed, 11 Apr 2018 14:29:24 -0300 Subject: [PATCH] tasks: do not send local environments to sidecar executor --- tasks.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/tasks.go b/tasks.go index 0c916d5..158c15f 100644 --- a/tasks.go +++ b/tasks.go @@ -13,6 +13,7 @@ import ( "regexp" "strings" + "github.com/tsuru/deploy-agent/internal/docker" "github.com/tsuru/deploy-agent/internal/tsuru" "github.com/tsuru/deploy-agent/internal/user" "github.com/tsuru/tsuru/app/bind" @@ -47,7 +48,11 @@ func execScript(cmds []string, envs []bind.EnvVar, w io.Writer, fs Filesystem, e formatedEnv := fmt.Sprintf("%s=%s", env.Name, env.Value) formatedEnvs = append(formatedEnvs, formatedEnv) } - formatedEnvs = append(formatedEnvs, os.Environ()...) + if _, ok := executor.(*docker.Sidecar); !ok { + // local environment variables do not make sense on a docker executor + // since it runs commands in a different container + formatedEnvs = append(formatedEnvs, os.Environ()...) + } for _, cmd := range cmds { execOpts := exec.ExecuteOptions{ Cmd: "/bin/sh",