Is there a way to specify a revision number to update to when a build is started from bamboo?

I need a way to specify a specific SVN revision number to update the working copy to when a build on bamboo starts. Currently it defaults to the HEAD revision but I do not want it to use that in this case.

I am trying to run in-depth regression tests, using a separate build machine, on the latest succesful build artifacts from a different build machine. If it uses the HEAD revision, there is the possibility that another build from the other machine has started (thus updating the repository), and placing the artifacts this build is using out of synch with the repository it is using (which contains the regression tests)

3 answers

I found another way. It's not as elegant as I'd like, but it works. Accessing the runParametrisedManualBuild.action directly via post and passing in the items.


curl -X POST  http://{bambooBaseURL}/ajax/runParametrisedManualBuild.action?os_authType=basic&planKey=MYCHANGSETBUILD&customRevision=63781

0 votes

What do you mean by "build machine"? Are these Bamboo agents?

Yeah, different plans using different agents on separate computers.

As an alternate route to doing this, I've tried using the REST API to manually queue a build and pass in a custom svn revision number as a variable through a python script like

encoded_query_args = urllib.urlencode({'Basic username' : username, 'password' : password})
urllib2.urlopen('http://.../rest/api/latest/queue/{PLANKEY}-{BUIILDKEY}?os_authType=basic&custom.svn.revision.number=10', encoded_query_args)

With {PLANKEY} and {BUILDKEY} replaced with our actual plan and build keys. I've also removed the encoded data as an argument and tried a few other things to get it to work but I either get 401: Unauthorized errors or 405: Method Not Allowed errors. The username and password passed in are correct and can manually kick off a build through bamboo online.

Well, I've got the authorization working now. I had to make some changes to the above python script. However, passing in bamboo.variable.repository.revision.number=x or bamboo.variable.custom.svn.revision.number=x does not actually change the revision number it updates from. It still uses the HEAD revision. Any solution?

Hello Nicolas,

Regarding your question: I don't think so. At least not out of the box.

If I understand correctly you would like to run a manual build, but using a custom revision (for example r1234) instead of the revision detected by Bamboo (let's assume Bamboo detects r2345). Thing is, that Bamboo's "Source Checkout Task" is using the revision detected by Bamboo (so it would be r2345 in our case) - that revision is also read-only accessible via Bamboo Variable "bamboo.repository.revision.number", but changing it actually doesn't impact the "Source Checkout Task" logic - it would still use internally detected "r2345".

However, if you would get rid of "Source Checkout Task" and instead used own "Script Task" to retrieve SVN sources, you could probably go with something like:


customRevision=${} <-- set this variable as Plan Variable in Plan Configuration

if (customRevision is not empty) then targetRevision=$customRevision

svn co repoUrl -r $targetRevision

But that would leave you without all the 'goodness' from Bamboo like authenticating to repoUrl and other things. So I'm not sure if that's the feasible solution at all.

What do you think about that? Maybe your use-case is a little bit different?

Hmm, yeah this seems to work. We just need to figure out how to use a script that passes the revision number we want (determined using python) to set that custom variable, while retaining our ability to keep this build running continuously unless it breaks. Using our script right now, we can get an initial build going, using a custom svn revision number, and have it pass, but we can't start another one for some reason. Another queue at the end of the build, using the REST API queue functionality, gives a http 400 error (bad request, or something like that) so I guess you can't queue while it's running. And if we use Bamboo's built in functionality to start itself, then we can't use the REST API to queue it and start it, thus eliminating our ability to pass in the custom variable (which changes, it isn't a constant revision number).

EDIT: I suppose we could make a script that gets the custom revision number, passes it to the batch file that updates the SVN, and then go from there.

regarding "400 error when issuing next queuing via REST" - can I ask you if you had set up 'concurrent builds' in your Bamboo instance? - I'm wondering if the 400 error is thrown because you're hiting the 'concurrent' limit for that particular plan... Can you check it?

Suggest an answer

Log in or Sign up to answer
Community showcase
Posted Monday in Confluence

Organizing your space just got easier - Page Tree Drag & Drop is here

Hi Community! I’m Elaine, Confluence Product Manager. You may have read my earlier post about page tree in space navigation sidebar. I'm excited to share another improvement that helps you organize ...

139 views 3 4
Join discussion

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you