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

Permit workload restore to work with new global.json #42606

Merged
merged 8 commits into from
Aug 28, 2024

Conversation

Forgind
Copy link
Member

@Forgind Forgind commented Aug 7, 2024

Fixes #42582

Specifying a workload set version in the global.json file is a supported scenario. If that workload set has not yet been installed, and the user tries to take an action that relies on workloads, we should error and indicate that they should make sure that workload set is installed first via update, install, or restore. We do that correctly, but when the user subsequently restores, we do not escape from the error case and instead direct the user to run restore. We should handle it properly, essentially installing the workload set before we discover which workloads the user needs and installing those.

I haven't tested this properly yet.

Specifying a workload set version in the global.json file is a supported scenario. If that workload set has not yet been installed, and the user tries to take an action that relies on workloads, we should error and indicate that they should make sure that workload set is installed first via update, install, or restore. We do that correctly, but when the user subsequently restores, we do not escape from the error case and instead direct the user to run restore. We should handle it properly, essentially installing the workload set before we discover which workloads the user needs and installing those.
@dotnet-issue-labeler dotnet-issue-labeler bot added Area-Workloads untriaged Request triage from a team member labels Aug 7, 2024
Copy link
Member

@dsplaisted dsplaisted left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We definitely need to fix this (so this should be retargeted to release/9.0.1xx now), but I wonder if there's a way to do it without so much code change. We are going to update the workloads anyway after we discover which ones are needed, so would it make sense to just run an update command before doing the discovery? That seems like it would be a lot simpler.

Also, for testing, consider writing a VM/MSI installation test for this. I think it would work well :-)

@Forgind
Copy link
Member Author

Forgind commented Aug 19, 2024

We definitely need to fix this (so this should be retargeted to release/9.0.1xx now), but I wonder if there's a way to do it without so much code change. We are going to update the workloads anyway after we discover which ones are needed, so would it make sense to just run an update command before doing the discovery? That seems like it would be a lot simpler.

That's what it does? And note that most of the code changes are just taking a bunch of code out of one place in update/install and putting it in a helper method instead so I can call it in two places depending on whether I want to capture the result of the command in a workload history record.

Also, for testing, consider writing a VM/MSI installation test for this. I think it would work well :-)

Yeah; that should be doable.

Specifying a workload set version in the global.json file is a supported scenario. If that workload set has not yet been installed, and the user tries to take an action that relies on workloads, we should error and indicate that they should make sure that workload set is installed first via update, install, or restore. We do that correctly, but when the user subsequently restores, we do not escape from the error case and instead direct the user to run restore. We should handle it properly, essentially installing the workload set before we discover which workloads the user needs and installing those.
@Forgind Forgind requested review from a team as code owners August 19, 2024 19:59
@Forgind Forgind changed the base branch from main to release/9.0.1xx August 19, 2024 20:00
@Forgind Forgind removed request for a team August 19, 2024 20:00
@dsplaisted
Copy link
Member

dotnet-watch.Tests: [Long Running Test] 'Microsoft.DotNet.Watcher.Tests.NoDepsAppTests.RestartProcessOnFileChange', Elapsed: 00:43:28
['dotnet-watch.Tests.dll.1' END OF WORK ITEM LOG: Command timed out, and was killed]

This looks similar to the failure on #42978, though it's a different test that's timing out.

{
InstallSdk();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you need to remove the call to InstallSdk from SetupWorkloadSetInGlobalJson, and add it back in UseGlobalJsonToSpecifyWorkloadSet.

@Forgind Forgind merged commit b35db9c into dotnet:release/9.0.1xx Aug 28, 2024
31 checks passed
@Forgind Forgind deleted the fix-restore-error branch August 28, 2024 18:55
@marcpopMSFT
Copy link
Member

/backport to release/8.0.4xx

Copy link
Contributor

github-actions bot commented Sep 5, 2024

Started backporting to release/8.0.4xx: https://github.com/dotnet/sdk/actions/runs/10726264895

Copy link
Contributor

github-actions bot commented Sep 5, 2024

@marcpopMSFT backporting to release/8.0.4xx failed, the patch most likely resulted in conflicts:

$ git am --3way --empty=keep --ignore-whitespace --keep-non-patch changes.patch

Applying: Permit workload restore to work with new global.json
Applying: move up workload history recorder
error: sha1 information is lacking or useless (src/Cli/dotnet/commands/dotnet-workload/restore/WorkloadRestoreCommand.cs).
error: could not build fake ancestor
hint: Use 'git am --show-current-patch=diff' to see the failed patch
hint: When you have resolved this problem, run "git am --continue".
hint: If you prefer to skip this patch, run "git am --skip" instead.
hint: To restore the original branch and stop patching, run "git am --abort".
hint: Disable this message with "git config advice.mergeConflict false"
Patch failed at 0002 move up workload history recorder
Error: The process '/usr/bin/git' failed with exit code 128

Please backport manually!

Copy link
Contributor

github-actions bot commented Sep 5, 2024

@marcpopMSFT an error occurred while backporting to release/8.0.4xx, please check the run log for details!

Error: git am failed, most likely due to a merge conflict.

@marcpopMSFT
Copy link
Member

@dsplaisted looks like I couldn't just backport this as too much has changed. Let's sync tomorrow in standup and decide if we want to take this or not for servicing. CC @baronfel

@marcpopMSFT
Copy link
Member

Per offline chat, the owrkaround is to run a workload update first (confirmed). We'll document this for now and revisit if we get feedback: dotnet/core#9491

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-Workloads untriaged Request triage from a team member
Projects
None yet
3 participants