【问题标题】:Teamcity API, Status of build configurations in a projectTeamcity API,项目中构建配置的状态
【发布时间】:2017-11-29 10:27:00
【问题描述】:

我正在尝试查找是否有任何 API 方法或调用可以让我获得最新构建配置的状态,例如最新构建仍在运行,已排队成功。

我只能获得最后一次成功构建的详细信息,而不是构建的状态。

http://<TeamcityServer>/httpAuth/app/rest/builds/buildType:(id:BUILDTYPE),status:SUCCESS

【问题讨论】:

标签: rest teamcity


【解决方案1】:

为了知道构建是排队、运行还是完成,您应该获取state 的值,而不是status

http://<TeamcityServer>/httpAuth/app/rest/builds/?locator=buildType:<BuildType>,state:any,branch:default:any,count:15

buildType:在您的配置中给出的名称,以项目为前缀。

state:可能的值是:待定、排队、运行。

branch: 如果您的分支配置可能在多个分支上运行,您可能需要指定它。否则,只有default 分支会出现在结果中。

count:此处设置任意限制。

结果是:

<builds count="5" href="/guestAuth/app/rest/builds/?locator=buildType:A_B,state:any,branch:default:any,count:5" nextHref="/guestAuth/app/rest/builds/?locator=buildType:A_B,state:any,branch:(default:any),count:5,start:5">
    <build id="3767209" buildTypeId="A_B" state="queued" branchName="refs/heads/master" defaultBranch="true" href="/guestAuth/app/rest/buildQueue/id:3767209" webUrl="http://<TeamCityServer>/viewQueued.html?itemId=3767209"/>
    <build id="3767307" buildTypeId="A_B" state="queued" branchName="5566" href="/guestAuth/app/rest/buildQueue/id:3767307" webUrl="http://<TeamCityServer>/viewQueued.html?itemId=3767307"/>
    <build id="3767394" buildTypeId="A_B" state="queued" branchName="5558" href="/guestAuth/app/rest/buildQueue/id:3767394" webUrl="http://<TeamCityServer>/viewQueued.html?itemId=3767394"/>
    <build id="3767425" buildTypeId="A_B" state="queued" branchName="5563" href="/guestAuth/app/rest/buildQueue/id:3767425" webUrl="http://<TeamCityServer>/viewQueued.html?itemId=3767425"/>
    <build id="3766826" buildTypeId="A_B" number="7398" status="SUCCESS" state="running" running="true" percentageComplete="42" branchName="5570" href="/guestAuth/app/rest/builds/id:3766826" webUrl="http://<TeamCityServer>/viewLog.html?buildId=3766826&buildTypeId=A_B"/>
</builds>

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2016-12-14
    • 2014-09-23
    • 1970-01-01
    • 2016-10-29
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多