Repo to showcase our needs for the Pants environments feature.
The main goal is to use the pants environments feature to build our pexes and run tests inside custom environments.
- Set which envs should be passed from the host inside environments. Issue: pantsbuild/pants#18577.
- Use Dockerfiles as environments and the abiltiy to specify a stage. Issue: pantsbuild/pants#17714
- Cleanup containers after using them as environments. Issue:
pantsbuild/pants#18307pantsbuild/pants#20153. - Make sure the docker image isn't built or pulled if the test is cached. Issue: pantsbuild/pants#17958.
- Allow the use of
macros inside
__defaults__inBUILDfiles with Pants environments set. Issue: pantsbuild/pants#22376. Example: Moving the__default__block frommyapp/tests/BUILDtomyapp/BUILDresults in this error:InvalidFieldTypeException: The 'extra_env_vars' field in target myapp#__defaults__ must be an iterable of strings (e.g. a list of strings), but was `default_env_vars()` with type `<unrecognized symbol>`.
- You can use the devcontainer configured in
.devcontainer/devcontainer.jsonor take care of the required dependencies like pants and exporting the env in.envmanually. - The images used as environments have to be built beforehand, since it's not
possible to set Dockerfiles as environments yet. Run the script:
scripts/build_environment_images.sh
env_test.py: Checks if the env inside.envexists in your local environment. This one should always pass.env_inside_environment_test.py: Checks if the env exists inside the pants environment. This should pass once the feature is implemented.- Build and check the final images with:
scripts/check_final_images.sh.
- Most targets are categorized by the Gdal lib version used inside the image or environment. This is for testing if the pex was built inside the correct environment.