【问题标题】:TeamCity REST API get list of pending changesTeamCity REST API 获取待处理更改列表
【发布时间】:2014-02-10 09:22:12
【问题描述】:

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

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

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

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

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

这似乎返回了最后的更改。

以前有人做过吗?

【问题讨论】:

    标签: rest teamcity teamcity-8.0


    【解决方案1】:

    感谢这个问题,我刚刚找到了一个可行的解决方案。如果其他人正在寻找完整的解决方案,我会在这里展示它:

    您需要知道要在其上获取待处理更改的构建的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
    

    【讨论】:

    • 不幸的是,最新版本可能没有任何更改,然后此方法会中断。确实应该有一种方法可以获取“待定更改”列表中的任何内容。
    • 正在修改我之前的评论...如果所讨论的构建类型的构建次数为零,则此方法会中断。请务必检查这种情况。
    【解决方案2】:

    我的最终解决方案是:

    从我的 TeamCity 外部构建数据库中查找最新的更改 ID(我想您可以查询 TeamCity API 以找到最后成功的构建并从那里提取)

    然后调用:

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

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

    有一点解决方法,但无论如何我都无法获取待处理更改的列表。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-06-03
      • 2010-11-10
      相关资源
      最近更新 更多