-
Notifications
You must be signed in to change notification settings - Fork 1.7k
C#: Automatically use configured private registry feeds #18850
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
Changes from 1 commit
6b2f348
63d5517
11efb55
726123c
0db6a26
6b15f77
a8dde15
9560593
b6c74fe
284f612
51874b8
7a92a72
d564529
92eab47
4448369
7cea2ad
d2b88ae
4d3b024
73ca2eb
be95d33
fe1c098
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||
---|---|---|---|---|
|
@@ -262,9 +262,21 @@ | |||
/// <param name="projects">A list of paths to project files.</param> | ||||
private void RestoreProjects(IEnumerable<string> projects, HashSet<string>? configuredSources, out ConcurrentBag<DependencyContainer> dependencies) | ||||
{ | ||||
var sources = configuredSources ?? new(); | ||||
sources.Add(PublicNugetOrgFeed); | ||||
this.dependabotProxy?.RegistryURLs.ForEach(url => sources.Add(url)); | ||||
// Conservatively, we only set this to a non-null value if a Dependabot proxy is enabled. | ||||
// This ensures that we continue to get the old behaviour where feeds are taken from | ||||
// `nuget.config` files instead of the command-line arguments. | ||||
HashSet<string>? sources = null; | ||||
|
||||
if (this.dependabotProxy != null) | ||||
{ | ||||
// If the Dependabot proxy is configured, then our main goal is to make `dotnet` aware | ||||
// of the private registry feeds. However, since providing them as command-line arguments | ||||
// to `dotnet` ignores other feeds that may be configured, we also need to add the feeds | ||||
// we have discovered from analysing `nuget.config` files. | ||||
sources = configuredSources ?? new(); | ||||
sources.Add(PublicNugetOrgFeed); | ||||
this.dependabotProxy?.RegistryURLs.ForEach(url => sources.Add(url)); | ||||
mbg marked this conversation as resolved.
Show resolved
Hide resolved
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. Consider constructing the "source" string at this location instead. Otherwise it will be constructed once for each project that is restored in the parallel restore loop. 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. Done in d564529 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. To avoid timeouts, maybe there should be a feed validation check similar to: codeql/csharp/extractor/Semmle.Extraction.CSharp.DependencyFetching/NugetPackageRestorer.cs Line 692 in 72346cc
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. Done in 4448369 |
||||
} | ||||
|
||||
var successCount = 0; | ||||
var nugetSourceFailures = 0; | ||||
|
@@ -280,7 +292,7 @@ | |||
foreach (var project in projectGroup) | ||||
{ | ||||
logger.LogInfo($"Restoring project {project}..."); | ||||
var res = dotnet.Restore(new(project, PackageDirectory.DirInfo.FullName, ForceDotnetRefAssemblyFetching: true, sources.ToList(), TargetWindows: isWindows)); | ||||
Check warning on line 295 in csharp/extractor/Semmle.Extraction.CSharp.DependencyFetching/NugetPackageRestorer.cs
|
||||
assets.AddDependenciesRange(res.AssetsFilePaths); | ||||
lock (sync) | ||||
{ | ||||
|
Uh oh!
There was an error while loading. Please reload this page.