1
votes

When running TeamCity build, I keep on seeing these errors.

  • Please note, we're tried both custom & recommended checkout directory folder

Error 1: Updating sources: auto checkout (on agent) (16s) [Updating sources] Failed to delete empty directory: C:\TeamCity\buildAgent\work\CheckOutCustomFolder\ProjectFolderName\bin\Debug

Error 2: Error while applying patch (1) Failed to perform checkout on agent: '"C:\Program Files\Git\bin\git.exe" clean -f -d -x' command failed. Failed to perform checkout on agent: '"C:\Program Files\Git\bin\git.exe" clean -f -d -x' command failed. exit code: 1 stderr: warning: failed to remove ProjectFolderName/bin/Debug

Appreciate if someone can help on this!

1

1 Answers

0
votes

This happened to us too. We have a Windows machine, where we are running our selenium tests from TeamCity. When a build was stopped in some middle state we've got an error on the next build that the directory can't be removed. This is due to Windows holding some kind of lock to that directory and not allowing to remove it. If you are running TeamCity on Windows the problem will be similar.

The following are the solutions:

  1. Remove manually by ssh to that:

    rm -f C:\TeamCity\buildAgent\work\CheckOutCustomFolder\ProjectFolderName\bin\Debug

  2. Restart the machine
  3. Have a script to clean up any outstanding processes that can hold a directory, for example:

    pkill -9 chrome or pkill -9 chromedriver