Automating Bamboo operations using wget or Curl
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
$ 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
$ 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:
$ 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.