-
Notifications
You must be signed in to change notification settings - Fork 695
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
Discover plugins installed using Net tools #5990
Discover plugins installed using Net tools #5990
Conversation
test/NuGet.Core.Tests/NuGet.Protocol.Tests/Plugins/PluginDiscovererTests.cs
Outdated
Show resolved
Hide resolved
} | ||
|
||
[PlatformFact(Platform.Windows)] | ||
public void GetNetToolsPluginFiles_WithNuGetPluginPaths_ReturnsPluginsInNuGetPluginPathOnly() |
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.
Test priority of the discovery methods we have. This test makes sure we prioritize the environmental variables.
85141d8
to
3eab1a7
Compare
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.
Great progress. Left few comments on the new changes proposed.
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.
This looks fine to me. There were a couple of instances where you're checking for null results from private/internal methods which don't return null.
test/NuGet.Core.Tests/NuGet.Protocol.Tests/Plugins/PluginDiscovererTests.cs
Outdated
Show resolved
Hide resolved
File.Create(pluginFilePath); | ||
|
||
// Remove execute permissions | ||
var process = new Process(); |
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.
nit: There is an opportunity to refactor here because we set/remove execute permissions for files in all the new tests. I think we can create a private utility method and invoke it from the tests as needed. Please feel free to address it a follow-up issue.
6c1f792
into
dev-feature-dot-net-tool-plugin-support
process.StartInfo.UseShellExecute = false; | ||
process.StartInfo.RedirectStandardOutput = true; | ||
process.Start(); | ||
process.WaitForExit(); |
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.
Given that Process.WaitForExit
waits indefinitely for the process to exit, while addressing this comment you might want to consider this code by changing it to the following:
Assert.True(process.WaitForExit(1000), userMessage: "some string that helps to troubleshoot the issue");
With this approach, the test fails gracefully if the process doesn't complete on time for any unknown reason.
Bug
Fixes: NuGet/Home#13740
Description
This PR makes sure NuGet discovers credential providers installed using .NET tools.
dotnet tool install <provider package name> --global
should install the tool and add its path to thePATH
environmental varibale. Iterate through all the paths inPATH
and all the files in the path to find the plugins. By design, we expect these plugins to be namednuget-plugin*
.Plugin discovery method
The discovery is done based on which environmental variable has been specified
NUGET_NETFX_PLUGIN_PATHS
orNUGET_NETCORE_PLUGIN_PATHS
have been specified, use the old discovery method to look up non dotnet tools plugins in the paths added in the env variable.NUGET_NETFX_PLUGIN_PATHS
andNUGET_NETCORE_PLUGIN_PATHS
have not been specifiedNUGET_PLUGIN_PATHS
specified,NUGET_PLUGIN_PATHS
not specified,Default discovery method
PATH
env variable, and search for executablenuget-plugin-*
filesPR Checklist