Skip to content

Commit b5f1c06

Browse files
authored
add restorenocache environment variable when building in CI to avoid … (#6237)
* add restorenocache environment variable when building in CI to avoid restore issues with the http cache
1 parent eb7da70 commit b5f1c06

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

Diff for: eng/common/tools.ps1

+3-1
Original file line numberDiff line numberDiff line change
@@ -540,13 +540,15 @@ function GetDefaultMSBuildEngine() {
540540

541541
function GetNuGetPackageCachePath() {
542542
if ($env:NUGET_PACKAGES -eq $null) {
543-
# Use local cache on CI to ensure deterministic build,
543+
# Use local cache on CI to ensure deterministic build.
544+
# Avoid using the http cache as workaround for https://github.com/NuGet/Home/issues/3116
544545
# use global cache in dev builds to avoid cost of downloading packages.
545546
# For directory normalization, see also: https://github.com/NuGet/Home/issues/7968
546547
if ($useGlobalNuGetCache) {
547548
$env:NUGET_PACKAGES = Join-Path $env:UserProfile '.nuget\packages\'
548549
} else {
549550
$env:NUGET_PACKAGES = Join-Path $RepoRoot '.packages\'
551+
$env:RESTORENOCACHE = $true
550552
}
551553
}
552554

Diff for: eng/common/tools.sh

+2
Original file line numberDiff line numberDiff line change
@@ -312,12 +312,14 @@ function InitializeBuildTool {
312312
_InitializeBuildToolFramework="netcoreapp2.1"
313313
}
314314

315+
# Set RestoreNoCache as a workaround for https://github.com/NuGet/Home/issues/3116
315316
function GetNuGetPackageCachePath {
316317
if [[ -z ${NUGET_PACKAGES:-} ]]; then
317318
if [[ "$use_global_nuget_cache" == true ]]; then
318319
export NUGET_PACKAGES="$HOME/.nuget/packages"
319320
else
320321
export NUGET_PACKAGES="$repo_root/.packages"
322+
export RESTORENOCACHE=true
321323
fi
322324
fi
323325

0 commit comments

Comments
 (0)