Download the artifact from bamboo using wget.

Ramkumar Muthu May 5, 2017

Hi,

I am using wget to download bamboo artifact using the below command,

wget --http-user='userName' --http-password='*****' 'http://localhost/rest/api/latest/plan/AP-BAF/artifact?os_authType=basic' --no-check-certificate

where AP-BAF is the build plan and that plan has two stages and each stage produce artifacts.I want to download these two artifacts.

When I enter this command in command prompt,it shows the below output,

<?xml version="1.0" encoding="UTF-8" standalone="yes"?><artifacts expand="artifa
cts"><link href="http://localhost/rest/api/latest/plan/AP-BAF
/artifact" rel="self"/><artifacts start-index="0" max-result="0" size="0"/></art
ifacts>

 

When i browse through bamboo and I can see the artifacts produced by the build.

Please help me as this is the high priority.

1 answer

0 votes
Peter Coxhead August 2, 2017

I ended up hitting the login page to acquire valid cookies, then loading those cookies when I requested the artifacts I wanted.  I lost my original wget command (mainly because I typed my password out and didn't want that in my history).  But it was something like below:

Edit: I had to do this query again so here's the working modified version -

wget --save-cookies cookies.txt --keep-session-cookies --no-check-certificate https://bamboo/userlogin\!default.action\?os_destination=%2Fstart.action\&os_username=myusername\&os_password=*****\&os_cookie=true

Then I wrote a bash for loop to grab the individual items I was interested in.

for f in 1.json 10.json 12.json 13.json 14.json 15.json 16.json 18.json 1
9.json 2.json 20.json 21.json 23.json 27.json 28.json 29.json 3.json 30.json 4.j
son 5.json 6.json 7.json 8.json consolidate.json cucumber.json; do wget --no-che
ck-certificate --load-cookies cookies.txt -p -A "*" https://bamboo/browse/OHH-AC
766-1/artifact/ACIR/Cucumber-JSON/$f; done

 I seem to recall it may have had some looping that seemed to be going on forever, but it may have been when I was using the -r flag or something. In any case it should work whether you use the for loop or not.

Suggest an answer

Log in or Sign up to answer