Steve Nay
Steve Nay

Reputation: 2829

Restart a "failed to start" build on another agent

Occasionally, one of my Windows build agents will get a "failed to start" message because it was unable to clean up the checkout directory from a previous build. This is usually because an MSBuild process is still hanging on to a file handle.

[Updating sources] Failed to perform checkout on agent: '"C:\Program Files\Git\bin\git.exe" clean -f -d -x' command failed.
exit code: 1
stdout: Removing bin/
[...]
stderr: warning: failed to remove bin/prod/otherDirectory
warning: failed to remove bin/prod/yetAnotherDirectory

One solution to this is to use Swabra to kill the process before the next build starts, as described in this answer.

Another thing I'd like to try is to automatically re-add the "failed to start" build to the queue and force it to run on another agent. The problem agent usually resolves itself within a few minutes, so kicking off the build immediately on another agent is a good temporary solution.

Is it possible to add "failed to start" builds to the queue again in this manner?

Upvotes: 1

Views: 1561

Answers (2)

Steve Nay
Steve Nay

Reputation: 2829

TeamCity has a Retry Build Trigger that satisfies my requirements. It doesn't allow specifying an agent to run the build on, but the "Seconds to wait" parameter and the nature of my build queue mitigate that.

Retry Build Trigger UI, TeamCity 10.0.5

Upvotes: 2

sarbis
sarbis

Reputation: 441

Was the question about how to manually specify on which agent to run a build? If so then there is Custom Build feature, which allows you to select desired agent from dropdown. Just click "..." button next to "Run".

Upvotes: 0

Related Questions