Bamboo create plan using add on
Asked by Neil_Beukes:

Hi, i am using a trial of the Bob swift CLI to automate the creation of plans. but that tool is really expensive and im only using one of its commands. Thus a feels like a waste at that price. The API does not support the creation of plans so the only other option is creating my own Add On. Any pointers on this please how it can be done and whether it is possible and even worth it?

Thanks in advance


Answers:
author: Steffen Opel _Utoolity_
body: While you could certainly achieve this by [developing a Bamboo add-on](https://developer.atlassian.com/bamboodev), I think it is not worth the effort anymore, given the new [Bamboo Specs](https://confluence.atlassian.com/bamboo/bamboo-specs-894743906.html) are readily available in [Bamboo 6](https://confluence.atlassian.com/bamboo/bamboo-6-0-release-notes-894743804.html) to programmatically create (and maintain) plans via [configuration as code](https://confluence.atlassian.com/bamboo/what-is-configuration-as-code-894743909.html):

*Configuration as code is now available in Bamboo! You can start storing your build plan configuration as code for easier automation, change tracking, validation, and much more. Read all about other benefits of using configuration as code in [Bamboo Specs](https://confluence.atlassian.com/bamboo/bamboo-specs-894743906.html). We've also prepared a [tutorial](https://confluence.atlassian.com/bamboo/tutorial-create-a-simple-plan-with-bamboo-specs-894743911.html) that will help you create a simple plan in no time. For behind-the-scenes information about the Bamboo Specs library, see our detailed reference documentation.*

Here's an example (the [Bamboo Specs reference](https://docs.atlassian.com/bamboo-specs-docs/latest/) has more details):

```
private Plan createPlan() {    return new Plan(            project(),            "Plan Name", "PLANKEY")            .description("Plan created from (enter repository url of your plan)")            .stages(                    new Stage("Stage 1")                            .jobs(new Job("Run", "RUN")                                    .tasks(                                            new ScriptTask().inlineBody("echo Hello world!"))));}
```

comments: author: Neil_Beukes
body: thanks for your answer aswell, will defnitely try it out. one last question can specs be used to create a new project in bamboo?

So to get it straight, specs can be used in an external program such as java and contact a bamboo instance on your network?


author: Steffen Opel _Utoolity_
body: *Can specs be used to create a new project in bamboo?*   

Certainly, have a look at the [Project](https://docs.atlassian.com/bamboo-specs-docs/latest/#project) reference.  

*Specs can be used in an external program such as java and contact a bamboo instance on your network?*

Yes, that's in fact the main operation modus right now - for example, if you create a Bamboo Specs progam via a Maven archetype as per the [tutorial](https://confluence.atlassian.com/bamboo/tutorial-create-a-simple-plan-with-bamboo-specs-894743911.html), you will get an executable Java program that does just that.


author: Neil_Beukes
body: Awesome, maven is perfect, ill post back if i have any more questions, thanks so much for quick responses.


author: Neil_Beukes
body: Morning Steffen,

So i followed the tutorial and bamboo specs is great ! thanks so much for the suggestion. one last thing in the documentation it says a plan can do this :

"Specifies who has permission to view and configure the plan and its jobs."

but i cant seem to find this functionality in the methods that plan has. Do you have any knowledge whether its possible to give a specific user/users access to this newly created plan/project using specs?

Regards


author: Steffen Opel _Utoolity_
body: Good catch, hadn't realized that phrase yet - given the [Bamboo Specs API reference](https://docs.atlassian.com/bamboo-specs/latest/) has no notion of permissions either as of release 6.0.1, I'm afraid that's one of the still not supported aspects, like notifications and deployment projects.  

And now that I state this, I seem to recall that permissions have indeed been mentioned to be missing still at Summit Europe 2017, maybe Piotr can conmment on this and a resp. ETA?


author: Piotr Swiecicki
body: Take a look at [Bamboo Specs](https://confluence.atlassian.com/bamboo/bamboo-specs-894743906.html) released in Bamboo 6.0, I believe this is what you are looking for. It allows you to represent your plans as a code and submit that code to a running Bamboo instance to get your plan created/updated.

Hope that helps,

comments: author: Neil_Beukes
body: thanks for your awnser. can specs be used to create a new project in bamboo?


Tags: automation

developer

plan