Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Is there a way to access specific artifact (tarball) though rest api

Leonid Barinstein August 26, 2011

I was wondering if there is a way to access specific artifact (tarball) for the latest successful build, though rest api, using wget.

3 answers

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question

2 votes
Przemek Bruski
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
August 28, 2011

Try:

http://my-ci-server:8080/bamboo/rest/api/latest/result/PROJECT_KEY-PLAN_KEY-latest?expand=artifacts

This will give you access to the artifact list in XML format, including the file name. The prerequisite is that the artifact with tarball is a single file (it can be defined via a wildcard like PROJECT-*.tgz, so you don't need to hardcode it, but it has to resolve to a single file).

Leonid Barinstein August 28, 2011

Great. Thank you very much for your help.

Leonid Barinstein August 28, 2011

Hm…
I don't think I am seeing the right thing.
I am getting the same output as if I were to access just

http://my-ci-server:8080/bamboo/rest/api/latest/result/PROJECT_KEY-PLAN_KEY-BULDNUMBER

Do I have anything misconfigured? My build file is a single .tgz file.

1 vote
Przemek Bruski
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
August 26, 2011

If you are asking about getting a tarballed artifact from a Bamboo Server (i.e. an artifact has a couple/lots of files in it and you want to fetch a single tarball with all the artifac files in it) - no, that's not possible.

Leonid Barinstein August 28, 2011

Przemek,

Thank you for your response.

I was under impression that what I asking for is very trivial and common functionality and Atlassian definitely should work on providing it. TeamCity has it.

What I am looking for is this:

http://my-ci-server:8080/bamboo/browse/PROJECT/latestSuccessful/artifact/SUBPROJECT/Tarball/PROJECT-0.1.BUILDNUMBER.tgz

Tarball is already created and above is the location where the file is. What makes it complicated is to get latest successful build number. That is right before the .tgz. I can go as far as:
http://my-ci-server:8080/bamboo/browse/PROJECT/latestSuccessful/artifact/SUBPROJECT/Tarball/<br< a=""> /> which will display the artifact in the HTML format. Of course I can parse the html, but I am looking for more stable way to handle this.

Right now I am parsing this url to get my latest successful build:
http://my-ci-server:8080/bamboo/rest/api/latest/result/PROJECT?buildstate=Successful&max-results=1
and constructing my url based on the result to look like this:
http://my-ci-server:8080/bamboo/browse/PROJECT-BUILDNUMBER/artifact/SUBPROJECT/Tarball/PROJECT-0.1.BUILDNUMBER.tgz

What I really need is to be able to directly access link like this:
http://my-ci-server:8080/bamboo/browse/PROJECT/latestSuccessful/artifact/SUBPROJECT/Tarball/PROJECT-0.1.LATEST-SUCCESSFUL-BUILDNUMBER.tgz
</span<>>

1 vote
Bob Swift OSS (Bob Swift Atlassian Apps)
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
August 26, 2011

Yes. Bamboo Command Line Interface does this for instance.

Leonid Barinstein August 26, 2011

Thanks Bob. Unfortunately, I am completely ignorant about Bamboo Command Line Interface. What I am trying to do is to write a bash script that gets the file using wget or curl through url like: /bamboo/browse/CMS-CMSS/latestSuccessful/artifact/XXXXXX/Tarball/

Bob Swift OSS (Bob Swift Atlassian Apps)
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
August 26, 2011

Longer answer. Yes, it is possible to get a specific artifact from a specific build or from the latest build. The rest apis are documented here: http://confluence.atlassian.com/display/BAMBOODEV/Bamboo+REST+Resources . There are some release specific differences, make sure you get the right level of document. The Bamboo CLI shields you from that and would be easy to call from your script :). But you can roll your own too. If you use the -v option on the getArtifact action it will show you the URL you need. Or just construct the URL from the documentation.

Bob Swift OSS (Bob Swift Atlassian Apps)
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
August 26, 2011

You could also look at the source for hints, but it covers more generic cases, so is a bit more difficult - https://bitbucket.org/bob_swift/bamboo-cli/src/7087bc062a93/src/main/java/org/swift/bamboo/cli/BambooClient.java

Leonid Barinstein August 28, 2011

Bob,
Thnak you very much for your help.

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question

TAGS
AUG Leaders

Atlassian Community Events