Skip to content

Commit 02a5120

Browse files
committed
fix: argument passing & skipContainerEnv
1 parent 0e06b0d commit 02a5120

4 files changed

Lines changed: 8 additions & 3 deletions

File tree

cmd/run_pipeline.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ func (cmd *RunPipelineCmd) Run(cobraCmd *cobra.Command, args []string, f factory
147147
// Print upgrade message if new version available
148148
if !cmd.Render {
149149
upgrade.PrintUpgradeMessage(cmd.log)
150-
} else {
150+
} else if cmd.RenderWriter == nil {
151151
cmd.RenderWriter = os.Stdout
152152
}
153153

helper/cmd/proxy_commands/configure.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ func (cmd *ConfigureCmd) Run(_ *cobra.Command, _ []string) error {
5656
for _, c := range cmd.Commands {
5757
filePath := "/usr/local/bin/" + c
5858
executeCommand := fmt.Sprintf(`#!/bin/sh
59-
/tmp/devspacehelper proxy-commands run %s $@`, c)
59+
/tmp/devspacehelper proxy-commands run %s "$@"`, c)
6060
err := ioutil.WriteFile(filePath, []byte(executeCommand), 0777)
6161
if err != nil {
6262
return fmt.Errorf("error writing command '%s': %v", filePath, err)

pkg/devspace/config/versions/latest/schema.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -867,6 +867,9 @@ type ProxyCommand struct {
867867
// LocalCommand can be used to run a different command than specified via the command option. By
868868
// default, this will be assumed to be the same as command.
869869
LocalCommand string `yaml:"localCommand,omitempty" json:"localCommand,omitempty"`
870+
871+
// SkipContainerEnv will not forward the container environment variables to the local command
872+
SkipContainerEnv bool `yaml:"skipContainerEnv,omitempty" json:"skipContainerEnv,omitempty"`
870873
}
871874

872875
type SSH struct {

pkg/devspace/services/proxycommands/server.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,9 @@ func (s *Server) getCommand(sess ssh.Session) (*exec.Cmd, *types.ProxyCommand, e
176176
}
177177

178178
s.log.Debugf("run command '%s %s' locally", c, strings.Join(args, " "))
179-
cmd.Env = append(cmd.Env, command.Env...)
179+
if !reverseCommand.SkipContainerEnv {
180+
cmd.Env = append(cmd.Env, command.Env...)
181+
}
180182
cmd.Env = append(cmd.Env, os.Environ()...)
181183
return cmd, command, nil
182184
}

0 commit comments

Comments
 (0)