Skip to content

Commit 1ee936e

Browse files
jakubstilecMattGal
andauthored
https://github.com/dotnet/core-eng/issues/13691 - refactor variable setting so we can also do it in MSBuild-Core() (#7916) (#7921)
Co-authored-by: Matt Galbraith <[email protected]>
1 parent b14e0fb commit 1ee936e

1 file changed

Lines changed: 18 additions & 8 deletions

File tree

eng/common/tools.ps1

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -709,14 +709,7 @@ function MSBuild() {
709709
Write-PipelineSetVariable -Name 'NUGET_PLUGIN_REQUEST_TIMEOUT_IN_SECONDS' -Value '20'
710710
}
711711

712-
if ($ci) {
713-
$env:NUGET_ENABLE_EXPERIMENTAL_HTTP_RETRY = 'true'
714-
$env:NUGET_EXPERIMENTAL_MAX_NETWORK_TRY_COUNT = 6
715-
$env:NUGET_EXPERIMENTAL_NETWORK_RETRY_DELAY_MILLISECONDS = 1000
716-
Write-PipelineSetVariable -Name 'NUGET_ENABLE_EXPERIMENTAL_HTTP_RETRY' -Value 'true'
717-
Write-PipelineSetVariable -Name 'NUGET_EXPERIMENTAL_MAX_NETWORK_TRY_COUNT' -Value '6'
718-
Write-PipelineSetVariable -Name 'NUGET_EXPERIMENTAL_NETWORK_RETRY_DELAY_MILLISECONDS' -Value '1000'
719-
}
712+
Enable-Nuget-EnhancedRetry
720713

721714
$toolsetBuildProject = InitializeToolset
722715
$basePath = Split-Path -parent $toolsetBuildProject
@@ -764,6 +757,8 @@ function MSBuild-Core() {
764757
}
765758
}
766759

760+
Enable-Nuget-EnhancedRetry
761+
767762
$buildTool = InitializeBuildTool
768763

769764
$cmdArgs = "$($buildTool.Command) /m /nologo /clp:Summary /v:$verbosity /nr:$nodeReuse /p:ContinuousIntegrationBuild=$ci"
@@ -904,3 +899,18 @@ function Try-LogClientIpAddress()
904899
Write-Host "Unable to get this machine's effective IP address for logging: $_"
905900
}
906901
}
902+
903+
#
904+
# If $ci flag is set, turn on (and log that we did) special environment variables for improved Nuget client retry logic.
905+
#
906+
function Enable-Nuget-EnhancedRetry() {
907+
if ($ci) {
908+
Write-Host "Setting NUGET enhanced retry environment variables"
909+
$env:NUGET_ENABLE_EXPERIMENTAL_HTTP_RETRY = 'true'
910+
$env:NUGET_EXPERIMENTAL_MAX_NETWORK_TRY_COUNT = 6
911+
$env:NUGET_EXPERIMENTAL_NETWORK_RETRY_DELAY_MILLISECONDS = 1000
912+
Write-PipelineSetVariable -Name 'NUGET_ENABLE_EXPERIMENTAL_HTTP_RETRY' -Value 'true'
913+
Write-PipelineSetVariable -Name 'NUGET_EXPERIMENTAL_MAX_NETWORK_TRY_COUNT' -Value '6'
914+
Write-PipelineSetVariable -Name 'NUGET_EXPERIMENTAL_NETWORK_RETRY_DELAY_MILLISECONDS' -Value '1000'
915+
}
916+
}

0 commit comments

Comments
 (0)