【问题标题】:TeamCity 8.1.2 REST API: Get the running build of the specified build configurationTeamCity 8.1.2 REST API:获取指定构建配置的运行构建
【发布时间】:2020-06-15 00:21:02
【问题描述】:

我正在使用 TeamCity 8.1.2 REST API,我想检查我的构建配置中是否有正在运行的构建。

要在队列中构建,我可以使用以下请求:

> http://<tc_address>/app/rest/latest/buildQueue/?locator=buildType:<my_buildTypeId>

它返回队列中的构建,但不返回正在运行的构建。

根据文档https://confluence.jetbrains.com/display/TCD8/REST+API 来运行构建,可以使用此请求:

> http://<tc_address>/app/rest/builds/?locator=buildType:<my_buildTypeId>,running:true

但它不返回任何构建。我试过了

http://<tc_address>/app/rest/builds/?locator=running:true

从其他构建配置返回正在运行的构建,但未列出来自我的构建配置的正在运行的构建。

【问题讨论】:

    标签: teamcity teamcity-8.0


    【解决方案1】:

    您的 API 调用是正确的,但您似乎缺少某些配置。

    检查给定问题的以下设置:

    -> Go to Build Configuration
    
        -> Edit Configuration Settings
    
            -> General Settings
    
                -> Build options
    
                    -> Enable status widget [Check this checkbox]
    

    之后检查 API 调用

    【讨论】:

    • 启用状态小部件已被选中。我认为它与 REST API 无关。
    • 查看Status-Widget的使用情况