Build hangs but works after a while
|
[21:06:56]The build is removed from the queue to be prepared for the start
[21:06:56]Collecting changes in 1 VCS root
[21:06:57]Starting the build on the agent PerfWebServ
[21:06:59]Clearing temporary directory: C:\TeamCity\buildAgent\temp\buildTmp
[21:06:59]Publishing internal artifacts
[21:06:59]Will perform clean checkout. Reason: Checkout directory is empty or doesn't exist
[21:06:59]Checkout directory: C:\TeamCity\buildAgent\work\c8e754816fd381e4
[21:06:59]Updating sources: auto checkout (on agent) (33s)
[21:07:32]File content replacer
[21:07:32]Step 1/4: Install node modules (Command Line) (1m:01s)
[21:08:34]Step 2/4: Build (Command Line) (1m:17s)
[21:09:52]Step 3/4: Clean Ftp (PowerShell) (running for 10m:01s)
[21:09:53][Step 3/4] PowerShell Executable: C:\Windows\SysWOW64\WindowsPowerShell\v1.0\powershell.exe
[21:09:53][Step 3/4] Working directory: C:\TeamCity\buildAgent\work\c8e754816fd381e4
[21:09:53][Step 3/4] Command: C:\Windows\SysWOW64\WindowsPowerShell\v1.0\powershell.exe
[21:09:53][Step 3/4] PowerShell arguments: -NonInteractive, -ExecutionPolicy, ByPass, -File, C:\TeamCity\buildAgent\temp\buildTmp\powershell430600424777904340.ps1
|
[21:28:08][Step 3/4] Attempting to perform the InitializeDefaultDrives operation on the 'FileSystem' provider failed.
It hangs on the ps1 file for a long time, then it finally throws the following error. It all goes through eventually but it never used to do this and now my builds take a long time, when they used to take a few minutes.
[Step 3/4] Attempting to perform the InitializeDefaultDrives operation on the 'FileSystem' provider failed.
I upgraded to 2017.2.2 today thinking that might help, but nothing changed.
Here's a copy of the ps.
$ftp = "ftp://xxxxxxx"
$user = "administrator"
$pass = "xxxxxxxxx"
#SET CREDENTIALS
$credentials = new-object System.Net.NetworkCredential($user, $pass)
function Get-FtpDir ($url,$credentials) {
$request = [Net.WebRequest]::Create($url)
$request.Method = [System.Net.WebRequestMethods+FTP]::ListDirectory
if ($credentials) { $request.Credentials = $credentials }
$response = $request.GetResponse()
$reader = New-Object IO.StreamReader $response.GetResponseStream()
$reader.ReadToEnd()
$reader.Close()
$response.Close()
}
function Del-File($url,$credentials) {
$request2 = [Net.WebRequest]::Create($url)
$request2.Method = [System.Net.WebRequestMethods+FTP]::DeleteFile
if ($credentials) { $request2.Credentials = $credentials }
$response2 = $request2.GetResponse()
}
function Del-Directory($url,$credentials) {
$request3 = [Net.WebRequest]::Create($url)
$request3.Method = [System.Net.WebRequestMethods+FTP]::RemoveDirectory
if ($credentials) { $request3.Credentials = $credentials }
$response3 = $request3.GetResponse()
}
function Read-And-Del($url, $credentials) {
$folderPath = $url
$Allfiles=Get-FTPDir -url $folderPath -credentials $credentials
$files = ($Allfiles -split "`r`n")
foreach ($file in $files){
if($file -ne "") {
$source=$folderPath + "/" + $file
$source
$extn = [IO.Path]::GetExtension($source)
$extn
if($extn -eq "") {
Read-And-Del -url $source -credentials $credentials
Del-Directory -url $source -credentials $credentials
} else {
Del-File -url $source -credentials $credentials
}
}
}
}
Read-And-Del -url $ftp -credentials $credentials
Please sign in to leave a comment.