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

[FIX] tool-install: Use restore action config options #44309

Merged
merged 2 commits into from
Oct 28, 2024

Conversation

edvilme
Copy link
Member

@edvilme edvilme commented Oct 18, 2024

Addresses https://devdiv.visualstudio.com/DevDiv/_workitems/edit/2221478

If user has an invalid PackageSource on NuGet.config and attempts to install a tool with the --ignore-failed-sources attribute, it still outputs an error.

RestoreActionConfig needs to be passed down to NuGetPackageDownloader

@dotnet-issue-labeler dotnet-issue-labeler bot added Area-Tools untriaged Request triage from a team member labels Oct 18, 2024
@edvilme edvilme marked this pull request as ready for review October 18, 2024 18:29
@edvilme edvilme requested a review from a team October 18, 2024 18:34
@nagilson nagilson self-requested a review October 18, 2024 19:56
@edvilme
Copy link
Member Author

edvilme commented Oct 18, 2024

Should also address #36473

Copy link
Member

@nagilson nagilson left a comment

Choose a reason for hiding this comment

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

I tried this and it didn't seem to fix the issue for tool install or tool restore.
image

Let me know if you want to investigate together.
dotnet tool update dotnet-sos --add-source "c:\Users\***\downloads" --global --ignore-failed-sources

I used the failed source which you had provided.

I would also suggest you add a test like we discussed

@edvilme
Copy link
Member Author

edvilme commented Oct 22, 2024

Missed adding the RestoreActionConfig to some other methods. It should be working fine now
image

@nagilson
Copy link
Member

nagilson commented Oct 22, 2024

@baronfel Do we want to backport this to 8.0 once its good? I believe we should. Probably 8.0.3xx?

@baronfel
Copy link
Member

When was the regression introduced?

Copy link
Member

@nagilson nagilson left a comment

Choose a reason for hiding this comment

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

Fantastic job figuring the correct changes out and also investigating the tests :)
I have a remaining comment I'd like to hear on before we can merge this. There's also that final test you're working on. But the change itself looks great!

@nagilson
Copy link
Member

When was the regression introduced?

Sometime between .NET 8 RC2 and .NET 7, most likely rc2

@baronfel
Copy link
Member

Ok then I'd say we should backport all the way back to 8.0.1xx so that source build gets it too.

@edvilme
Copy link
Member Author

edvilme commented Oct 22, 2024

Fantastic job figuring the correct changes out and also investigating the tests :) I have a remaining comment I'd like to hear on before we can merge this. There's also that final test you're working on. But the change itself looks great!

Thanks a lot! And thanks a lot for all the support.
I also had the concern on the internal vs private, I am happy to look into how the mock pattern as to not expose this unnecessarily. Let me know :)

