“延迟提交”如何实现?使用源代码控制存储库和 CI 服务器?
我想知道“延迟提交”功能如何在未与源代码控制存储库集成的 CI 服务器上工作。从概念上讲,该过程的工作原理如下:
- 签入代码更改
- CI 服务器构建更改
- 如果构建通过,则代码将提交到源控制存储库
- 如果构建失败,则代码不会提交到源控制存储库
大多数 CI 服务器的工作方式轮询源代码控制存储库以了解更改,然后拉取代码。因此,在延迟提交场景中,开发人员是否会将其代码签入 CI 服务器而不是实际的源代码控制存储库,然后 CI 服务器将代码传递到存储库?或者,如果构建失败,CI 服务器是否只是回滚更改?
我特别想到两个持续集成系统。 Team Foundation Server 将在下一版本中提供此功能,但这是有意义的,因为 TFS 中的 Team Build(CI 系统)与源代码控制存储库集成。然而,就 Team City 而言,TC 能够连接到任何源代码控制系统,并且不一定与源代码控制存储库集成,甚至不一定位于同一服务器上。这是如何运作的?
编辑:对此问题开放赏金,希望我能得到更多可能的答案。
I'd like to know how "delayed commit" functionality works on CI servers that are not integrated with the source control repositories. Conceptually, the process works like follows:
- Check in code changes
- CI server builds the changes
- If the build passes, the code is committed to source control repository
- If the build fails, the code is not committed to the source control repository
Most CI servers work by polling the source control repositories for changes and then pulling down the code. So in the delayed commit scenario, are developers checking their code into the CI server rather than an actual source control repositories and then the CI server is passing on the code to the repository? Or alternatively are the CI servers just rolling back changes if the build fails?
I'm thinking of two continuous integration systems in particular. Team Foundation Server is going to offer this functionality in the next version, but it makes sense because the Team Build (CI system) within TFS is integrated with the source control repository. However, in the case of Team City, TC is able to connect to any source control system and is not necessarily integrated with or even on the same server as the source control repository. How is this working?
Edit: Opening a bounty on this question in the hopes that I can get some more possible answers.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
通常,您必须使用命令行工具或 IDE 插件来将代码提交到 CI 服务器。该工具将您的更改与所有相关的项目/存储库/用户元数据捆绑在一起,启动构建,然后在一切顺利的情况下提交它。
对于 TeamCity,看起来服务器实际上向您的计算机提交了一条批准消息(来自我从图中可以看出),然后它会从那里提交 - 大概这样你就不需要在你的 TC 上拥有每个用户的 SCM 凭据 - 如果你使用 SSH 私钥等,这可能会很复杂服务器。
但是 CI 服务器可以与几乎任何 SCM 系统集成,无论服务器位于何处 - 您只需为其提供正确的凭据即可获得(通常是只读)访问权限。
Generally you have to use a command line tool or an IDE plugin that lets you submit your code to the CI server. The tool bundles up your changes along with all the relevant project/repository/user metadata, starts a build and then commits it if everything goes well.
In the case of TeamCity, it looks like the server actually submits an approval message back to your computer (from what I can tell from the diagram), then it gets committed from there — presumably so you don't need to have each user's SCM credentials — which could be complex if you use SSH private keys etc. — on your TC server.
But CI servers can integrate with pretty much any SCM system, no matter where the server is located — you just need to give it the correct credentials to get (generally read-only) access.
它执行类似的操作:
(来源:kawalerowicz.net)
所以它是客户端计算机提交。不是服务器。在这种情况下,SCM 并不重要。
It does something like that:
(source: kawalerowicz.net)
so it is the client machine that does the commit. Not the server. The SCM does not matter in that case.