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

pants requires docker_execution to run local only goals over targets that require Docker #20341

Open
ndellosa95 opened this issue Dec 27, 2023 · 0 comments
Labels
backend: Environments {local,docker,remote}._environment-related issues bug

Comments

@ndellosa95
Copy link
Contributor

Describe the bug
Say you have some python unit tests that use a docker_environment without a fallback to local (i.e. they require Docker), but you have docker_execution = false by default set in your pants.toml. If you try and run the fmt or lint goals over these targets you will get the following error:

Engine traceback:
  in `fmt` goal

NoFallbackEnvironmentError: The global option `--docker-execution` is set to false, but the Docker environment `my_app_test_env` is used in my_app/tests/test_configs.pythe `environment` field of targets including , my_app/tests/test_ops.pythe `environment` field of targets including , my_app/tests/test_resources.py.

Either enable the option `--docker-execution`, or set the field `fallback_environment` for the target my_app/tests:environment.

However, these goals don't require docker and if you set docker_execution = true you will get the following warning:

[WARN] The lint goal was called with targets including `my_app/tests/test_configs.py`, `my_app/tests/test_ops.py`, `my_app/tests/test_resources.py` (and others), which specify the environment `my_app_test_env`, which is a `docker_environment`. The lint goal only runs in the local environment. You may experience unexpected behavior.

These goals should just run even if docker_execution = false.

Pants version
2.18.0

OS
MacOS but I believe it is present on both.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backend: Environments {local,docker,remote}._environment-related issues bug
Projects
None yet
Development

No branches or pull requests

2 participants