@@ -700,11 +700,36 @@ private bool IsFeedReachable(string feed, int timeoutMilliSeconds, int tryCount,
700
700
return ( timeoutMilliSeconds , tryCount ) ;
701
701
}
702
702
703
+ /// <summary>
704
+ /// Checks that we can connect to all Nuget feeds that are explicitly configured in configuration files.
705
+ /// </summary>
706
+ /// <param name="explicitFeeds">Outputs the set of explicit feeds.</param>
707
+ /// <returns>True if all feeds are reachable or false otherwise.</returns>
703
708
private bool CheckFeeds ( out HashSet < string > explicitFeeds )
704
709
{
705
- logger . LogInfo ( "Checking Nuget feeds..." ) ;
706
710
( explicitFeeds , var allFeeds ) = GetAllFeeds ( ) ;
707
711
712
+ var allFeedsReachable = this . CheckFeeds ( explicitFeeds ) ;
713
+
714
+ var inheritedFeeds = allFeeds . Except ( explicitFeeds ) . ToHashSet ( ) ;
715
+ if ( inheritedFeeds . Count > 0 )
716
+ {
717
+ logger . LogInfo ( $ "Inherited Nuget feeds (not checked for reachability): { string . Join ( ", " , inheritedFeeds . OrderBy ( f => f ) ) } ") ;
718
+ compilationInfoContainer . CompilationInfos . Add ( ( "Inherited Nuget feed count" , inheritedFeeds . Count . ToString ( ) ) ) ;
719
+ }
720
+
721
+ return allFeedsReachable ;
722
+ }
723
+
724
+ /// <summary>
725
+ /// Checks that we can connect to the specified Nuget feeds.
726
+ /// </summary>
727
+ /// <param name="feeds">The set of package feeds to check.</param>
728
+ /// <returns>True if all feeds are reachable or false otherwise.</returns>
729
+ private bool CheckFeeds ( HashSet < string > feeds )
730
+ {
731
+ logger . LogInfo ( "Checking that Nuget feeds are reachable..." ) ;
732
+
708
733
var excludedFeeds = EnvironmentVariables . GetURLs ( EnvironmentVariableNames . ExcludedNugetFeedsFromResponsivenessCheck )
709
734
. ToHashSet ( ) ;
710
735
@@ -715,7 +740,7 @@ private bool CheckFeeds(out HashSet<string> explicitFeeds)
715
740
716
741
var ( initialTimeout , tryCount ) = GetFeedRequestSettings ( isFallback : false ) ;
717
742
718
- var allFeedsReachable = explicitFeeds . All ( feed => excludedFeeds . Contains ( feed ) || IsFeedReachable ( feed , initialTimeout , tryCount ) ) ;
743
+ var allFeedsReachable = feeds . All ( feed => excludedFeeds . Contains ( feed ) || IsFeedReachable ( feed , initialTimeout , tryCount ) ) ;
719
744
if ( ! allFeedsReachable )
720
745
{
721
746
logger . LogWarning ( "Found unreachable Nuget feed in C# analysis with build-mode 'none'. This may cause missing dependencies in the analysis." ) ;
@@ -730,14 +755,6 @@ private bool CheckFeeds(out HashSet<string> explicitFeeds)
730
755
}
731
756
compilationInfoContainer . CompilationInfos . Add ( ( "All Nuget feeds reachable" , allFeedsReachable ? "1" : "0" ) ) ;
732
757
733
-
734
- var inheritedFeeds = allFeeds . Except ( explicitFeeds ) . ToHashSet ( ) ;
735
- if ( inheritedFeeds . Count > 0 )
736
- {
737
- logger . LogInfo ( $ "Inherited Nuget feeds (not checked for reachability): { string . Join ( ", " , inheritedFeeds . OrderBy ( f => f ) ) } ") ;
738
- compilationInfoContainer . CompilationInfos . Add ( ( "Inherited Nuget feed count" , inheritedFeeds . Count . ToString ( ) ) ) ;
739
- }
740
-
741
758
return allFeedsReachable ;
742
759
}
743
760
0 commit comments