Command line 如何使用RESTAPI从命令行触发TeamCity构建?
我试图从命令行触发TeamCity构建。 首先,我试着:Command line 如何使用RESTAPI从命令行触发TeamCity构建?,command-line,teamcity,Command Line,Teamcity,我试图从命令行触发TeamCity构建。 首先,我试着: curl http://<user name>:<user password>@<server address>/httpAuth/action.html?add2Queue=<build configuration Id> build.xml示例: build.xml <build> <buildType id="buildConfID"/> </b
curl http://<user name>:<user password>@<server address>/httpAuth/action.html?add2Queue=<build configuration Id>
build.xml示例:
build.xml
<build>
<buildType id="buildConfID"/>
</build>
build.xml
对于我来说,不清楚我应该把配置好的build.xml放在哪里?curl-u用户:password-X POST\
curl -u user:password -X POST \
https://teamcity.host.io/app/rest/buildQueue \
-H 'Accept: application/json' \
-H 'Content-Type: application/xml' \
-H 'Host: teamcity.host.io' \
-d '<build branchName="refs/heads/master">
<triggeringOptions cleanSources="true" rebuildAllDependencies="false" queueAtTop="false"/>
<buildType id="Test_Configuration_ID_for_trigger"/>
<lastChanges>
<change locator="version:e2418b4d7ae55ac4610dbff51bffe60d1f32e019"/>
</lastChanges>
<properties>
<property name="env.startedBy" value="build was triggering from %teamcity.serverUrl%/viewLog.html?buildId=%teamcity.build.id%"/>
</properties>
</build>'
https://teamcity.host.io/app/rest/buildQueue \
-H'Accept:application/json'\
-H'内容类型:应用程序/xml'\
-主持人:teamcity.Host.io'\
-d'
'
您可以跳过lastChanges
,在最新更改的基础上运行构建curl-u用户:password-X POST\
https://teamcity.host.io/app/rest/buildQueue \
-H'Accept:application/json'\
-H'内容类型:应用程序/xml'\
-主持人:teamcity.Host.io'\
-d'
'
您可以跳过lastChanges
以在最新更改上运行构建curl--data binary
标志将文件名作为相对或绝对路径(请参阅),因此它将在根目录中查找build.xml文件。您还可以通过执行curl--data binary@path/to/file
来指定绝对路径--data binary标志将文件名作为相对或绝对路径(请参阅),因此它将在根目录中查找build.xml文件。您还可以通过执行以下操作指定绝对路径:--data binary@path/to/file
curl -u user:password -X POST \
https://teamcity.host.io/app/rest/buildQueue \
-H 'Accept: application/json' \
-H 'Content-Type: application/xml' \
-H 'Host: teamcity.host.io' \
-d '<build branchName="refs/heads/master">
<triggeringOptions cleanSources="true" rebuildAllDependencies="false" queueAtTop="false"/>
<buildType id="Test_Configuration_ID_for_trigger"/>
<lastChanges>
<change locator="version:e2418b4d7ae55ac4610dbff51bffe60d1f32e019"/>
</lastChanges>
<properties>
<property name="env.startedBy" value="build was triggering from %teamcity.serverUrl%/viewLog.html?buildId=%teamcity.build.id%"/>
</properties>
</build>'