Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Teamcity v7.0.2 - checkout directory file cannot be deleted when applying patch

Tags:

c#

teamcity

One of developer is applying patch to CI and has broken the CI build. The error occurred as below in the build log. I have done the below steps and still doesnot work.

  1. I could not delete the folder: 35b0f615bcea75bd manually eventhough I have full write and delete access to the build agent directories.
  2. I have tried to run Enforce clean checkout, still doesnot work.
  3. Have re-run the build, still doesnot work.

Questions:

  1. Is deleting this file manually the best solution to fix the below error?
  2. If the answer is "yes", what should I try next to delete this file?
  3. What is the best way to prevent this error to happen again when applying patch?

Build log:

[18:32:28]Checking for changes
[18:35:15]Publishing internal artifacts
[18:35:15]Clearing temporary directory: D:\TeamCity\buildAgent\temp\buildTmp
[18:35:15]Checkout directory: D:\TeamCity\buildAgent\work\35b0f615bcea75bd
[18:35:15]Updating sources: server side checkout (2m:09s)
[18:35:16][Updating sources] Will perform clean checkout. Reason: Agent doesn't have any version of the project sources
[18:35:16][Updating sources] Building clean patch for VCS root: ProjectName Trunk
[18:37:24][Updating sources] Transferring cached clean patch for VCS root: ProjectName Trunk
[18:37:25][Updating sources] Repository sources transferred: 27.61Mb total
[18:37:25][Updating sources] Removing D:\TeamCity\buildAgent\work\35b0f615bcea75bd
[18:37:25][Updating sources] Error while applying patch: Failed to delete: D:\TeamCity\buildAgent\work\35b0f615bcea75bd\ProjectName\bin\Debug
[18:37:25]Publishing internal artifacts
[18:37:25]Build failed to start. Artifacts will not be published for this build
[18:37:26]Build finished
like image 531
user1769470 Avatar asked Oct 24 '12 00:10

user1769470


2 Answers

We have had this issue when running Selenium tests and the browser was not properly shut down. We actually created a powershell script that we execute as a build on any of our agents that will kill any outstanding IE or Firefox or Chrome processes. We also ensured that our tests always close the browser on teardown.

If you have enough privileges, you can remotely restart the build agent from the TeamCity web interface. You this by clicking on the Agents tab at the top, selecting the offending agent, and then select "Reboot Agent Machine". You can read more in the TeamCity documentation.

like image 59
Chris Edwards Avatar answered Oct 14 '22 16:10

Chris Edwards


Question 1. Yes, deleting the folder is your best bet to resolve the current situation.

Question 2. Whenever I've had an issue like this it's been because there is a file in use in the folder that cannot be deleted. So I would suggest that you use a tool like Process Monitor on the TeamCity server to work out what file is in use.

Question 3. Once you have worked out what was in use you'll need to work out why to stop it again.

like image 21
Paul Hunt Avatar answered Oct 14 '22 16:10

Paul Hunt