quaint-telephone-89068
01/11/2023, 8:54 PM$VERSION variable and insert it into setup_py()
• Username/Password for a PyPi repository
• (to come) take $VERSION and use it as the docker_image(version= .
It would be much easier if by default these fields could take environment variables by default.
Describe the solution you'd like
An Env 'function' in BUILD files to denote the value of that field is to be taken from an environment variable.
python_distribution(
...
setup_py(
version=Env('VERSION'),
)
)
docker_image(
...
version=Env('VERSION'),
)
pypi_repository(
password=Env('PYPI_PASSWORD')
)
Other Considerations
• If the one of the suggested uses for this is secrets, care must be taken to ensure any caching does not inadvertently store the values.
• What should happen when the variable is unset or 'falsly' in the environment?
Describe alternatives you've considered
Alternatively, these fields could be made to support environment variable interpolation by default. e.g. docker_image(version='${VERSION}').
While this would also work, it would require Pants developers to second-guess/dictate where environment variables might be used and increase the complexity.
pantsbuild/pantsuser
01/11/2023, 8:54 PM