本文介绍了将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:

我不确定这是如何工作的.可以说我有一个仓库Foo.

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

我已经在TeamCity上建立了一个构建,以使用分支规范+:refs/pull/*/merge

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

然后我在gitlab中将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触发器以及分支规范 +: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集成的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-21 07:57