-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Add CLI option to add env vars using "-e" for cloud/clustered execution #467
Comments
I'll soon submit a pull request for this issue, but here are some pertinent excepts from an email discussion with @robingustafsson about some changes in the implementation details from the original issue description:
And a follow-up question by me:
With the following answer from Robin:
And about an extra flag that disables the passing of system environment variables entirely:
I probably should have asked the questions directly in this issue in the first place... In any case, I decided to copy the discussion here because due to it my implementation deviates from the original issue text (ex. |
Today k6 exposes the machine's environment variables to JS via the global variable
__ENV
when running a test locally. But, when running in the cloud it doesn't make sense to read the environment variables of the local node (in a clustered mode it might still make sense).I suggest we add a CLI option
-e MY_ENV_VAR=hello
(that can be specified multiple times) to therun
andcloud
commands (by adding the option theoptionFlagSet
[1]) and save the env vars in the Options [2] and then either add the them to__ENV
for the local execution case or store them in the "metadata.json" file that is part of the archive [3] created when triggering a cloud executed test (the env vars will then be made available through__ENV
on each cloud node).[1] - https://github.com/loadimpact/k6/blob/master/cmd/options.go
[2] - https://github.com/loadimpact/k6/blob/master/lib/options.go
[3] - https://github.com/loadimpact/k6/blob/master/lib/archive.go
The text was updated successfully, but these errors were encountered: