Bamboo Specs for Bamboo apps - How to offer builders and properties to clients?

bamboo-server

#1

Hi,

I have a Bamboo app with tasks for which I would like to support Bamboo specs. I’m aware of the basic support that AnyTask gives me, but I want to provide type-safe properties and builders (including validation) for my users of the app. According to the official documentation (https://developer.atlassian.com/server/bamboo/how-to-extend-bamboo-specs),

builder and properties class should be in a separate module which depends on bamboo-specs-api

Does anybody know what that exactly means? I guess I have to provide the builders and properties to my users, but I also guess they do not want to get them from some of mine repositories, but instead want to access them when they use

https://bitbucket.org/atlassian/bamboo-specs

Is it possible for Bamboo app vendors to provide builders and properties from that repository? Or how to other vendors do this?

Any help is much appreciated.

Thanks in advance,
Michael


#2

Hi,
That documentation is a bit misleading as there are some additional hoops to jump to make it work.
More to the point:

  • by ‘separate module’ we mean a Maven module that you release to some public Maven repository that people writing specs can add to their pom.xml

  • that module should also be bundled with your plugin so that Bamboo can see it when exporting/importing specs.

Here’s the catch though: by default the classloader Bamboo uses during specs import ignores plugins, so your custom *Properties won’t work. There are 3 ways to solve it:

  • Your custom builders produce AnyTaskProperties instead of custom class. This is still type safe for the Specs users. The drawback is: export to Specs will not use your custome builder (i.e. your tasks will be exported as AnyTask)
  • There’s an experimental ‘dark feature’ switch in Bamboo that enables full plugin support during Specs import. We use it internally at Atlassian for some time now but were reluctant to make it supported feature (due to some classloader magic we had to introduce to make it work). The switch is ‘bamboo.experimental.specs.plugin.enabled’. And the drawback of that of course is that your customers would have to enable the feature.
    It can be enabled using REST:
curl -X PUT <server_url>/rest/admin/latest/darkFeatures/bamboo.experimental.specs.plugin.enabled -u<user>:<password> -H "Content-Type: application/json" -d'{"key":"bamboo.experimental.specs.plugin.enabled","enabled":true}'

And this is the ticket to support it officially: https://jira.atlassian.com/browse/BAM-19841

  • put your specs jar into bamboo classpath. Again sth. your customers would have to do.

I’m sorry that the answer I gave you is most probably not something you wanted to hear, but I hope it helps.


#3

Hi @mgardias,

Thanks a lot for your feedback. I think I’ll go with a plain TaskDefinitionExporter for now which allows me to use Integers/Booleans/etc. instead of Strings where appropriate and also to validate the Specs input. As soon as as plug-in Specs are fully supported, I will definitely consider using them to have a nice custom DSL.

Best regards,
Michael