From time to time I simply want to login to our Tomcat server and pull down an Artifact directly from Bamboo. I attempted to do this using the WGET command from the server's command line calling the link like so:
wget url.war
But I always get a response like HTTP request sent, awaiting response... 302 Moved Temporarily
As the Bamboo Cloud server is password protected I attempted to insert my username and password just before the path but no luck. Is there a wiki on best practices to get the outcome I am after?
Stuff it ... i just used a curl command instead:
curl -O https://atlassianusername:atlassianpassword@atlassiancompanyname.atlassian.net/builds/blahblah.war
A HTTP 302 response code is a redirect. You need to specify to wget to follow redirects via some command option.
Like other's have said, I use curl so can't provide the specific option to help, but I'm sure the man page or google will tell you.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
How can I download artifact from url using wget comand.when I used it downloaded the page response insted of war file
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
After upgrading to 6.10.4 - not able to download shared artifacts using curl any more.
Any suggestions?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Were you able to find a resolution? We need to be able to download artifacts vi cmd.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
you can use the following powershell script for download specific artifact
$userpass="username:password"
$bytes= [System.Text.Encoding]::UTF8.GetBytes($userpass)
$encodedlogin=[Convert]::ToBase64String($bytes)
$authheader = "Basic " + $encodedlogin
$headers = New-Object "System.Collections.Generic.Dictionary[[String],[String]]"
$headers.Add("Authorization",$authheader)
$uri = "http://your_bamboo_url/browse/{projectKey}-{buildKey}/artifact/shared/Student-Core-Artifact/file.zip"
$response = Invoke-WebRequest -Uri $uri -Headers $headers -Outfile "downloaded_file.zip"
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I ended up using
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
to save cookies and then use '--load-cookies cookies.txt' in subsequent requests to download the artifacts.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
As others have suggested before, I also find it easier to use curl:
curl -u username:password -k -g "https://bamboo.server/browse/PROJTRUNK-CODEQA-123/artifact/shared/War-files/
The -u flag in curl is "nice" in that it handles most username/password challenges correclty. Plus, you can always add a -L flag if you need to.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
but how to solve this on windows machine ? when using curl or wget (which are basically just other names for Invoke-Webrequest) it will actually only download the html page and not the actual artifact. Please help me fellas:((
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Not to nit pick, but I'm pretty darned sure that curl and wget substantially predate any Invoke-Webrequest that existed probably by more than 10 years (EDIT: it was 8 or 10 years). curl is available as a standalone runner from curl's website.
As a side note, have you looked at the html that comes back? Is it a login challenge page? Or something similar?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You can use something like this via wget:
$ wget -r -A war http://bambooserver.mydom.com/browse/PROJTRUNK-CODEQA-123/artifact/shared/War-files/
This will download all the .war files from that URL and store them under a sub-dir mirroring the above URL's structure.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Wget for whatever reason leads to my above mentioned problem 302 moved temporarily. CURL is the only method I have found to get this to connect to an Atlassian cloud server and download the .war file
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello Peter,
Thank you for your question.
Are you able to download "url.war" (which is giving you status 302) through the UI?
Could please attempt on downloading the artifact from UI and later using wget command, please?
—
Kind regards,
Rafael P. Sperafico
Atlassian Support
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Rafael Sperafico yes ...yes of course no worries or troubles downloading the artifacts from the Bamboo Cloud website / UI ..all works well and has done so for many years. We are now trying to get a server in our data center to download the artifacts directly so we don't have to first download to our local machines and then re-upload to the data center. We don't want to set a task to push the artifacts to the server ..we simply want to be able to use a command line option like WGET to pull down the artifact to the Linux machine. The 302 error comes when we execute the WGET command. The command is more or less like this: wget login:password@atlassian.net/builds/blahblahblah/myfile.war
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello Peter, When you say: "...first download to our local machines and then re-upload to the data center..." how are you downloading to the local machine? Are you able to do a "wget" from those local machines? Is the artifact "shared" or "unshared"? wget https://[company].atlassian.net/builds/browse/PROJ-PLAN-1/artifact/shared/Greeting/HelloWorld.jar — Kind regards, Rafael P. Sperafico Atlassian Support
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.