-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Refactor workload set and workload install/update logic #39991
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
Merged
marcpopMSFT
merged 23 commits into
dotnet:release/8.0.4xx
from
dsplaisted:refactor-workload-sets
Jul 1, 2024
Merged
Changes from 1 commit
Commits
Show all changes
23 commits
Select commit
Hold shift + click to select a range
513a744
Refactor workload update and install commands
dsplaisted a571bba
Handle different workload update / install scenarios
dsplaisted c10f8df
Add Aspire test
dsplaisted 5c6bf09
Roll back install state changes on workload install / update failures
dsplaisted b2ed34c
Fix workload set version prerelease handling
dsplaisted 80557a6
Move WorkloadSetVersionToWorkloadSetPackageVersion to WorkloadSet class
dsplaisted 45d2e5b
Support loading workload sets from different feature bands
dsplaisted 22452a2
Fix issue where on some machines, VM snapshots couldn't be found
dsplaisted e47104b
Fix some tests not to skip manifest updates when installing workloads
dsplaisted e2b177f
Don't try to roll back installation of workload set package that wasn…
dsplaisted d316d96
Don't update pinned workload set on install, refactor InstallingWorkl…
dsplaisted 768ec44
Fix some cases of pinning / unpinning workload version in global inst…
dsplaisted 42019de
Add message for workload set installation failure
dsplaisted 1d87f96
Remove unused isRollback parameter
dsplaisted 515544c
Resolve TODOs in WorkloadInstallCommand
dsplaisted 4bb9d50
Refactor ManifestVersionUpdate
dsplaisted 49a9b98
Fix tests
dsplaisted 0742587
Apply code review feedback
dsplaisted e6e20ad
Fix tests
dsplaisted 708f383
Add tests for --skip-manifest-update, switch to robocopy for VM direc…
dsplaisted 904eb64
Fix issue garbage collecting cross-feature band workload set, add err…
dsplaisted 62c9743
Apply code review feedback and fix test
dsplaisted 979ac00
Fix combinations of workload install, global install state, and globa…
dsplaisted File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -247,7 +247,6 @@ void SetupWorkloadSetInGlobalJson(out WorkloadSet originalRollback) | |
| result.StdErr.Should().Contain(versionToUpdateTo); | ||
|
|
||
| AddNuGetSource(@"C:\SdkTesting\workloadsets", SdkTestingDirectory); | ||
|
|
||
| } | ||
|
|
||
| [Fact] | ||
|
|
@@ -294,6 +293,52 @@ public void InstallWithVersionAndSkipManifestUpdate() | |
| .And.HaveStdErrContaining("--sdk-version"); | ||
| } | ||
|
|
||
| [Fact] | ||
| public void InstallWithVersionWhenPinned() | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is the perfect test for testing this change. Simple, elegant, and it works. It'd be nice to make it run in CI, but this should be fine. |
||
| { | ||
| InstallSdk(); | ||
|
|
||
| AddNuGetSource(@"c:\SdkTesting\WorkloadSets"); | ||
|
|
||
| string originalVersion = GetWorkloadVersion(); | ||
| originalVersion.Should().NotBe("8.0.300-preview.0.24178.1"); | ||
|
|
||
| VM.CreateRunCommand("dotnet", "workload", "update", "--version", "8.0.300-preview.0.24178.1") | ||
| .Execute().Should().Pass(); | ||
|
|
||
| GetWorkloadVersion().Should().Be("8.0.300-preview.0.24178.1"); | ||
|
|
||
| VM.CreateRunCommand("dotnet", "workload", "install", "aspire", "--version", "8.0.300-preview.0.24217.2") | ||
| .Execute().Should().Pass(); | ||
|
|
||
| GetWorkloadVersion().Should().Be("8.0.300-preview.0.24217.2"); | ||
| } | ||
|
|
||
| [Fact] | ||
| public void InstallWithGlobalJsonWhenPinned() | ||
| { | ||
| SetupWorkloadSetInGlobalJson(out var originalRollback); | ||
|
|
||
| //AddNuGetSource(@"c:\SdkTesting\WorkloadSets"); | ||
|
|
||
| string originalVersion = GetWorkloadVersion(); | ||
| originalVersion.Should().NotBe("8.0.300-preview.0.24178.1"); | ||
|
|
||
| VM.CreateRunCommand("dotnet", "workload", "update", "--version", "8.0.300-preview.0.24178.1") | ||
| .Execute().Should().Pass(); | ||
|
|
||
| GetWorkloadVersion().Should().Be("8.0.300-preview.0.24178.1"); | ||
|
|
||
| VM.CreateRunCommand("dotnet", "workload", "install", "aspire") | ||
| .WithWorkingDirectory(SdkTestingDirectory) | ||
| .Execute().Should().Pass(); | ||
|
|
||
| GetWorkloadVersion(SdkTestingDirectory).Should().Be("8.0.300-preview.0.24217.2"); | ||
|
|
||
| GetRollback(SdkTestingDirectory).Should().NotBe(originalRollback); | ||
|
|
||
| } | ||
|
|
||
| [Fact] | ||
| public void UpdateShouldNotPinWorkloadSet() | ||
| { | ||
|
|
||
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.
Uh oh!
There was an error while loading. Please reload this page.
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.
Shouldn't there be more conditions here for other reasons to require a manifest update?
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.
clarification: consider adding string.isnull checks for --version inputs and global.json version inputs to be complete
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.
Ping on this one
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.
Are you saying that you think we should skip manifest update if
--sdk-versionis specified or if there's a workload version in global.json? In those cases we do want to call theUpdateWorkloadManifestsmethod. That method is responsible for respecting the version from--sdk-versionor global.json. If a version was specified in either of those ways, then it will install those versions.So I think the logic is correct, let me know if there's a case I'm missing.
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 opposite: I think we should never skip manifest updates if either of those is specified. This if statement currently says that if rollback is not specified, and there is something pinned in the install state file, then we do skip manifest updates, which is wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.
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 explanation as I understand it is that forgind is saying that if we already have an install state, this logic will skip workload updates even if you have a global.json or --version specified (which could be different than what is in the install state). So I think you are agreeing with each other. Daniel, I think you're implying that UpdateWorkloadManifests would end up getting called for those cases which I think is true the first time a customer does it but any subsequent times after having an install state, I think forgind may be right unless I'm missing a code path that calls it elsewhere.
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.
Thanks, I think I get it now. I will try to add a test to validate the behavior and then update the logic. I'm not sure how quickly I'll be able to do that though.
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.
Should be fixed now