Can a Release be created programatically
Asked by Manuel Mall:

We a have a special "Release Build Plan" that produces the artifacts and tags the release in the VCS. This is a manually invoked plan as it requires a release identifier as custom input.

However, this plan still doesn't create a Release in Bamboo instead we still have to go in and manually create a Release that associates the outputs (artifacts) of that build with a Release.

Can this be automated in some fashion, prefereably as the last task of our "Release Build Plan"?


Answers:
author: Marcin Gardias
body: You can configure release naming in Deployment Project configuration. It is possible to use variables inside release names.

comments: author: Manuel Mall
body: I thought so - but I am not sure that matches our needs. Our release name is set as part of the Release Build Plan as it goes into the VCS tag, as well as certain manifest files are updated based on it which then embeds it into the artifacts (jar files) generated and so on. So it has to "somehow flow" from the Release Build Plan into the trigger for the dummy deployment build. Is there a way of doing that, e.g. can the Release Build Plan set a global variable that we can then reference in the Deployment Project Release naming configuration?

Thanks for listening.


author: Marcin Gardias
body: \> This is a manually invoked plan as it requires a release identifier as custom input.

Reading this I was under impression that you use "Run customised..." and define release name as a variable there. If that's the case then it should work 'out of the box', just use the same variable name for Release name in Deployment Project.

All the variables' values (including manually defined ones) are saved \& passed to the Deployment when you create a new release from a build result.


author: Manuel Mall
body: \> All the variables' values (including manually defined ones) are saved \& passed to the Deployment when you create a new release from a build result.

I wasn't aware off this - thanks a lot


author: Marcin Gardias
body: ATM The solution to this is hacky but possible. You can do this in the following way:

- In your Deployment Project create a dummy environement. Remove the default task (you won't need them) and add a simple Script Task that does nothing (exit 0 will do)

- Configure After Successful Plan trigger in your dummy Environment.

If you do this, every time the Release Build Plan ends sucessfully (including all the manual stages if you have those), the trigger will pick up the build result, **create a release** and launch the dummy environment.

comments: author: Manuel Mall
body: Thanks for the prompt response. I will give this a go. When a Deployment Plan is triggered like this and creates a release automatically how does it decide on the Release Identifier to use?


author: Joseph Strauss
body: What about if you want this to happen for all branches of a plan? This option only lets you configure one branch to deploy to your dummy environment.


author: Ron Chan
body: I fully agree with Mark, being "stuck" is absolutely correct. Why was releasing from branches not (and why can it not be) created with flexibility in the versioning scheme?

comments: author: Dimitri Tischenko
body: Is it possible to auto-create a release from a new branch with this approach? I am trying and failing. I want Bamboo to auto-create a release when a new branch appears at a certain path in Subversion.


author: Mark Brodziak
body: I'm automatically creating releases on successful branch builds, as well as on the default branch. The deployment project that initiates the auto-release needs multiple triggers to handle this. I have had to manually define this trigger after the branch is created, though - so it may not work for you if you want it to be fully automatic.


author: Dimitri Tischenko
body: Indeed, I would like a release to be auto-created when a new branch is committed into .../tags directory. Too bad this is impossible as of now.


author: Mark Brodziak
body: Yes, this triggered deployment approach works - to an extent. However, if you want to create releases from a branch, you are stuck with the default versioning scheme - as far as I can work out.


author: Alex Endfinger
body: \<3 you Atlassian Products!