错误一直在重复发生,阻止 TeamCity 中的构建成功完成。它似乎无法将 Git repo更新到最新版本。
以下是错误消息:(我已将其格式化以便于阅读)
[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
当这个错误开始发生时,我查看了TeamCity构建代理的本地存储库中的.gitmodules文件。确实在那里:
[submodule "MyApp/Submodules/MySubmodule"]
path = MyApp/Submodules/MySubmodule
url = http://build-pc:1234/scm/MYSUB/mysub.git
可能有助于诊断此问题的详细信息:
这是当前的构建日志
[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
答案 0 :(得分:1)
在我的情况下,协议不匹配。问题是.gitmodules中最后一行之后没有新行。使用git / SourceTree这很好,但Team City不喜欢它。解决方案是在文件末尾添加一个额外的空行。
答案 1 :(得分:0)
我刚遇到这个问题 - 整个问题的根源是我为SSH设置了主要的repo(和身份验证),并且使用HTTPS路径引用了子模块。
所以,我需要做的是删除子模块,然后使用SSH路径而不是HTTPS再次添加它(仅更改.gitmodules中的路径不起作用,因为子模块上的原点也很重要。)