From 6d7410cfce449b07c3c51666dcdc6a43fdbef520 Mon Sep 17 00:00:00 2001 From: Simone Gotti Date: Wed, 11 Sep 2019 14:41:53 +0200 Subject: [PATCH] runservice: remove run step user Defining an option to override the user for a run step is too much fine grained and, for consistency, will require to do the same also for the other steps (clone, *workspace etc...). Remove it since it's probably enough to define it at the task level. --- internal/config/config.go | 1 - internal/runconfig/runconfig.go | 1 - internal/services/executor/executor.go | 5 +---- services/runservice/types/types.go | 1 - 4 files changed, 1 insertion(+), 7 deletions(-) diff --git a/internal/config/config.go b/internal/config/config.go index d9012c6..91f36e4 100644 --- a/internal/config/config.go +++ b/internal/config/config.go @@ -151,7 +151,6 @@ type RunStep struct { Environment map[string]Value `json:"environment,omitempty"` WorkingDir string `json:"working_dir"` Shell string `json:"shell"` - User string `json:"user"` } type SaveToWorkspaceStep struct { diff --git a/internal/runconfig/runconfig.go b/internal/runconfig/runconfig.go index 9a6957d..a695f94 100644 --- a/internal/runconfig/runconfig.go +++ b/internal/runconfig/runconfig.go @@ -115,7 +115,6 @@ fi rs.Environment = env rs.WorkingDir = cs.WorkingDir rs.Shell = cs.Shell - rs.User = cs.User return rs case *config.SaveToWorkspaceStep: diff --git a/internal/services/executor/executor.go b/internal/services/executor/executor.go index 0297dae..c60d2a7 100644 --- a/internal/services/executor/executor.go +++ b/internal/services/executor/executor.go @@ -117,14 +117,11 @@ func (e *Executor) doRunStep(ctx context.Context, s *types.RunStep, t *types.Exe shell = s.Shell } - // try to use the container specified user + // use the container specified user and override with task user if defined user := t.Containers[0].User if t.User != "" { user = t.User } - if s.User != "" { - user = s.User - } var cmd []string if s.Command != "" { diff --git a/services/runservice/types/types.go b/services/runservice/types/types.go index b6a51e5..2d8e57f 100644 --- a/services/runservice/types/types.go +++ b/services/runservice/types/types.go @@ -413,7 +413,6 @@ type RunStep struct { Environment map[string]string `json:"environment,omitempty"` WorkingDir string `json:"working_dir,omitempty"` Shell string `json:"shell,omitempty"` - User string `json:"user,omitempty"` } type SaveContent struct {