[英]Unable to download artifact from TeamCity using REST API
I have having trouble download artifacts from TeamCity. 我无法从TeamCity下载工件。 On TeamCity's confluence page it says to use
在TeamCity的融合页面上,它说要使用
/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
to download the artifacts. 下载工件。 However I would always get a 404 page not found.
但是我总会找不到404页面。 For example, if I look at the url bar for the artifact that I wish to download on TeamCity
例如,如果我查看要在TeamCity上下载的工件的网址栏
https://teamcity.MyServer.com/viewLog.html?buildId=12345&buildTypeId=MyProjectName&tab=artifacts
And then I fill out the REST API call according to that confluence page 然后,我根据该融合页面填写REST API调用
https://teamcity.MyServer.com/repository/download/MyProjectName/.lastSuccessful/12345
I would always get a 404 Page Not Found. 我总是会得到一个404页面未找到。 And just for sanity check I have also tried
为了进行理智检查,我也尝试过
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
but none them it works. 但它们都不起作用。
When I shorten the url to 当我将网址缩短为
https://teamcity.MyServer.com/repository/download/MyProjectName
I can see a page of url links, however when I click on any of them I would get a ERR_CONNECTION_TIMED_OUT, This site can't be reached
我可以看到一个网址链接页面,但是当我单击其中的任何一个
ERR_CONNECTION_TIMED_OUT, This site can't be reached
我都会得到一个ERR_CONNECTION_TIMED_OUT, This site can't be reached
I am currently using How do you programatically download the artifacts from the latest Team City build using C#? 我当前正在使用如何使用C#以编程方式从最新的Team City构建中下载工件? to download the artifacts, but I feel like the official documented way should work.
下载工件,但我觉得官方记录的方式应该可行。
So how do I make /repository/download/
work? 那么,如何使
/repository/download/
工作呢?
ARTIFACT_PATH is a path to a file and not to a folder. ARTIFACT_PATH是文件而不是文件夹的路径。 So the correct URL will be: https://teamcity.MyServer.com/httpAuth/repository/download/MyProjectName/.lastFinished/ARTIFACT_PATH
因此正确的URL将是: https : //teamcity.MyServer.com/httpAuth/repository/download/MyProjectName/.lastFinished/ARTIFACT_PATH
For example, if on Artifacts tab you see the following structure "t100/generic/test.log", then ARTIFACT_PATH is t100/generic/test.log 例如,如果在“工件”选项卡上看到以下结构“ t100 / generic / test.log”,则ARTIFACT_PATH为t100 / generic / test.log
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.