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

fix: append existing env variables to provision cmd #5187

Merged
merged 10 commits into from
Oct 31, 2024

Conversation

lilypan26
Copy link
Contributor

@lilypan26 lilypan26 commented Oct 30, 2024

What type of PR is this?

What this PR does / why we need it:
Noticed scriptless e2es were failing now that bootstrap environment variables are generated in go binary #5176, Fixed by appending existing system environment variables before triggering bootstrap cmd.

Which issue(s) this PR fixes:

Fixes #

Requirements:

Special notes for your reviewer:

Release note:

none

@@ -185,6 +186,7 @@ func BuildCSECmd(ctx context.Context, config *nbcontractv1.Configuration) (*exec
for k, v := range getCSEEnv(config) {
cmd.Env = append(cmd.Env, fmt.Sprintf("%s=%s", k, v))
}
sort.Strings(cmd.Env) // produce deterministic output
cmd.Env = append(cmd.Env, os.Environ()...) // append existing environment variables
Copy link
Contributor

@r2k1 r2k1 Oct 31, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oh, it would take me ages to find this. Good catch. I didn't expect we need env variables from somewhere else.

Btw, I think it should be:

sort.Strings(cmd.Env)
cmd.Env = append(os.Environ(), cmd.Env...)

In some edge cases we may want to override the ENV variable.
And I think the last one is more important

@r2k1 r2k1 changed the base branch from master to dev October 31, 2024 03:27
@r2k1 r2k1 merged commit 4f0281f into dev Oct 31, 2024
12 checks passed
@r2k1 r2k1 deleted the lily/node-bootstrapper-envvar-fix branch October 31, 2024 04:00
lilypan26 added a commit that referenced this pull request Oct 31, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants