Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Let CI override $USER #127

Merged
merged 1 commit into from
Apr 5, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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