From 9fea0dd08ff091b171203d4208fea6de9e542ce2 Mon Sep 17 00:00:00 2001 From: Jared Parsons Date: Tue, 11 Apr 2017 10:39:09 -0700 Subject: [PATCH] Redirect TEMP in Jenkins runs This was meant to be done as part of my rework of netci.groovy but it looks like I missed it. https://github.com/dotnet/roslyn/commit/8a078fac5c497b61f00505d3fe4cf0d92137bef3 --- build/scripts/cibuild.ps1 | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/build/scripts/cibuild.ps1 b/build/scripts/cibuild.ps1 index d4f441d3641..fdbb34c7b24 100644 --- a/build/scripts/cibuild.ps1 +++ b/build/scripts/cibuild.ps1 @@ -46,6 +46,17 @@ function Terminate-BuildProcesses() { Get-Process vbcscompiler -ErrorAction SilentlyContinue | kill } +# The Jenkins images used to execute our tests can live for a very long time. Over the course +# of hundreds of runs this can cause the %TEMP% folder to fill up. To avoid this we redirect +# %TEMP% into the binaries folder which is deleted at the end of every run as a part of cleaning +# up the workspace. +function Redirect-Temp() { + $temp = Join-Path $binariesDir "Temp" + Create-Directory $temp + ${env:TEMP} = $temp + ${env:TMP} = $temp +} + try { . (Join-Path $PSScriptRoot "build-utils.ps1") Push-Location $repoDir @@ -73,6 +84,7 @@ try { # Ensure the binaries directory exists because msbuild can fail when part of the path to LogFile isn't present. Create-Directory $binariesDir + Redirect-Temp if ($testBuildCorrectness) { Exec { & ".\build\scripts\test-build-correctness.ps1" $repoDir $configDir } -- GitLab