【问题标题】:VSO Build failed with submodulesVSO 构建因子模块而失败
【发布时间】:2017-10-03 01:03:02
【问题描述】:

我们正在使用 TFS 2015 并在尝试构建存储库时遇到错误。我们有两个 TeamProject,A 中是我们要构建的主存储库,B 中是 A 中引用的子模块。

构建失败并显示以下消息:

2017-05-17T14:16:37.9148422Z Checked out branch refs/heads/develop for repository A at commit 8bece3e87781f4064c61ff8ce750f6dbd17bca02
2017-05-17T14:16:39.2898443Z ##[error]LibGit2Sharp.LibGit2SharpException: Response status code does not indicate success: 404 (Not Found).
2017-05-17T14:16:39.2898443Z ##[error]   bei LibGit2Sharp.Core.Ensure.HandleError(Int32 result)
2017-05-17T14:16:39.2898443Z ##[error]   bei LibGit2Sharp.Core.Proxy.git_submodule_update(SubmoduleHandle submodule, Boolean init, GitSubmoduleOptions& options)
2017-05-17T14:16:39.2898443Z ##[error]   bei LibGit2Sharp.SubmoduleCollection.Update(String name, SubmoduleUpdateOptions options)
2017-05-17T14:16:39.2898443Z ##[error]   bei Microsoft.TeamFoundation.DistributedTask.Task.Internal.Core.GitHelper.DoUpdateSubmodules(Repository repository, Int32 maxRecursionDepth, Int32 currentRecursionDepth, String username, String password, CancellationToken cancellationToken)
2017-05-17T14:16:39.2898443Z ##[error]   bei Microsoft.TeamFoundation.DistributedTask.Task.Internal.Core.GitHelper.UpdateSubmodules(ITaskEndpoint endpoint, Repository repository, Int32 maxRecursionDepth, CancellationToken cancellationToken)
2017-05-17T14:16:39.2898443Z ##[error]   bei Microsoft.TeamFoundation.DistributedTask.Task.Internal.Core.GitHelper.SyncAndCheckout(Boolean cleanRepository, String sourceBranch, String sourceVersion, Boolean checkoutSubmodules, CancellationToken cancellationToken)
2017-05-17T14:16:39.2898443Z ##[error]   bei Microsoft.TeamFoundation.DistributedTask.Plugin.Build.GitSourceProvider.<>c__DisplayClass3_0.<PrepareRepositoryAsync>b__0()

执行构建的用户有权读取所有需要的存储库,还有什么问题?

.gitmodules 的 A

[submodule "custom/plugins/B"]
    path = custom/plugins/B
    url = https://tfs/Root/Project/_git/B

触发构建时的日志。

