-
Notifications
You must be signed in to change notification settings - Fork 104
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
Packer unnecessarily injecting environment variables from host with shell provisioner #150
Comments
thanks for the detailed report, i'll try to take a look at this in the next few days |
just pushed a version with updated deps, hopefully this helps! |
Giving it a try :) With the old version of the plugin...
here's an env var which should not be there:
and with the latest...
that's... odd. edit Looks like that comes from this change in the latest version: |
Lemme just...
and try again...
so the unexpected env vars are still there |
When running scripts using the shell provisioner, environment variables from the Packer's parent process are available within running scripts.
From https://www.packer.io/docs/provisioners/shell
There are a bunch of configs related to how environment variables should be injected into a provisioner from Packer, and documented behaviour would appear to be that host env vars shouldn't end up inside the child process unless explicitly configured.
This is how I've seen it work with other plugins, but because of how this particular plugin works I can see how we've ended up with this happening.
This plugin uses v0.2.11 of the plugin SDK
https://github.com/solo-io/packer-plugin-arm-image/blob/master/go.mod#L7
From https://github.com/hashicorp/packer-plugin-sdk/blob/main/CHANGELOG.md, v0.2.12 added some more configuration around env vars, so it may be as simple as updating to the latest version of the SDK and it'll be fixed automatically by that. Or it may be more complex, requiring plugin-specific logic. I'm not entirely sure.
Either way, here's an example packer config:
provision.sh
Packer output:
And those
NOMAD_
env vars above come from the parent process.I'm using:
Lemme know if there's any further information you need, and if there's much we can do about this.
I've been able to work around this issue.
unset TMPDIR
But in the general case, this could cause other unexpected problems
The text was updated successfully, but these errors were encountered: