Teamcity 使用参数触发构建
在TC升级至2018年之后 我以前使用参数触发TC构建的脚本不起作用 我们使用的脚本使用以下api: https://[server]/httpAuth/action.html?add2Queue=[build name]&name=[param name]&value=[param value] 我正在尝试迁移到restApi from(): 我试过了 https://[server]/app/rest/buildQueue?locator=buildType:[build name],[param name]:[param value] 目前我有两个问题:Teamcity 使用参数触发构建,teamcity,Teamcity,在TC升级至2018年之后 我以前使用参数触发TC构建的脚本不起作用 我们使用的脚本使用以下api: https://[server]/httpAuth/action.html?add2Queue=[build name]&name=[param name]&value=[param value] 我正在尝试迁移到restApi from(): 我试过了 https://[server]/app/rest/buildQueue?locator=buildType:[build name],[pa
首先,您对TeamCity的文档不清楚。对此, 若要触发生成,必须对此url发出POST请求,并通过正文发送buildType id
http://localhost:8111/httpAuth/app/rest/buildQueue
您还可以将配置参数传递到主体中
带参数的触发器生成的XML正文:
<build><buildType id="YourBuildTypeId"/>
<properties><property name="PARAM1" value="VALUE1"/></properties>
</build>
{
"buildType": {
"id": "YourBuildTypeId"
},
"properties": {
"property": [
{
"name": "PARAM1",
"value": "VALUE1"
},
{
"name": "PARAM2",
"value": "VALUE2"
}
]
}
}
您可以使用下面的curl脚本
curl -X POST \
http://localhost:8111/httpAuth/app/rest/buildQueue \
-H 'Accept: application/json' \
-H 'Content-Type: application/xml' \
-d '<build><buildType id="YourBuildTypeId"/>
<properties><property name="PARAM1" value="VALUE1"/></properties>
</build>'
curl-X POST\
http://localhost:8111/httpAuth/app/rest/buildQueue \
-H'Accept:application/json'\
-H'内容类型:应用程序/xml'\
-d'
'
升级到TC 2018后,我们的脚本在上面的GET调用中开始失败。将其更改为POST call解决了该问题。无需迁移到新的TC REST API,因为它仍然向后兼容。