-
Notifications
You must be signed in to change notification settings - Fork 116
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 HELM_HOME handling for v3 #1076
Conversation
if (opts.devel === true) { flags.push(`--devel`); } | ||
if (opts.prov === true) { flags.push(`--prov`); } | ||
if (opts.verify === true) { flags.push(`--verify`); } | ||
} | ||
execSync(`helm fetch ${shell.quote([chart])} ${flags.join(" ")}`); | ||
execSync(`helm fetch ${shell.quote([chart])} ${flags.join(" ")}`, { env }); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are we sure we want to pass all env variables as opposed to passing HELM_HOME
specifically? Is there a combination of env variables that would change the behavior of helm between two Pulumi versions, and therefore break somebody?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I suppose it's possible. The advantage of passing everything is that it makes it easier for users to configure Helm behavior without requiring us to change code, but maybe it would be better to limit the change here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The default for execSync
was to pass process.env
down to the subprocess. So I think we should keep that behaviour by default (and add HELM_HOME
).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Indeed! The same applies to .NET, actually, if I read the docs correctly. Therefore, we can simplify the PR and not retrieve/pass env variables, only add HELM_HOME
if needed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@lukehoban This comment indicates that setting env
only sets the passed values, which is why I copied process.env
explicitly.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@lblackstone That makes sense to me. I think we don't need to retrieve/pass them for .NET - just add the extra one.
@mikhailshilkov Any idea on this error?
|
const yamlStream = execSync( | ||
cmd, | ||
{ | ||
env: {...process.env}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Isn't this the default already?
if (opts.devel === true) { flags.push(`--devel`); } | ||
if (opts.prov === true) { flags.push(`--prov`); } | ||
if (opts.verify === true) { flags.push(`--verify`); } | ||
} | ||
execSync(`helm fetch ${shell.quote([chart])} ${flags.join(" ")}`); | ||
execSync(`helm fetch ${shell.quote([chart])} ${flags.join(" ")}`, { env }); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The default for execSync
was to pass process.env
down to the subprocess. So I think we should keep that behaviour by default (and add HELM_HOME
).
Hmm, I suspect we screwed up environment variables related to paths somehows. I think we should revert to not passing all the env variables explicitly and only pass |
a1a9b86
to
326e6a1
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we have any way to test this?
The changes look good to me - but there is enough subtlety here that it would be great if we could lock this in with test coverage.
I specified the |
Proposed changes
Helm v3 removed the
--home
parameter, but still supports theHELM_HOME
env var for backward compatibility. Pass ambient env vars to thehelm
binary so this works properly.TODO:
Related issues (optional)
Fix #1070