Repository navigation
Support compose variable interpolation, .env, and --env-file - #42318
Draft
ggarzia-MSFT wants to merge 2 commits into
Draft
ggarzia-MSFT wants to merge 2 commits into
ggarzia-MSFT wants to merge 2 commits into
Conversation
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…ose-env # Conflicts: # src/windows/wslc/services/ComposeService.cpp
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary of the Pull Request
Adds Compose variable interpolation to WSLC.
$NAMEand${NAME}in Compose file values are replaced with variables from the process environment, the project's.envfile, or files passed with the new--env-fileglobal option.PR Checklist
Detailed Description of the Pull Request / Additional comments
ComposeEnvironment.cpp, in the session) runs on each document before it is validated:$NAMEand${NAME}are replaced in values; keys are not interpolated.$$produces a literal$, and an unset variable produces an empty string.:-/-defaults,:+/+alternates, and:?/?required checks. The colon forms also treat an empty value as unset.KEY=VALUEentries.--env-filevalue, resolved against the current directory, or<project directory>\.env, when that file exists.KEY=VALUElines,#comments, and an optionalexportprefix.environmententries (KEY:in a map orKEYin a list) take the variable's value when it is set. Otherwise they are passed without a value, leaving the variable unset in the container.wslc.idl: addsWSLCComposeEnvironmentFileand addsEnvironmentandEnvironmentFilestoWSLCComposeDocumentCollection. The interface is internal.wslc-compose-operations.mdwith a new "Variables" section.Stacked on the multi-file compose merge PR (
user/ggarzia/compose-multi-file).Validation Steps Performed
WSLCComposeTests::ComposeVariablesInterpolate,WSLCComposeTests::ComposeVariableErrorsRejected,WSLCCLIExecutionUnitTests::ComposeProject_EnvironmentFiles,WSLCE2EComposeLifecycleTests::WSLCE2E_Compose_InterpolatesDotEnvAndProcessVariablescmake --build . -- -m(x64 Debug): passedpython tools\devops\validate-localization.py: passed