【问题标题】:Unable to download artifact from TeamCity using REST API无法使用 REST API 从 TeamCity 下载工件
【发布时间】:2019-04-02 22:10:16
【问题描述】:

我在从 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 上下载的工件的 url 栏

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

然后我根据那个confluence页面填写REST API调用

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

我总是会收到 404 Page Not Found。只是为了健全性检查,我也尝试过

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

我可以看到一个 url 链接页面,但是当我点击其中任何一个时,我会得到一个 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/ 工作呢?

【问题讨论】:

    标签: rest continuous-integration teamcity jetbrains-ide


    【解决方案1】:

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

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

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2021-11-16
      • 1970-01-01
      • 2022-12-15
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-06-18
      相关资源
      最近更新 更多