Automating Bamboo operations using wget or Curl
Platform Notice: Data Center Only - This article only applies to Atlassian products on the Data Center platform.
Note that this KB was created for the Data Center version of the product. Data Center KBs for non-Data-Center-specific features may also work for Server versions of the product, however they have not been tested. Support for Server* products ended on February 15th 2024. If you are running a Server product, you can visit the Atlassian Server end of support announcement to review your migration options.
*Except Fisheye and Crucible
Some operations in Bamboo require the accumulation of server-side state (in the user's session), and span multiple page requests. For this, you will need to store and reuse a cookie to tie multiple requests together.
With wget, this can be done as follows: admin@admin
1
$ wget \--save-cookies cookies.txt \--post-data 'os_username=admin&os_password=admin&os_cookie=true' 'http://localhost:8085/bamboo/userlogin\!doDefault.action'
This command performs the initial request to log you into your Bamboo instance and also create a file in your home directory called cookies.txt.
So for any further requests you just need to reference the cookies.txt file and use a normal URL without appending any user details:
admin@admin
1
$ wget \--load-cookies cookies.txt \-p 'http://localhost:8085/bamboo/build/admin/triggerManualBuild.action?buildKey=TEST-DEF'
With curl, first use --cookie-jar
to save the cookies on login:
1
$ curl \-u admin:admin \--cookie-jar cookies.txt 'http://localhost:8085/bamboo/userlogin!doDefault.action?os_authType=basic' \--head
Then use --cookie cookies.txt
on subsequent requests.
Was this helpful?