将 GitLab 与 TeamCity 集成 [英] Integrating GitLab with TeamCity

查看:35
本文介绍了将 GitLab 与 TeamCity 集成的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

从 GitLab 7.6 或更高版本开始,有一个新选项可以直接从 GitLab 项目中使用 TeamCity.在设置中有这条消息:

Since GitLab 7.6, or thereabouts, there is a new option to use TeamCity directly from GitLab projects. In the setup there is this message:

Teamcity 中的构建配置必须使用构建格式编号%build.vcs.number% 你还需要配置所有的监控分支所以合并请求构建,该设置在 vsc 根目录中高级设置.

The build configuration in Teamcity must use the build format number %build.vcs.number% you will also want to configure monitoring of all branches so merge requests build, that setting is in the vsc root advanced settings.

我不确定这是如何工作的.假设我有一个存储库 Foo.

I'm not sure how this works. Lets say I have a repository Foo.

我已经在 TeamCity 上设置了一个构建来收听带有分支规范的 Foo:+:refs/pull/*/merge

I have setup a build on TeamCity to listen to Foo with branch specification: +:refs/pull/*/merge

然后我在 gitlab 中 fork Foo 作为 FooFork,进行更改,然后请求合并 FooFork -> Foo.

I then fork Foo in gitlab as FooFork, make a change, then request a merge FooFork -> Foo.

但是测试这个合并没有任何反应,这是我期望 GitLab 做的.如果我接受合并,那么构建服务器会(立即)执行并构建两次(master/ref/master).

But nothing happens to test this merge, which is what I was expecting GitLab to do. If I accept the merge than the build server jumps into action (immediately) and builds twice (master and /ref/master).

我还将构建配置设置为完全使用:%build.vcs.number% 作为规定的构建号,但 gitlab 似乎没有给我任何关于构建结果的信息.

I've also set the build configuration to use exactly: %build.vcs.number% as the build number as prescribed, but gitlab doesn't seem to give me any information about the build result.

所以我对这个 GitLab -> TeamCity 集成到底应该做什么以及我是否做错了感到有点困惑.

So I'm a bit confused really as to what exactly this GitLab -> TeamCity integration is supposed to do and whether I'm doing wrong.

我目前正在运行 GitLab 7.9 和 TeamCity 8.1.4

I'm currently running GitLab 7.9 and TeamCity 8.1.4

更新:

似乎在版本 8 之前不支持此用例 - https://github.com/gitlabhq/gitlabhq/issues/7240

Seems this use case was not supported prior to version 8 - https://github.com/gitlabhq/gitlabhq/issues/7240

推荐答案

我正在运行 GitLab 8.0.2 和 TeamCity 9.1.1,并且能够在分支和合并请求上运行 CI 构建.

I'm running GitLab 8.0.2 and TeamCity 9.1.1 and am able to run CI builds on branches and merge requests.

我通过将 VCS 触发器与 branch specification +:refs/heads/(xyz*) 其中 xyz 是我们的工单系统前缀的字符串,因为所有活动的分支都需要以我们的问题跟踪器.

I trigger CI builds for specific branches by setting a VCS trigger together with the branch specification +:refs/heads/(xyz*) where xyz is the string for our ticket system prefix since all active branches need to be named after an entry in our issue tracker.

我通过分支规范 +:refs/(merge-requests/*)

一切都按预期工作,让我们知道所有功能/错误分支的状态并自动合并请求.

Everything works as as expected and lets us know the status of all feature / bug branches and merge requests automatically.

感谢 Rob 的评论链接到合并请求规范中的 GitLab 8 发行说明条目.

Thanks to Rob's comment linking to the GitLab 8 release notes entry on the merge request spec.

这篇关于将 GitLab 与 TeamCity 集成的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