******************************************************************************
Wird gestartet: Quellen abrufen
******************************************************************************
Syncing repository: shopware (Git)
Klonen wird gestartet
ee22f3ff7951b579e57b8d9b65f14d6c382ca25a bis C:\Webteam-Agent\_work\9\s mit Submodulen ausgecheckt
revparsing ee22f3ff7951b579e57b8d9b65f14d6c382ca25a
grabbed ref , obj ee22f3ff7951b579e57b8d9b65f14d6c382ca25a
dereferenced to commit ee22f3ff7951b579e57b8d9b65f14d6c382ca25a
Checked out branch refs/heads/develop for repository shopware at commit ee22f3ff7951b579e57b8d9b65f14d6c382ca25a
LibGit2Sharp.LibGit2SharpException: Response status code does not indicate success: 404 (Not Found).
bei LibGit2Sharp.Core.Ensure.HandleError(Int32 result)
bei LibGit2Sharp.Core.Proxy.git_submodule_update(SubmoduleHandle submodule, Boolean init, GitSubmoduleOptions& options)
bei LibGit2Sharp.SubmoduleCollection.Update(String name, SubmoduleUpdateOptions options)
bei Microsoft.TeamFoundation.DistributedTask.Task.Internal.Core.GitHelper.DoUpdateSubmodules(Repository repository, Int32 maxRecursionDepth, Int32 currentRecursionDepth, String username, String password, CancellationToken cancellationToken)
bei Microsoft.TeamFoundation.DistributedTask.Task.Internal.Core.GitHelper.UpdateSubmodules(ITaskEndpoint endpoint, Repository repository, Int32 maxRecursionDepth, CancellationToken cancellationToken)
bei Microsoft.TeamFoundation.DistributedTask.Task.Internal.Core.GitHelper.SyncAndCheckout(Boolean cleanRepository, String sourceBranch, String sourceVersion, Boolean checkoutSubmodules, CancellationToken cancellationToken)
bei Microsoft.TeamFoundation.DistributedTask.Plugin.Build.GitSourceProvider.<>c__DisplayClass3_0.<PrepareRepositoryAsync>b__0()
Microsoft.TeamFoundation.DistributedTask.Agent.Common.AgentExecutionTerminationException: Fehler beim Vorbereiten des Repositorys mit einer Ausnahme. ---> LibGit2Sharp.LibGit2SharpException: Response status code does not indicate success: 404 (Not Found).
bei LibGit2Sharp.Core.Ensure.HandleError(Int32 result)
bei LibGit2Sharp.Core.Proxy.git_submodule_update(SubmoduleHandle submodule, Boolean init, GitSubmoduleOptions& options)
bei LibGit2Sharp.SubmoduleCollection.Update(String name, SubmoduleUpdateOptions options)
bei Microsoft.TeamFoundation.DistributedTask.Task.Internal.Core.GitHelper.DoUpdateSubmodules(Repository repository, Int32 maxRecursionDepth, Int32 currentRecursionDepth, String username, String password, CancellationToken cancellationToken)
bei Microsoft.TeamFoundation.DistributedTask.Task.Internal.Core.GitHelper.UpdateSubmodules(ITaskEndpoint endpoint, Repository repository, Int32 maxRecursionDepth, CancellationToken cancellationToken)
bei Microsoft.TeamFoundation.DistributedTask.Task.Internal.Core.GitHelper.SyncAndCheckout(Boolean cleanRepository, String sourceBranch, String sourceVersion, Boolean checkoutSubmodules, CancellationToken cancellationToken)
bei Microsoft.TeamFoundation.DistributedTask.Plugin.Build.GitSourceProvider.<>c__DisplayClass3_0.<PrepareRepositoryAsync>b__0()
--- Ende der internen Ausnahmestapelüberwachung ---
bei Microsoft.TeamFoundation.DistributedTask.Plugin.Build.GitSourceProvider.<>c__DisplayClass3_0.<PrepareRepositoryAsync>b__0()
bei System.Threading.Tasks.Task.Execute()
Der Worker Worker-b7f0b104-abc3-4af8-a305-6a3e93d9a72e hat die Ausführung des Auftrags b7f0b104-abc3-4af8-a305-6a3e93d9a72e abgeschlossen.
******************************************************************************
Build wird abgeschlossen
******************************************************************************

【问题讨论】:

  • 您的子模块是否正确指向其他团队项目中的存储库?跨团队项目边界存储依赖项是个坏主意。
  • 我添加了配置,为什么跨团队项目存储 repos 是个坏主意?
  • @Knerd 您能否发布更多有关您的获取源步骤的日志并测试此问题是否在其他构建定义中发生?尝试在其他存储库中测试
  • @Tingting0929-MSFT 只要所有存储库都在同一个 TeamProject 中,它就可以工作,如果它是不同的 TeamProject 则失败。
  • @Tingting0929-MSFT 我添加了更多日志,安装的 Visual Studio 版本是 2015 Enterprise。

标签: git tfs


【解决方案1】:

请尝试添加“项目集合构建服务帐户”并授予此 Git 存储库的读取和其他权限。

更多详情请参考本帖:TFS Build Fail when running for TFS-GIT Repository

还要确保在构建代理上安装 Visual Studio 2013 及更高版本。

更新:

我已经重现了你的问题,这个问题是由于 URL 不正确引起的。 请从 TFS 网站登录 TFS,在团队项目 A 中找到 .gitmodules。然后检查 Url(url = https://tfs/Root/Project/_git/B) 是否正确。确保它可以连接到您的构建服务器中。

然后在构建定义中,将 Clean repository 设置为 True 并再次构建。

【讨论】:

  • 他们有读取权限,应用程序是基于 PHP 的,为什么我需要 VS2013?
  • @Tingting09029-MSFT:在获取源步骤期间失败。
  • 当我使用命令行克隆存储库时,它可以正常工作。
  • 代理用户,是的。
【解决方案2】:

我找不到此特定问题的解决方案,因此我升级到最新版本的 VSTS 代理,并且它可以正常工作。

【讨论】:

    【解决方案3】:

    我建议在构建目录中安装 git bash 并运行 git submodule update。与 VSO 相比,您从 git bash 获得的可搜索错误要多得多。

    在 git bash 中尝试的另一件事是转到子模块目录并运行 git remote -v 它应该会显示它正在使用的 URL。如果它与主仓库中的.gitmodules 不同步,则运行git submodule sync 进行更新。

    一旦您弄清楚如何使用 git 修复它,您可能会更好地欺骗 Microsoft 的东西使其正常工作。然后向他们提交错误报告。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-12-27
      • 2022-07-07
      • 2018-09-05
      • 1970-01-01
      • 2020-10-08
      相关资源
      最近更新 更多