0

An error is consistently reoccurring, preventing builds in TeamCity from completing successfully. It seems to fail at updating it's Git repo to the latest version.

Here is the error message: (I've formatted it to make it easier to read)

[Updating sources] Failed to build patch for build #119 {build id=620}, VCS root: 
"MyApp Git"
{
    instance id=1, 
    parent internal id=1,
    parent id=MYAPP_GIT, 
    description:
        "http://build-pc:1234/scm/MYAPP/myapp.git#refs/heads/master"
}, 

due to error: 
    Patch building failed:
    jetbrains.buildServer.buildTriggers.vcs.git
             .submodules.MissingSubmoduleEntryException:
    The repository 'http://teamcity@build-pc:1234/scm/MYAPP/myapp.git' 
    has a submodule in the commit '5bb7870d294c719f61261f94510343abff65b789'
    at a path 'MyApp/Submodules/MySubmodule', 
    but has no entry for this path in .gitmodules configuration

At the time this error started to occur, I looked inside the .gitmodules file inside the TeamCity build agent's local repo. It was indeed in there:

[submodule "MyApp/Submodules/MySubmodule"]  
    path = MyApp/Submodules/MySubmodule     
    url = http://build-pc:1234/scm/MYSUB/mysub.git

Details that might help diagnose this problem:

  • At the time this submodule was being created, I remember there were some complications that eventually were taken care of. The most I remember is that the submodule had to be created multiple times due to the wrong URL and Path being entered. Nonetheless the submodule "works" now, minus this issue with TeamCity.
  • Other submodules have been added to our project, none of which reportedly have this issue.

Here is the current build log

[17:58:04]Checking for changes
[17:58:05]Will perform clean checkout
[17:58:05]Clean checkout reasons
[17:58:05]Agent doesn't have any version of the project sources
[17:58:05]Checkout directory is empty or doesn't exist
[17:58:05]Publishing internal artifacts
[17:58:05]Sending using ArtifactsCachePublisher
[17:58:05]Sending using WebPublisher
[17:58:05]Clearing temporary directory: C:\TeamCity\buildAgent\temp\buildTmp
[17:58:05]Using vcs information from server. Reason: no revision information for buildtype Full Build and checkout directory C:\TeamCity\buildAgent\work\MyApp_Checkout on agent
[17:58:05]Clean build enabled: removing old files from C:\TeamCity\buildAgent\work\MyApp_Checkout
[17:58:05]Checkout directory: C:\TeamCity\buildAgent\work\MyApp_Checkout
[17:58:05]Updating sources: server side checkout (6m:36s)
[17:58:06]Building and caching clean patch for VCS root: MyApp Git
[18:04:42]Failed to build patch for build #122 {build id=623}, VCS root: "MyApp Git" {instance id=1, parent internal id=1, parent id=MYAPP_GIT, description: "http://build-pc:1234/scm/MYAPP/myapp.git#refs/heads/master"}, due to error: Patch building failed: jetbrains.buildServer.buildTriggers.vcs.git.submodules.MissingSubmoduleEntryException: The repository 'http://teamcity@build-pc:1234/scm/MYAPP/myapp.git' has a submodule in the commit '8e88b0760de96739bef3d77e8e99303a1d0c8296' at a path 'MyApp/Submodules/MySubmodule', but has no entry for this path in .gitmodules configuration
[18:04:42]Repository sources transferred
[18:04:42]Will repeat attempt when server will be available, number of attempts left: 2
[18:04:52]Updating sources: server side checkout (running for 4m:24s)
[18:04:52][Updating sources] Will perform clean checkout
[18:04:52][Updating sources] Clean checkout reasons
[18:04:52]Agent doesn't have any version of the project sources
[18:04:52]Checkout directory is empty or doesn't exist
[18:04:53][Updating sources] Building and caching clean patch for VCS root: MyApp Git
steve
  • 21
  • 1
  • 3
  • Maybe the answer to this question will help http://stackoverflow.com/questions/14724520/cannot-build-with-teamcity-and-one-git-submodule. – Castrohenge Sep 16 '14 at 18:07
  • @Castrohenge Thanks for sharing, although I've already looked that one - The problem seems similar, though the solution wouldn't apply well since the URL I provided is correct. – steve Sep 16 '14 at 18:25
  • Does the specific commit 5bb7870d294c719f61261f94510343abff65b789 have the correct path in the .gitmodules config? – Castrohenge Sep 16 '14 at 18:29
  • I'm not 100% sure I understand the question, but here's my best stab at answering it anyway: I used "Go to commit" and went to that commit (5bb7870d294c719f61261f94510343abff65b789). I viewed the .gitmodules file in the file tree for that commit. Indeed, the correct URL is there as well. – steve Sep 16 '14 at 23:11
  • That's exactly what I wanted to know, thanks. Maybe the complications have lead to teamcity having an incorrect record of the changes. Have you tried a clean checkout of all sources? You can do this by running a custom build and selecting the options to clean the source and get from your version control again. – Castrohenge Sep 17 '14 at 07:42

2 Answers2

1

In my case it wasn't the protocol mismatch. The problem was that there was no new line after the last line in .gitmodules. That was fine with git/SourceTree, but Team City did not like it. The solution was to add an extra empty line at the end of the file.

Sergey Gussak
  • 142
  • 1
  • 8
0

I just ran into this problem - the root of whole issue was that I had main repo (and authentication) set for SSH and submodule was referenced with HTTPS path.

So, what I needed to do was remove submodule and then add it again using SSH path instead of HTTPS (just changing the path in .gitmodules doesn't work, since origin on submodule also counts).

nikib3ro
  • 20,366
  • 24
  • 120
  • 181