Skip to content

Commit

Permalink
run config: add tty option for run steps
Browse files Browse the repository at this point in the history
  • Loading branch information
camandel committed Oct 23, 2019
1 parent a0450a5 commit 393c611
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 2 deletions.
7 changes: 6 additions & 1 deletion internal/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,7 @@ type RunStep struct {
Environment map[string]Value `json:"environment,omitempty"`
WorkingDir string `json:"working_dir"`
Shell string `json:"shell"`
Tty *bool `json:"tty"`
}

type SaveToWorkspaceStep struct {
Expand Down Expand Up @@ -890,7 +891,11 @@ func checkConfig(config *Config) error {
}
step.Name = step.Command[:len]
}

// if tty is omitted its default is true
if step.Tty == nil {
step.Tty = new(bool)
*step.Tty = true
}
case *SaveCacheStep:
for _, content := range step.Contents {
if len(content.Paths) == 0 {
Expand Down
1 change: 1 addition & 0 deletions internal/runconfig/runconfig.go
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,7 @@ fi
rs.Environment = env
rs.WorkingDir = cs.WorkingDir
rs.Shell = cs.Shell
rs.Tty = *cs.Tty
return rs

case *config.SaveToWorkspaceStep:
Expand Down
2 changes: 1 addition & 1 deletion internal/services/executor/executor.go
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ func (e *Executor) doRunStep(ctx context.Context, s *types.RunStep, t *types.Exe
AttachStdin: true,
Stdout: outf,
Stderr: outf,
Tty: true,
Tty: s.Tty,
}

ce, err := pod.Exec(ctx, execConfig)
Expand Down
1 change: 1 addition & 0 deletions services/runservice/types/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -415,6 +415,7 @@ type RunStep struct {
Environment map[string]string `json:"environment,omitempty"`
WorkingDir string `json:"working_dir,omitempty"`
Shell string `json:"shell,omitempty"`
Tty bool `json:"tty,omitempty"`
}

type SaveContent struct {
Expand Down

0 comments on commit 393c611

Please sign in to comment.