TeamCity REST API获取挂起的更改列表

时间:2014-02-10 09:22:13

标签: rest teamcity teamcity-8.0

是否有REST API端点来获取TeamCity中构建的待处理更改集合?

我们将构建设置为手动,并在TeamCity外部触发,并希望显示该构建中的提交的项目符号列表。

在用户界面中,您可以在“待更改(X)”标签下看到此内容。

我找不到任何这样做的例子,我发现的最接近的是:

http://<server>/httpAuth/app/rest/changes/buildType:<build type id>

这似乎是最后一次改变。

之前有人这样做过吗?

2 个答案:

答案 0 :(得分:13)

由于这个问题,我刚刚找到了一个有效的解决方案。我会在这里展示,以防其他人正在寻找完整的解决方案:

您需要知道要获取待处理更改的构建的buildTypeId。在这种情况下,我们可以说buildTypeId=bt85

1
    http://<server>/httpAuth/app/rest/buildTypes/id:bt85/builds/
    // Get the last build from the XML returned.
    // Lets say last build id = 14000

2

    http://<server>/httpAuth/app/rest/changes?build=id:14000
    // The newest change returned is the one you need.
    // Lets say newest change id = 15000

3

    http://<server>/httpAuth/app/rest/changes?buildType=id:bt85&sinceChange=15000
    // You're now looking at the pending changes list of the buildType bt85

答案 1 :(得分:3)

我最终的解决办法是:

从我在TeamCity之外的构建数据库中查找最新的更改ID(我想您可以查询TeamCity API以查找上一次成功的构建并从那里获取)

然后致电:

http://<server>/httpAuth/app/rest/changes?buildId=id:<build id>&sinceChange=id:<last change id>

然后从该列表中获取每个单独的更改。

一些解决方法,但无论如何我都看不到要获取待处理更改的列表。

相关问题