Skip to content

Commit

Permalink
Don't use the source-build nuget.config
Browse files Browse the repository at this point in the history
Using source-build's nuget.config adds lots of additional nuget sources.
The nuget client tries to connect to all of them at once to minimize
total time (due to network latency). It does this by spawning lots of
network connections. Each network connection consumes file descriptors.
This works fine on x64, but fails for .NET runtimes that use Mono,
because mono has a hard 1024 limit for file descriptors. See
dotnet/runtime#82428 for details.

Additionally, since the goal of the tests tests is to mirror the results
that end-users using the .NET SDK will see, adding additional nuget
sources by default seems a bit weird.

However, the additional nuget sources were added for a reason. They
might be needed for non-public and/or in-development releases. If so, we
can selectively re-enable the additional nuget.config sources
nuget.config with some command line flags.
  • Loading branch information
omajid committed Jun 12, 2023
1 parent 1c5b2b3 commit c332f7e
Showing 1 changed file with 13 additions and 9 deletions.
22 changes: 13 additions & 9 deletions Turkey/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,8 @@ public static async Task<int> Run(string testRoot,
);

Version packageVersion = dotnet.LatestRuntimeVersion;
string nuGetConfig = await GenerateNuGetConfigIfNeededAsync(additionalFeed, packageVersion);
string nuGetConfig = await GenerateNuGetConfigIfNeededAsync(additionalFeed, packageVersion,
useSourceBuildNuGetConfig: false);
if (verbose && nuGetConfig != null)
{
Console.WriteLine("Using nuget.config: ");
Expand All @@ -133,7 +134,7 @@ public static async Task<int> Run(string testRoot,
return exitCode;
}

public static async Task<string> GenerateNuGetConfigIfNeededAsync(string additionalFeed, Version netCoreAppVersion)
public static async Task<string> GenerateNuGetConfigIfNeededAsync(string additionalFeed, Version netCoreAppVersion, bool useSourceBuildNuGetConfig)
{
var urls = new List<string>();

Expand Down Expand Up @@ -167,14 +168,17 @@ public static async Task<string> GenerateNuGetConfigIfNeededAsync(string additio
}

string nugetConfig = null;
try
if (useSourceBuildNuGetConfig)
{
nugetConfig = await sourceBuild.GetNuGetConfigAsync(netCoreAppVersion);
}
catch( HttpRequestException exception )
{
Console.WriteLine("WARNING: failed to get NuGet.config from source-build. Ignoring Exception:");
Console.WriteLine(exception.ToString());
try
{
nugetConfig = await sourceBuild.GetNuGetConfigAsync(netCoreAppVersion);
}
catch( HttpRequestException exception )
{
Console.WriteLine("WARNING: failed to get NuGet.config from source-build. Ignoring Exception:");
Console.WriteLine(exception.ToString());
}
}

if (urls.Any() || nugetConfig != null)
Expand Down

0 comments on commit c332f7e

Please sign in to comment.