Re-execute envvar and arg callbacks when restarting resources#7329
Merged
Re-execute envvar and arg callbacks when restarting resources#7329
Conversation
3 tasks
40b15e6 to
1c0cf60
Compare
Member
Author
|
The isinitialized check isn’t needed anymore after the last dcp refactor. Resource is now initialized on every start |
Contributor
|
Need to rewrite this against my refactor #7360 |
Contributor
There was a problem hiding this comment.
Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.
Comments suppressed due to low confidence (4)
src/Aspire.Hosting/Dcp/DcpExecutor.cs:1248
- The variable 'value' is cast to 'string' without checking if it is indeed a 'string'. This could potentially cause a runtime error. Ensure 'value' is a 'string' before casting.
var resolvedValue = value switch
src/Aspire.Hosting/Dcp/DcpExecutor.cs:1258
- The variable 'resolvedValue' is cast to 'string' without checking if it is indeed a 'string'. This could potentially cause a runtime error. Ensure 'resolvedValue' is a 'string' before casting.
specs.Add((string)resolvedValue);
src/Aspire.Hosting/Dcp/DcpExecutor.cs:1221
- [nitpick] The error message 'Failed to apply argument '{ConfigKey}'' should be more specific about which argument failed. Consider including the argument name or value in the message.
resourceLogger.LogCritical(ex, "Failed to apply argument '{ConfigKey}'. A dependency may have failed to start.", value);
src/Aspire.Hosting/Dcp/DcpExecutor.cs:1263
- [nitpick] The error message 'Failed to apply container runtime argument '{ConfigKey}'' should be more specific about which argument failed. Consider including the argument name or value in the message.
resourceLogger.LogCritical(ex, "Failed to apply container runtime argument '{ConfigKey}'. A dependency may have failed to start.", value);
1c0cf60 to
308dbcd
Compare
Member
Author
|
@davidfowl Updated. Please take a look. |
Contributor
|
Where are the conflicts?? |
Contributor
|
Oh @adamint 's change 😄 |
Member
|
😄 |
308dbcd to
3b32398
Compare
Member
Author
|
/azp run |
|
Azure Pipelines successfully started running 1 pipeline(s). |
Member
Author
|
Are these real test failures or no? |
Contributor
|
No, #7448 |
davidfowl
added a commit
that referenced
this pull request
Feb 7, 2025
18 tasks
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
Description
When a resource is first started by DCP it applies envvar and arg settings based on values from callbacks. Restarting a resource now reuses the same code to apply values again.
Also in this PR is a refactor of how callbacks are executed and applied. They're moved to new methods and reused between containers and executables.
Fixes #5879
Checklist
<remarks />and<code />elements on your triple slash comments?breaking-changetemplate):doc-ideatemplate):