-
Notifications
You must be signed in to change notification settings - Fork 56
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
Pass service description's environment variables to child process #18
Conversation
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.
LGTM thank-you
cmd.Env = os.Environ() | ||
for _, v := range service.Environment { | ||
cmd.Env = append(cmd.Env, v.Name+"="+v.Value) | ||
} |
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.
Thanks for fixing this, Ben. We indeed need a good test for this sort of change.
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.
Ah, and it's also worth checking (and testing) what happens if there's a variable in the environment process which needs to be replaced by something explicit on the service.
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.
Added a test for this: it tests brand new env vars, env vars only set in the parent, and env vars in the parent but overridden in the layer config. I'll do any $PATH
type of interpolation in a subsequent commit.
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.
Thanks!
command: /bin/sh -c "env | grep PEBBLE_ENV_TEST | sort > %s; sleep 300" | ||
environment: | ||
- PEBBLE_ENV_TEST_1: foo | ||
- PEBBLE_ENV_TEST_2: bar bazz |
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.
Nice test.
#12804 This includes the following Pebble fixes: * canonical/pebble#18 - Pass service description's environment variables to child process * canonical/pebble#20 - Change default: start/stop to startup: enabled/disabled
Pretty self-explanatory. Fixes #17