【发布时间】:2019-11-09 10:42:42
【问题描述】:
我正在尝试从命令行触发 TeamCity 构建。 首先,我尝试了:
curl http://<user name>:<user password>@<server address>/httpAuth/action.html?add2Queue=<build configuration Id>
但在最新版本的 TeamCity 中,此方法已被删除,响应如下:
405 此请求只允许使用 POST 方法。
因此,根据来自https://www.jetbrains.com/help/teamcity/rest-api.html#RESTAPI-BuildRequests 的信息,它应该以这种方式通过 REST API 工作:
url -v -u user:password http://teamcity.server.url:8111/app/rest/buildQueue --request POST --header "Content-Type:application/xml" --data-binary @build.xml
build.xml 示例:
build.xml
<build>
<buildType id="buildConfID"/>
</build>
我不清楚我应该将配置好的 build.xml 放在哪里?
【问题讨论】:
-
curl
--data-binary标志将文件名作为相对或绝对路径(参见 here ),因此它会在根目录中查找您的 build.xml 文件。您还可以按照this answer 执行--data-binary @path/to/file来指定绝对路径
标签: command-line teamcity