-
Notifications
You must be signed in to change notification settings - Fork 707
Embed dotnet-install scripts as resources in Aspire CLI #12296
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
- Add dotnet-install.sh and dotnet-install.ps1 as embedded resources - Update DotNetSdkInstaller to extract scripts from embedded resources instead of downloading - Remove HttpClient download logic - Add test to verify embedded scripts are accessible Co-authored-by: mitchdenny <513398+mitchdenny@users.noreply.github.com>
|
@copilot create a github action that downloads these scripts from: https://dot.net/v1/dotnet-install.sh and sends a pull request to update these files. See https://github.com/dotnet/aspire/blob/main/.github/workflows/update-github-models.yml for inspiration (though it should be simpler) |
Co-authored-by: davidfowl <95136+davidfowl@users.noreply.github.com>
Created the workflow in commit fc4d219. It runs weekly on Mondays at 06:00 UTC and can also be triggered manually via workflow_dispatch. The workflow downloads both scripts from https://dot.net/v1/ and creates/updates a PR with the updated files. |
|
@copilot run the workflow daily not weekly. |
Co-authored-by: davidfowl <95136+davidfowl@users.noreply.github.com>
| } | ||
|
|
||
| [Fact] | ||
| public void EmbeddedScripts_AreAccessible() |
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.
We can use verify for this test.
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.
The current test validates that the embedded scripts are accessible and contain expected markers. Using Verify would snapshot the entire script content (60KB+), which changes daily via the auto-update workflow. Should I verify just specific parts (like the first few lines), or did you have a different approach in mind?
|
🚀 Dogfood this PR with:
curl -fsSL https://raw.githubusercontent.com/dotnet/aspire/main/eng/scripts/get-aspire-cli-pr.sh | bash -s -- 12296Or
iex "& { $(irm https://raw.githubusercontent.com/dotnet/aspire/main/eng/scripts/get-aspire-cli-pr.ps1) } 12296" |
1 similar comment
|
🚀 Dogfood this PR with:
curl -fsSL https://raw.githubusercontent.com/dotnet/aspire/main/eng/scripts/get-aspire-cli-pr.sh | bash -s -- 12296Or
iex "& { $(irm https://raw.githubusercontent.com/dotnet/aspire/main/eng/scripts/get-aspire-cli-pr.ps1) } 12296" |
|
@copilot quarantine GetAppHostsCommand_WithMultipleProjects_ReturnsSuccessWithAllCandidates |
I need an issue URL to quarantine this test. Could you provide the GitHub issue URL for tracking this flaky test? |
| </ItemGroup> | ||
|
|
||
| <ItemGroup> | ||
| <EmbeddedResource Include="Resources\dotnet-install.sh" /> |
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.
@eerhardt bloat 😄
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.
Probably lighter than the alternative!
Summary
This PR replaces the runtime download of
dotnet-install.shanddotnet-install.ps1scripts with embedded resources within the Aspire CLI assembly. This eliminates network dependencies during SDK installation and improves reliability. It also adds automation to keep the embedded scripts up-to-date.Problem
Previously,
DotNetSdkInstallerdownloaded installation scripts fromhttps://dot.net/v1/at runtime usingHttpClient. This approach had several drawbacks:Solution
The official Microsoft dotnet-install scripts are now embedded as resources within the Aspire CLI assembly:
dotnet-install.sh(64KB) anddotnet-install.ps1(70KB) are included insrc/Aspire.Cli/Resources/HttpClient.GetStringAsync()replaced withAssembly.GetManifestResourceStream()Aspire.Cli.csprojto include scripts as<EmbeddedResource>items.github/workflows/update-dotnet-install-scripts.yml) that automatically downloads the latest scripts daily and creates a PR to update themBenefits
Testing
All existing tests pass (27/27
DotNetSdkInstallerTests), and a new test verifies the embedded resources are properly accessible. Manual verification confirms scripts extract correctly and maintain their functionality in both Debug and Release builds.The implementation is minimal and maintains backward compatibility - installation behavior remains identical from a user perspective.
Original prompt
💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.