TeamCity will not collect changes when we have a submodule

I have a git repo with a submodule. The build works locally but when I try it in TeamCity (version Professional 2019.1.3 (build 66439)) I get the error message:

Failed to collect changes, error: Error collecting changes for VCS repository '"SubModuleTest_ab" {instance id=2991, parent internal id=190, parent id=MegaTester_SubModuleTestAb, description: "the url"}' 'git fetch' command failed (repository dir: /system/caches/git/git-4883F794.git). stderr: url: 422 Unprocessable Entity exit code: 1, VCS root: "SubModuleTest_ab" {instance id=2991, parent internal id=190, parent id=MegaTester_SubModuleTestAb, description: "the url"}

This seems to be caused by the submodule being added - the same repo with a branch that does not include the submodule works.

I have looked at other answers about submodules in TeamCity but none of their solutions seemed to work. I have tried:

  • Adding .git to the URL in in the submodules file
  • Adding an extra commit to the submodule repo
  • Changing the authentication from https to ssh (I was pretty sure this was not going to work but I am getting desperate)
  • Specifying master as the submodule branch rather than leaving it default

Anyone know how I can fix this?

Also posted on StackOverflow

4 comments
Comment actions Permalink

Hey,

we lately had issues with submodules integration which in the end turned out to be auth issues even when the error wasn't so clear. We switched to HTTPS access tokens for the main repo/VCS and the submodule (set in .gitmodules file) and it was working. Basically you need to have the same auth between the repositories (https://www.jetbrains.com/help/teamcity/git.html#General+Settings, see Submodules). We initially were working with ssh deploy keys which needs to different for the repo's as per requirement from Github. But yeah this wasn't working since TC always tried the ssh deploy key from the main repos VCS settings.

Anyway if aligning auth methodes still not working for you (its really just a guess) you can try setting the log verbosity for 'versioned-settings' to debug and see more details.

0
Comment actions Permalink

And maybe cleanup the 'git' cache as well during your investigations.

0
Comment actions Permalink

Thanks for the help.

As far as I can tell both repos use https for authentication.

I have produced the server logs as you suggested but there are many log files, do you know which ones the relevant information might be in?

0
Comment actions Permalink

I have looked through teamcity-vcs.log and it has the information:

 


[2021-06-11 10:07:54,487] WARN [c executor 2887] - cs.ConnectionStateReporterImpl - Unable to collect changes for [MegaTester / Default (fast tests only)_submodules {id=MegaTester_DefaultFastTestsOnlySubmodules, internal id=bt387}]: jetbrains.buildServer.vcs.VcsRootVcsException: Error collecting changes for VCS repository '"SubModuleTest_ab" {instance id=2991, parent internal id=190, parent id=MegaTester_SubModuleTestAb, description: "repo location"}'
'git fetch' command failed (repository dir: <TeamCity data dir>/system/caches/git/git-4883F794.git).
stderr: "repo location" : 422 Unprocessable Entity
exit code: 1: jetbrains.buildServer.vcs.VcsRootVcsException: Error collecting changes for VCS repository '"SubModuleTest_ab" {instance id=2991, parent internal id=190, parent id=MegaTester_SubModuleTestAb, description: "repo location"}'
'git fetch' command failed (repository dir: <TeamCity data dir>/system/caches/git/git-4883F794.git).
stderr: "repo location": 422 Unprocessable Entity
exit code: 1 (enable debug to see stacktrace)
[2021-06-11 10:07:54,494] WARN [es collector 10] - jetbrains.buildServer.VCS - Failed to collect changes for build configuration MegaTester / Default (fast tests only)_submodules {id=MegaTester_DefaultFastTestsOnlySubmodules, internal id=bt387}, error: jetbrains.buildServer.vcs.VcsRootVcsException: Error collecting changes for VCS repository '"SubModuleTest_ab" {instance id=2991, parent internal id=190, parent id=MegaTester_SubModuleTestAb, description: "repo location"}'
'git fetch' command failed (repository dir: <TeamCity data dir>/system/caches/git/git-4883F794.git).
stderr: "repo location": 422 Unprocessable Entity

But that does not seem to provide a much more information.

0

Please sign in to leave a comment.