Open olivercoleman-switchdin opened 11 months ago
Guessing this should also be applied to the extra_env_vars option, if it were to be applied at all.
Here's a fun edge case: I think *
is technically valid as an env var name, e.g. env 'ABC_*_GHI=1' env
includes an ABC_*_GHI=1
line. Thus, supporting glowing here would mean one could not pass through only ABC_*_GHI
, literally (it'd also allow passing through ABC_DEF_GHI
etc.).
This is probably acceptable, though.
Agree this would also be helpful for passing in Terraform environment variables all at once (TF_VAR_*
).
Some kind of prefix matching would be really helpful in the StackStorm repo where I've been adding test-specific-config env vars. So far I have 23 vars listed in pants.toml
[test].extra_env_vars
.
https://github.com/StackStorm/st2/blob/e97b7d2c6efa97a4507e0a2b7aea5ba6da76ac3d/pants.toml#L238-L267
All but 2 of them have the same prefix ST2TESTS_
, so if I could glob/regex or do a prefix match on vars that would vastly simplify the config.
It was bad enough that I had to spend half a day figuring out why environment variables didn't seem to be working in tests executed via pants as one might reasonably expect 🤪 (when digging around just now I noticed there's been some suggestions that this should be the default behaviour, so consider that a secondary request if you will!)
I eventually found the subprocess-environment.env_vars option and added the necessary env vars in there.
This feature request is for adding support for specifying env var names with glob patterns. This would be especially handy for:
AWS_DEFAULT_REGION
,AWS_ACCESS_KEY_ID
, ..., with a singleAWS_*
entry, or*
entry (at least getting closer to the expected behaviour of including all env vars, see whining above ;))