Skip to content

Commit

Permalink
Merge pull request #127 from amwat/user
Browse files Browse the repository at this point in the history
Let CI override $USER
  • Loading branch information
k8s-ci-robot authored Apr 5, 2021
2 parents 7c02dfd + eaf6331 commit 96ab8c9
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions kubetest2-gce/deployer/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -107,12 +107,11 @@ func (d *deployer) buildEnv() []string {
// which is by default disabled on GCE VMs if USER is root. In order
// for the deployer to work without fuss when run as root (like it
// does by default in Prow) we can simply change USER to be something
// non-root. USER is not always set in a given environment, so the UID
// is checked instead for guaranteed correct information.
if uid := os.Getuid(); uid == 0 {
env = append(env, fmt.Sprintf("USER=%s", "kubetest2"))
// non-root.
if user, ok := os.LookupEnv("USER"); ok && user != "root" {
env = append(env, fmt.Sprintf("USER=%s", user))
} else {
env = append(env, fmt.Sprintf("USER=%s", os.Getenv("USER")))
env = append(env, fmt.Sprintf("USER=%s", "kubetest2"))
}

// kube-up.sh, kube-down.sh etc. use PROJECT as a parameter
Expand Down

0 comments on commit 96ab8c9

Please sign in to comment.