Can I download Bamboo built artifacts using Bamboo Rest - API?

流过昼夜 提交于 2020-01-03 13:32:41

问题


This page states:

Bamboo's REST APIs provide the following capabilities:

  • Retrieve the artifacts for a build.

and here I see the documentation:

http://myhost.com:8085/bamboo/rest/api/latest/plan/{projectKey}-{buildKey}/artifact [GET]

When I try this link with the bamboo server I have, like:

https://my.bamboo.server/rest/api/latest/plan/MY-PLAN/artifact

All I get is:

<artifacts expand="artifacts">
    <link href="http://my.bamboo.server/rest/api/latest/plan/MY-PLAN/artifact" rel="self"/>
    <artifacts start-index="0" max-result="0" size="0"/>
</artifacts>

So am I understanding the REST documentation completely wrong, or is there something wrong possibly with MY-PLAN and this link is supposed to provide me a war file as I expect?


回答1:


I'm afraid you are misunderstanding the REST documentation; by "Retrieve the artifacts for a build", it means "retrieves information about the build artifacts defined for a given plan". As you have already seen, all you get back is an XML or JSON document describing the artifacts defined.

If you want to download an actual build artifact, you'll need to write a script that uses /rest/api/latest/result/ to get the latest successful build info and, from that, form an actual download link to the artifact.




回答2:


There are some issues related to your question: https://jira.atlassian.com/browse/BAM-11706 and BAM-16315 (which was deleted, because it contained customer details)




回答3:


You've the link

<link href="http://my.bamboo.server/rest/api/latest/plan/MY-PLAN/artifact" rel="self"/>

Using curl you can download the artifact.

curl --user ${username}:{password} http://my.bamboo.server/rest/api/latest/plan/MY-PLAN/artifact


来源:https://stackoverflow.com/questions/39072200/can-i-download-bamboo-built-artifacts-using-bamboo-rest-api

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!