无法使用REST API从TeamCity下载工件

时间:2018-10-29 22:11:32

标签: rest continuous-integration teamcity jetbrains-ide

我无法从TeamCity下载工件。在TeamCity's confluence page上说要使用

/repository/download/BUILD_TYPE_EXT_ID/.lastFinished/ARTIFACT_PATH
/repository/download/BUILD_TYPE_EXT_ID/.lastSuccessful/ARTIFACT_PATH
/repository/download/BUILD_TYPE_EXT_ID/.lastPinned/ARTIFACT_PATH

下载工件。但是我总会找不到404页面。例如,如果我查看要在TeamCity上下载的工件的网址栏

https://teamcity.MyServer.com/viewLog.html?buildId=12345&buildTypeId=MyProjectName&tab=artifacts

然后我根据该合流页面填写REST API调用

https://teamcity.MyServer.com/repository/download/MyProjectName/.lastSuccessful/12345

我总是会得到404页面未找到。只是为了进行理智检查,我也尝试过

https://teamcity.MyServer.com/httpAuth/repository/download/MyProjectName/.lastFinished/artifact_folder.zip
https://teamcity.MyServer.com/httpAuth/repository/download/MyProjectName/.lastFinished/artifact_folder
https://teamcity.MyServer.com/httpAuth/repository/download/MyProjectName/.lastFinished/httpAuth/app/rest/builds/id:1234/artifacts/children/artifact_folder/v0.1.3

但它们都不起作用。

当我将网址缩短为

https://teamcity.MyServer.com/repository/download/MyProjectName

我可以看到一个网址链接页面,但是当我单击其中的任何一个时,我都会得到一个ERR_CONNECTION_TIMED_OUT, This site can’t be reached

我目前正在使用How do you programatically download the artifacts from the latest Team City build using C#? 下载工件,但是我觉得官方记录的方式应该可以工作。

那我如何使/repository/download/工作?

1 个答案:

答案 0 :(得分:0)

ARTIFACT_PATH是文件而不是文件夹的路径。 因此正确的URL将是: https://teamcity.MyServer.com/httpAuth/repository/download/MyProjectName/.lastFinished/ARTIFACT_PATH

例如,如果在“工件”选项卡上看到以下结构“ t100 / generic / test.log”,则ARTIFACT_PATH为t100 / generic / test.log