fix: enable user configuration of build_command
env vars
#925
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Purpose
Rationale
Primarily to be good stewards of the provided authentication tokens to PSR, we do not blindly pass the entire parent process environment on to the child process of the build. However, as #922 mentioned, there is a legitimate need to pass some user-defined environment variables on to the
build_command
child process. This happy median is to provide abuild_command_env
configuration option that will handle definitions of either hardcoded values or variables desired to be passed along to the subprocess.How I tested
Added a separate cli test with a
pyproject.toml
configuration that included all the ways users can provide an environment variable. We allow direct pass through, and hardcoded variables (empty or not). I also ran thepsr-test-gha
repo with a build script that would of failed if it didn't receive the proper environment variables and it succeeded.