Skip to content
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

Project specific env vars from host #20892

Open
ashic opened this issue May 9, 2024 · 0 comments
Open

Project specific env vars from host #20892

ashic opened this issue May 9, 2024 · 0 comments

Comments

@ashic
Copy link

ashic commented May 9, 2024

Is your feature request related to a problem? Please describe.
Currently, to pass env vars from host to tests, we set extra_env_vars, either on the test or in pants.toml. If we have a monorepo with multiple projects, to have the env vars applied to all tests for a project, we set it in pants.toml. But then the extra_env_vars field becomes a giant set of all env vars for all projects.

Describe the solution you'd like
It would be good if there were a way to set the env vars to pass to tests from the host at a per project level. e.g. if the project structure is like this:

root
|--projectA
|------src
|------tests
|------Build
|--projectB
|------src
|------tests
|------Build
|--pants.toml

If we could set something in projectA/Build or similar that would ensure that a set of env vars are passed to the environment when projectA tests are run, and a different set of env vars can be set in projectB/Build that would apply when projectB tests are run.

Describe alternatives you've considered
Josh suggested on the slack channel that something like this might be doable if we set:

python_tests.__defaults__.extra_env_vars

in the relevant Build file. I'll test whether this works, but it would be preferable if there was a more formal way to specify something like this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant