Skip to content

Commit

Permalink
dotnet/core-eng#13691 - refactor variable setting so we can also do i…
Browse files Browse the repository at this point in the history
…t in MSBuild-Core() (dotnet#7916)
  • Loading branch information
MattGal authored and Jakub Stilec committed Sep 21, 2021
1 parent b14e0fb commit 2b5e97d
Showing 1 changed file with 18 additions and 8 deletions.
26 changes: 18 additions & 8 deletions eng/common/tools.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -709,14 +709,7 @@ function MSBuild() {
Write-PipelineSetVariable -Name 'NUGET_PLUGIN_REQUEST_TIMEOUT_IN_SECONDS' -Value '20'
}

if ($ci) {
$env:NUGET_ENABLE_EXPERIMENTAL_HTTP_RETRY = 'true'
$env:NUGET_EXPERIMENTAL_MAX_NETWORK_TRY_COUNT = 6
$env:NUGET_EXPERIMENTAL_NETWORK_RETRY_DELAY_MILLISECONDS = 1000
Write-PipelineSetVariable -Name 'NUGET_ENABLE_EXPERIMENTAL_HTTP_RETRY' -Value 'true'
Write-PipelineSetVariable -Name 'NUGET_EXPERIMENTAL_MAX_NETWORK_TRY_COUNT' -Value '6'
Write-PipelineSetVariable -Name 'NUGET_EXPERIMENTAL_NETWORK_RETRY_DELAY_MILLISECONDS' -Value '1000'
}
Enable-Nuget-EnhancedRetry

$toolsetBuildProject = InitializeToolset
$basePath = Split-Path -parent $toolsetBuildProject
Expand Down Expand Up @@ -764,6 +757,8 @@ function MSBuild-Core() {
}
}

Enable-Nuget-EnhancedRetry

$buildTool = InitializeBuildTool

$cmdArgs = "$($buildTool.Command) /m /nologo /clp:Summary /v:$verbosity /nr:$nodeReuse /p:ContinuousIntegrationBuild=$ci"
Expand Down Expand Up @@ -904,3 +899,18 @@ function Try-LogClientIpAddress()
Write-Host "Unable to get this machine's effective IP address for logging: $_"
}
}

#
# If $ci flag is set, turn on (and log that we did) special environment variables for improved Nuget client retry logic.
#
function Enable-Nuget-EnhancedRetry() {
if ($ci) {
Write-Host "Setting NUGET enhanced retry environment variables"
$env:NUGET_ENABLE_EXPERIMENTAL_HTTP_RETRY = 'true'
$env:NUGET_EXPERIMENTAL_MAX_NETWORK_TRY_COUNT = 6
$env:NUGET_EXPERIMENTAL_NETWORK_RETRY_DELAY_MILLISECONDS = 1000
Write-PipelineSetVariable -Name 'NUGET_ENABLE_EXPERIMENTAL_HTTP_RETRY' -Value 'true'
Write-PipelineSetVariable -Name 'NUGET_EXPERIMENTAL_MAX_NETWORK_TRY_COUNT' -Value '6'
Write-PipelineSetVariable -Name 'NUGET_EXPERIMENTAL_NETWORK_RETRY_DELAY_MILLISECONDS' -Value '1000'
}
}

0 comments on commit 2b5e97d

Please sign in to comment.