I have also added the tests to check if the flag works correctly (aka, it does not throw when the feeds are invalid and the --ignore-failed-sources flag is used

@edvilme
Copy link
Member Author

edvilme commented Oct 23, 2024 via email

@dsplaisted
Copy link
Member

Maybe we can use https://api.nuget.org/v3/invalid.json ? That way we at least have some more influence/knowledge on what goes on with the url

Yes, that seems like a good idea so that it's a domain we control.

Copy link
Member

@nagilson nagilson left a comment

Choose a reason for hiding this comment

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

All of my comments are resolved now, so this should be good to go. while the blazor wasm test failure is not related to your change, it does look like one remaining test is failing.

I would suggest you prioritize this issue above all else because it seems to impact the most customers.

After that, I would backport your changes to release/8.0.1xx. Don't merge that PR until you get tactics approval and then approval after that to confirm the branch and release is open for changes. You can use the bot to create backports: #43607 (comment) Like how I did here. In that linked backport PR is a template to get tactics approval. Youll need to fill that out and do manual testing to verify that the fix worked on 8.0.1xx as well.

After that, youll need to send an email to the .NET Tactics alias with the same information asking for approval and add the label 'servicing-consider.' Definitely reach out to confirm once youve gotten it all written up or if you have questions 😄

@nagilson
Copy link
Member

nagilson commented Oct 23, 2024

All of my comments are resolved now, so this should be good to go. while the blazor wasm test failure is not related to your change, it does look like one remaining test is failing.

I would suggest you prioritize this issue above all else because it seems to impact the most customers.

After that, I would backport your changes to release/8.0.1xx. Don't merge that PR until you get tactics approval and then approval after that to confirm the branch and release is open for changes. You can use the bot to create backports: #43607 (comment) Like how I did here. In that linked backport PR is a template to get tactics approval. Youll need to fill that out and do manual testing to verify that the fix worked on 8.0.1xx as well. After that, youll need to send an email to the .NET Tactics alias with the same information asking for approval and add the label 'servicing-consider.'

By the way, why are we doing all of this... this was broken starting in 8.0 and most people are going to be on 8.0 since its the latest stable and long term support version of .NET. We want them to get this fix because it's important. But because its a stable and already released build, the quality / QA check bar is a lot higher, so we have a process in place for these changes

@edvilme edvilme force-pushed the edvilme-tool-ignore-failed-sources branch from b6340f9 to 16d81f8 Compare October 24, 2024 18:00
@edvilme
Copy link
Member Author

edvilme commented Oct 24, 2024

it does look like one remaining test is failing

Hello. Yes, I pushed a fix recently and it should be passing now on the ci/cd. I am rebasing and squashing the commits to avoid having lots of little commits.

@nagilson
Copy link
Member

image
You can squah and merge the PR without having to rebase or do any extra work by clicking on this button 😉

@/rainersigwald is very good about having a clean PR history and always squashing but our team is much less loose on that sort of thing. I would generally recommend to squash and merge the PR using the GitHub option.

Force-pushing makes it harder to review the PR, because all of the existing changes get wiped away and the order of commits are lost, so it makes it so the entire PR needs to be reviewed again. This also saves you from having to wait for the pipeline to run again, and also if there is some other test that keeps failing that's not your fault, you dont have to deal with it a second/third/etc time~

Copy link
Member

@nagilson nagilson left a comment

Choose a reason for hiding this comment

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

Let's :shipit: merge :shipit:
(and also backport) (this change is going to make a lot of people happy)

@edvilme
Copy link
Member Author

edvilme commented Oct 24, 2024

/backport to to release/8.0.1xx

Copy link
Contributor

Started backporting to to: https://github.com/dotnet/sdk/actions/runs/11505684487

Copy link
Contributor

@edvilme an error occurred while backporting to to, please check the run log for details!

Error: @edvilme is not a repo collaborator, backporting is not allowed. If you're a collaborator please make sure your dotnet team membership visibility is set to Public on https://github.com/orgs/dotnet/people?query=edvilme

@edvilme
Copy link
Member Author

edvilme commented Oct 24, 2024

/backport to to release/8.0.1xx

Copy link
Contributor

Started backporting to to: https://github.com/dotnet/sdk/actions/runs/11506674169

Copy link
Contributor

@edvilme an error occurred while backporting to to, please check the run log for details!

Error: The specified backport target branch to wasn't found in the repo.

@edvilme
Copy link
Member Author

edvilme commented Oct 24, 2024

/backport to release/8.0.1xx

Copy link
Contributor

Started backporting to release/8.0.1xx: https://github.com/dotnet/sdk/actions/runs/11507297518

Copy link
Contributor

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

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

Applying: [FIX] tool-install: Use config options
Using index info to reconstruct a base tree...
M	eng/dogfood.sh
M	src/Cli/dotnet/ToolPackage/IToolPackageDownloader.cs
M	src/Cli/dotnet/ToolPackage/ToolPackageDownloader.cs
M	src/Cli/dotnet/commands/dotnet-tool/install/ToolInstallGlobalOrToolPathCommand.cs
M	src/Cli/dotnet/commands/dotnet-tool/install/ToolInstallLocalCommand.cs
M	src/Cli/dotnet/commands/dotnet-tool/install/ToolInstallLocalInstaller.cs
A	test/Microsoft.DotNet.Tools.Tests.ComponentMocks/ToolPackageDownloaderMock.cs
A	test/dotnet.Tests/CommandTests/ToolInstallGlobalOrToolPathCommandTests.cs
A	test/dotnet.Tests/CommandTests/ToolInstallLocalCommandTests.cs
Falling back to patching base and 3-way merge...
Auto-merging src/Tests/dotnet.Tests/CommandTests/ToolInstallLocalCommandTests.cs
Auto-merging src/Tests/dotnet.Tests/CommandTests/ToolInstallGlobalOrToolPathCommandTests.cs
Auto-merging src/Tests/Microsoft.DotNet.Tools.Tests.ComponentMocks/ToolPackageDownloaderMock.cs
CONFLICT (content): Merge conflict in src/Tests/Microsoft.DotNet.Tools.Tests.ComponentMocks/ToolPackageDownloaderMock.cs
Auto-merging src/Cli/dotnet/commands/dotnet-tool/install/ToolInstallLocalInstaller.cs
CONFLICT (content): Merge conflict in src/Cli/dotnet/commands/dotnet-tool/install/ToolInstallLocalInstaller.cs
Auto-merging src/Cli/dotnet/commands/dotnet-tool/install/ToolInstallLocalCommand.cs
CONFLICT (content): Merge conflict in src/Cli/dotnet/commands/dotnet-tool/install/ToolInstallLocalCommand.cs
Auto-merging src/Cli/dotnet/commands/dotnet-tool/install/ToolInstallGlobalOrToolPathCommand.cs
CONFLICT (content): Merge conflict in src/Cli/dotnet/commands/dotnet-tool/install/ToolInstallGlobalOrToolPathCommand.cs
Auto-merging src/Cli/dotnet/ToolPackage/ToolPackageDownloader.cs
CONFLICT (content): Merge conflict in src/Cli/dotnet/ToolPackage/ToolPackageDownloader.cs
Auto-merging src/Cli/dotnet/ToolPackage/IToolPackageDownloader.cs
CONFLICT (content): Merge conflict in src/Cli/dotnet/ToolPackage/IToolPackageDownloader.cs
Auto-merging eng/dogfood.sh
CONFLICT (content): Merge conflict in eng/dogfood.sh
error: Failed to merge in the changes.
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 0001 [FIX] tool-install: Use config options
Error: The process '/usr/bin/git' failed with exit code 128

Please backport manually!

Copy link
Contributor

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

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

@edvilme
Copy link
Member Author

edvilme commented Oct 25, 2024

Note: because of very big differences between the branches, this cannot be cherrypicked or backported automatically.

@edvilme edvilme merged commit 57c6e5f into dotnet:main Oct 28, 2024
37 checks passed
@edvilme
Copy link
Member Author

edvilme commented Oct 30, 2024

/backport to release/9.0.1xx

Copy link
Contributor

Started backporting to release/9.0.1xx: https://github.com/dotnet/sdk/actions/runs/11598094603

Copy link
Contributor

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

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

Applying: [FIX] tool-install: Use config options
Using index info to reconstruct a base tree...
M	eng/dogfood.sh
M	src/Cli/dotnet/ToolPackage/IToolPackageDownloader.cs
M	src/Cli/dotnet/ToolPackage/ToolPackageDownloader.cs
M	src/Cli/dotnet/commands/dotnet-tool/install/ToolInstallGlobalOrToolPathCommand.cs
M	src/Cli/dotnet/commands/dotnet-tool/install/ToolInstallLocalCommand.cs
M	test/Microsoft.DotNet.Tools.Tests.ComponentMocks/ToolPackageDownloaderMock.cs
M	test/dotnet.Tests/CommandTests/ToolInstallGlobalOrToolPathCommandTests.cs
Falling back to patching base and 3-way merge...
Auto-merging test/dotnet.Tests/CommandTests/ToolInstallGlobalOrToolPathCommandTests.cs
Auto-merging test/Microsoft.DotNet.Tools.Tests.ComponentMocks/ToolPackageDownloaderMock.cs
CONFLICT (content): Merge conflict in test/Microsoft.DotNet.Tools.Tests.ComponentMocks/ToolPackageDownloaderMock.cs
Auto-merging src/Cli/dotnet/commands/dotnet-tool/install/ToolInstallLocalCommand.cs
Auto-merging src/Cli/dotnet/commands/dotnet-tool/install/ToolInstallGlobalOrToolPathCommand.cs
CONFLICT (content): Merge conflict in src/Cli/dotnet/commands/dotnet-tool/install/ToolInstallGlobalOrToolPathCommand.cs
Auto-merging src/Cli/dotnet/ToolPackage/ToolPackageDownloader.cs
CONFLICT (content): Merge conflict in src/Cli/dotnet/ToolPackage/ToolPackageDownloader.cs
Auto-merging src/Cli/dotnet/ToolPackage/IToolPackageDownloader.cs
CONFLICT (content): Merge conflict in src/Cli/dotnet/ToolPackage/IToolPackageDownloader.cs
Auto-merging eng/dogfood.sh
CONFLICT (content): Merge conflict in eng/dogfood.sh
error: Failed to merge in the changes.
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 0001 [FIX] tool-install: Use config options
Error: The process '/usr/bin/git' failed with exit code 128

Please backport manually!

Copy link
Contributor

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

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

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

Successfully merging this pull request may close these issues.

4 participants