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

Support passing the endpoint env into containers #1432

Merged
merged 3 commits into from
Dec 17, 2023

Conversation

davidfowl
Copy link
Member

@davidfowl davidfowl commented Dec 16, 2023

This pull request includes various changes to improve the testing and functionality of the codebase. The most important changes include adding new test methods to verify the correct setup of service bindings with container ports and environment variables, and modifying the ApplicationExecutor.cs file to correctly inject environment variables for services produced by an executable resource.

Testing improvements:

  • tests/Aspire.Hosting.Tests/WithServiceBindingTests.cs: Added a new test method to verify the correct addition of a service binding with a container port and environment variable.
  • tests/Aspire.Hosting.Tests/DistributedApplicationTests.cs: Added a new test method to verify that a specified environment variable is correctly set in a service binding.

Code functionality improvements:

  • src/Aspire.Hosting/Dcp/ApplicationExecutor.cs: Added a new private method InjectPortEnvVars to inject environment variables for services produced by an executable resource. Modified ApplyLaunchProfile and CreateExecutablesAsync to call InjectPortEnvVars to ensure the environment variables are injected into the configuration dictionary. [1] [2] [3]

Configuration improvements:

  • src/Aspire.Hosting/Extensions/ContainerResourceBuilderExtensions.cs: Modified the AddContainer and WithServiceBinding extension methods to include an additional parameter for specifying the name of the environment variable to inject.

Fixes #1430

Microsoft Reviewers: Open in CodeFlow

@dotnet-issue-labeler dotnet-issue-labeler bot added the area-codeflow for labeling automated codeflow. intentionally a different color! label Dec 16, 2023
@DamianEdwards
Copy link
Member

Seems straightforward enough. What's missing from making this ready for review/consideration in preview.2? Tests?

@davidfowl
Copy link
Member Author

Seems straightforward enough. What's missing from making this ready for review/consideration in preview.2? Tests?

Yes, tests. I'll probably do a basic test that makes sure things are set and manual end to end test.

@davidfowl davidfowl marked this pull request as ready for review December 17, 2023 06:26
@mitchdenny mitchdenny merged commit e714e13 into main Dec 17, 2023
8 checks passed
@mitchdenny mitchdenny deleted the davidfowl/support-env-for-containers branch December 17, 2023 08:53
@mitchdenny
Copy link
Member

/backport to release/8.0-preview2

Copy link
Contributor

Started backporting to release/8.0-preview2: https://github.com/dotnet/aspire/actions/runs/7237470556

@github-actions github-actions bot locked and limited conversation to collaborators Apr 26, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-codeflow for labeling automated codeflow. intentionally a different color!
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Unable to use WithServiceBinding when specifying a port and AsDockerfileInManifest
3 participants