Retry agent checkout on failure

From time to time we're getting an error during agent side git checkout. It's probably related to network or vcs server (GitLab) issues. It typically just goes away if you run the configuration again.

Is there a way to tell TC to retry checkout if it failed?

[17:21:51]E: Updating sources: auto checkout (on agent) (4s)
[17:21:51] : [Updating sources] Will use agent side checkout
[17:21:51] : [Updating sources] VCS Root: Robinson (4s)
[17:21:51] : [VCS Root: Robinson] revision: 6af03bbcc05dd3d82930b13467f7beccfb55bccf
[17:21:51] : [VCS Root: Robinson] Git version: 2.17.0.0
[17:21:51] : [VCS Root: Robinson] Update checkout directory (C:\buildAgent\work\f68bb4766b73059) (3s)
[17:21:51] : [Update checkout directory (C:\buildAgent\work\f68bb4766b73059)] "C:\Program Files\Git\bin\git.exe" config core.sparseCheckout true
[17:21:51] : [Update checkout directory (C:\buildAgent\work\f68bb4766b73059)] "C:\Program Files\Git\bin\git.exe" config http.sslCAInfo
[17:21:51] : [Update checkout directory (C:\buildAgent\work\f68bb4766b73059)] "C:\Program Files\Git\bin\git.exe" config --unset http.sslCAInfo
[17:21:51] : [Update checkout directory (C:\buildAgent\work\f68bb4766b73059)] "C:\Program Files\Git\bin\git.exe" show-ref
[17:21:51] : [Update checkout directory (C:\buildAgent\work\f68bb4766b73059)] "C:\Program Files\Git\bin\git.exe" -c credential.helper= ls-remote origin
[17:21:54] : [Update checkout directory (C:\buildAgent\work\f68bb4766b73059)] "C:\Program Files\Git\bin\git.exe" show-ref refs/remotes/origin/feature/story746916-clean-redis-units-vv
[17:21:54] : [Update checkout directory (C:\buildAgent\work\f68bb4766b73059)] Commit '6af03bbcc05dd3d82930b13467f7beccfb55bccf' is not found in local clone. Running 'git fetch'...
[17:21:54] : [Update checkout directory (C:\buildAgent\work\f68bb4766b73059)] "C:\Program Files\Git\bin\git.exe" -c credential.helper= fetch --progress origin +refs/heads/feature/story746916-clean-redis-units-vv:refs/remotes/origin/feature/story746916-clean-redis-units-vv
[17:21:55]i: ["C:\Program Files\Git\bin\git.exe" -c credential.helper= fetch --progress origin +refs/heads/feature/story746916-clean-redis-units-vv:refs/remotes/origin/feature/story746916-clean-redis-units-vv] [13:21:54.887] INFO SSH command to run: git-upload-pack 'pmx-engineering/robinson.git'
[17:21:55]i: ["C:\Program Files\Git\bin\git.exe" -c credential.helper= fetch --progress origin +refs/heads/feature/story746916-clean-redis-units-vv:refs/remotes/origin/feature/story746916-clean-redis-units-vv] [13:21:54.950] INFO Connecting to git.tenforce.com port 22
[17:21:55]i: ["C:\Program Files\Git\bin\git.exe" -c credential.helper= fetch --progress origin +refs/heads/feature/story746916-clean-redis-units-vv:refs/remotes/origin/feature/story746916-clean-redis-units-vv] [13:21:54.965] INFO Connection established
[17:21:55]i: ["C:\Program Files\Git\bin\git.exe" -c credential.helper= fetch --progress origin +refs/heads/feature/story746916-clean-redis-units-vv:refs/remotes/origin/feature/story746916-clean-redis-units-vv] [13:21:55.028] INFO Disconnecting from git.tenforce.com port 22
[17:21:55]i: ["C:\Program Files\Git\bin\git.exe" -c credential.helper= fetch --progress origin +refs/heads/feature/story746916-clean-redis-units-vv:refs/remotes/origin/feature/story746916-clean-redis-units-vv] connection is closed by foreign host
[17:21:55]i: ["C:\Program Files\Git\bin\git.exe" -c credential.helper= fetch --progress origin +refs/heads/feature/story746916-clean-redis-units-vv:refs/remotes/origin/feature/story746916-clean-redis-units-vv] fatal: Could not read from remote repository.
[17:21:55]i: ["C:\Program Files\Git\bin\git.exe" -c credential.helper= fetch --progress origin +refs/heads/feature/story746916-clean-redis-units-vv:refs/remotes/origin/feature/story746916-clean-redis-units-vv]
[17:21:55]i: ["C:\Program Files\Git\bin\git.exe" -c credential.helper= fetch --progress origin +refs/heads/feature/story746916-clean-redis-units-vv:refs/remotes/origin/feature/story746916-clean-redis-units-vv] Please make sure you have the correct access rights
[17:21:55]i: ["C:\Program Files\Git\bin\git.exe" -c credential.helper= fetch --progress origin +refs/heads/feature/story746916-clean-redis-units-vv:refs/remotes/origin/feature/story746916-clean-redis-units-vv] and the repository exists.
[17:21:55]E: [Updating sources] Failed to perform checkout on agent: '"C:\Program Files\Git\bin\git.exe" -c credential.helper= fetch --progress origin +refs/heads/feature/story746916-clean-redis-units-vv:refs/remotes/origin/feature/story746916-clean-redis-units-vv' command failed.
exit code: 128
stderr: [13:21:54.887] INFO SSH command to run: git-upload-pack 'pmx-engineering/robinson.git'
[13:21:54.950] INFO Connecting to git.tenforce.com port 22
[13:21:54.965] INFO Connection established
[13:21:55.028] INFO Disconnecting from git.tenforce.com port 22
connection is closed by foreign host
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.
[17:21:55]E: [Updating sources] Error message is logged
0
1 comment

Hi Viktor,

 

The issue does look like a network connection. I'm afraid there is no way of telling it to rerun the checkout, unless you disable automatic checkout and do it manually on a build step with your own script. What TeamCity does have is a retry build trigger, that will automatically attempt again a build: https://confluence.jetbrains.com/display/TCD18/Configuring+Build+Triggers

 

Could you check whether that would work for you?

0

Please sign in to leave a comment.