-
Notifications
You must be signed in to change notification settings - Fork 658
Update aspire deploy command to use temporary directory as default output path #10642
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
base: main
Are you sure you want to change the base?
Conversation
…tput path Co-authored-by: captainsafia <1857993+captainsafia@users.noreply.github.com>
aspire deploy
command should be updated to use a temporary output directory as the default output path when none is provided as an argument.…f manual GUID approach Co-authored-by: davidfowl <95136+davidfowl@users.noreply.github.com>
Co-authored-by: captainsafia <1857993+captainsafia@users.noreply.github.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
Updates the aspire deploy
command to use temporary directories as the default output path instead of creating a deploy
subdirectory in the current working directory. This change improves isolation between deploy operations and prevents directory clutter.
- Changed default output path generation to use system temporary directories with unique naming
- Added comprehensive unit test to verify the new temporary directory behavior
- Maintains backward compatibility for users specifying custom
--output-path
values
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
File | Description |
---|---|
src/Aspire.Cli/Commands/DeployCommand.cs | Modified GetDefaultOutputPath to generate unique temporary directories using Directory.CreateTempSubdirectory |
tests/Aspire.Cli.Tests/Commands/DeployCommandTests.cs | Added unit test to verify temporary directory usage and validate naming patterns |
@@ -24,7 +24,7 @@ public DeployCommand(IDotNetCliRunner runner, IInteractionService interactionSer | |||
|
|||
protected override string GetOutputPathDescription() => DeployCommandStrings.OutputPathArgumentDescription; | |||
|
|||
protected override string GetDefaultOutputPath(ArgumentResult result) => Path.Combine(Environment.CurrentDirectory, "deploy"); | |||
protected override string GetDefaultOutputPath(ArgumentResult result) => Directory.CreateTempSubdirectory("aspire-deploy-").FullName; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Feels weird that calling this twice will make a new directory. Should this be changed to CreateDefaultOutputPath?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good point! Renamed the method to CreateDefaultOutputPath
to make it clear that it has side effects and creates a new directory each time it's called. This clarifies the semantic difference from a simple getter. Change implemented in commit fd42658.
…e effects Co-authored-by: davidfowl <95136+davidfowl@users.noreply.github.com>
Summary
Updates the
aspire deploy
command to use a temporary output directory as the default when no--output-path
is specified, instead of using{current-directory}/deploy
.Problem
Previously, the
aspire deploy
command would default to creating deployment artifacts in adeploy
subdirectory of the current working directory. This could lead to:Solution
Modified
DeployCommand.GetDefaultOutputPath()
to generate unique temporary directories:Before:
After:
Benefits
Path.GetTempPath()
for platform compatibility--output-path
Example
Testing
DeployCommandUsesTemporaryDirectoryAsDefaultOutputPath
to verify the new behaviorThe change is minimal and surgical - only one line modified in the core functionality while maintaining all existing behavior for users who specify custom output paths.
💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.