在两个 TeamCity 构建配置的 运行 之间删除的程序集
Assemblies deleted between run of two TeamCity build configurations
我们有一个构建配置为 "Build (Trunk)" 和 "Deploy CI (Trunk)" 的团队城市。
"Build (Trunk)" 有一个 VCS 触发器 "Triggers a build after a VCS check-in is detected",其目标是构建用于部署的程序集。
"Deploy CI (Trunk)" 有一个完成构建触发器 "Wait for a successful build in: Build (trunk)" 并依赖于带有选项 "Run build on the same agent" 的 "Build (Trunk)"。
有时 "Build (Trunk)" 成功,dll 在那里(有一个构建步骤检查它)并且 "Deploy (Trunk)" 失败,因为它缺少一些已经构建的部署的 dll(和检查)。
我最终在 "Deploy (Trunk)" 中遇到错误
[MSBuild.ExtensionPack.Framework.Assembly] D:\TeamCity\buildAgent\work\d11b43f69b1be1cb\Source\Product\Build.xml(191, 9): 找不到文件:D:\TeamCity\buildAgent\work\d11b43f69b1be1cb\Source\Product\output\Release\Application\Server\bin\Product.Server.dll
dll 位于 "Build (Trunk)" 的末尾,但不知为何在 "Deploy (trunk)" 中丢失了。另一个构建配置(单元测试)也会出现同样的问题。
发生这种情况时,我通常 运行 使用 "clean all files in the checkout directory before the build" 构建 (T运行k) 并且它有效。我们目前使用的是 TeamCity 10,但它发生在 TeamCity 9 上。
我不知道如何确定根本原因,想就此寻求建议。
您需要设置第一个构建配置以将您创建的工件发布到公共 "Artifacts" 目录,然后在 Deploy 构建配置中创建一个快照依赖项,一旦创建工件,它将 运行 .并在您的第二个构建配置中访问公共位置中的工件。
我想通了(感谢指点)。基本上这是快照依赖和多个触发器的问题。 Deploy 必须具有它期望的正确版本的快照依赖项。如果构建再次为 运行(它与部署有单独的触发器:在新版本上构建),在前者的部署为 运行(单独的触发器:构建完成时)之前,部署会检测到它并执行 VCS 的干净检查:
[16:26:52] : Will perform clean checkout. Reason: The project sources on the agent are newer than requested
但是干净的签出将删除已经在签出目录中的 dll,因此它们不存在以进行部署。
示例(为什么 "Deploy #4257" 失败)- 只有一个代理存在:
[16:17:25] Build #4257 was triggered because SVN has new commit, build has started.
[16:21:05] Build #4258 was triggered because of new commit, but only one agent can build, so the build waits for now.
[16:22:39] Build #4257 finished.
[16:22:39] Build #4258 starts, because agent is now free.
[16:22:45] Deploy #4257 was triggered, because Build #4257 finished, but can't be started, because Build #4258 is running now.
[16:26:51] Build #4258 finished.
[16:26:51] Deploy #4257 starts, but detects that in snapshot is newer revision than expected. According to its trigger, there should be revision from Build #4257, but instead there is revision from Build #4258. It will perform the clean checkout of snapshot before running its build steps and the built dlls (the wrong newer dlls from build #4258) are deleted.
我们有一个构建配置为 "Build (Trunk)" 和 "Deploy CI (Trunk)" 的团队城市。
"Build (Trunk)" 有一个 VCS 触发器 "Triggers a build after a VCS check-in is detected",其目标是构建用于部署的程序集。
"Deploy CI (Trunk)" 有一个完成构建触发器 "Wait for a successful build in: Build (trunk)" 并依赖于带有选项 "Run build on the same agent" 的 "Build (Trunk)"。
有时 "Build (Trunk)" 成功,dll 在那里(有一个构建步骤检查它)并且 "Deploy (Trunk)" 失败,因为它缺少一些已经构建的部署的 dll(和检查)。
我最终在 "Deploy (Trunk)" 中遇到错误 [MSBuild.ExtensionPack.Framework.Assembly] D:\TeamCity\buildAgent\work\d11b43f69b1be1cb\Source\Product\Build.xml(191, 9): 找不到文件:D:\TeamCity\buildAgent\work\d11b43f69b1be1cb\Source\Product\output\Release\Application\Server\bin\Product.Server.dll
dll 位于 "Build (Trunk)" 的末尾,但不知为何在 "Deploy (trunk)" 中丢失了。另一个构建配置(单元测试)也会出现同样的问题。
发生这种情况时,我通常 运行 使用 "clean all files in the checkout directory before the build" 构建 (T运行k) 并且它有效。我们目前使用的是 TeamCity 10,但它发生在 TeamCity 9 上。
我不知道如何确定根本原因,想就此寻求建议。
您需要设置第一个构建配置以将您创建的工件发布到公共 "Artifacts" 目录,然后在 Deploy 构建配置中创建一个快照依赖项,一旦创建工件,它将 运行 .并在您的第二个构建配置中访问公共位置中的工件。
我想通了(感谢指点)。基本上这是快照依赖和多个触发器的问题。 Deploy 必须具有它期望的正确版本的快照依赖项。如果构建再次为 运行(它与部署有单独的触发器:在新版本上构建),在前者的部署为 运行(单独的触发器:构建完成时)之前,部署会检测到它并执行 VCS 的干净检查:
[16:26:52] : Will perform clean checkout. Reason: The project sources on the agent are newer than requested
但是干净的签出将删除已经在签出目录中的 dll,因此它们不存在以进行部署。
示例(为什么 "Deploy #4257" 失败)- 只有一个代理存在:
[16:17:25] Build #4257 was triggered because SVN has new commit, build has started.
[16:21:05] Build #4258 was triggered because of new commit, but only one agent can build, so the build waits for now.
[16:22:39] Build #4257 finished.
[16:22:39] Build #4258 starts, because agent is now free.
[16:22:45] Deploy #4257 was triggered, because Build #4257 finished, but can't be started, because Build #4258 is running now.
[16:26:51] Build #4258 finished.
[16:26:51] Deploy #4257 starts, but detects that in snapshot is newer revision than expected. According to its trigger, there should be revision from Build #4257, but instead there is revision from Build #4258. It will perform the clean checkout of snapshot before running its build steps and the built dlls (the wrong newer dlls from build #4258) are deleted.