Error in implementing bamboo-specs feature for a plugin
Asked by Kapil Gupta:

I am trying to add bamboo-specs feature to [matlab-bamboo-plugin](https://github.com/mathworks/matlab-bamboo-plugin) so that users can specify their build configuration as a YAML file. While doing so, I am not able to verify the implemented changes on my bamboo local dev instance. The implemented changes are available [here](https://github.com/mathworks/matlab-bamboo-plugin/tree/kapilg/bamboo-specs).

* Is there any limitation for using bamboo-specs with a local instance? If not, am I missing something in my implementation?
* What would be the task name when mentioning a task (from this plugin) in the YAML file (the key for \<taskName\> task in this plugin is  
  "com.mathworks.ci.matlab-bamboo-plugin:\<taskName\>")?

Any sort of guidance would be appreciated, thanks!

(FYI the plugin is **not available** on the Atlassian Marketplace. The users download the jar file from the mentioned repository and upload it to their bamboo)


Answers:
author: Eduardo Alvarenga
body: Hello [@Kapil Gupta](/t5/user/viewprofilepage/user-id/5223282),

Each app needs to implement its own Export methods so Bamboo can use them to build its Java and YAML Specs.

First, try to [export your Plan to YAML Specs](https://confluence.atlassian.com/bamboo/exporting-existing-plan-configuration-to-bamboo-yaml-specs-1018270696.html) and use it as a model. If the app configuration doesn't show up on the YAML code, try [exporting to Java Specs](https://confluence.atlassian.com/bamboo/exporting-existing-plan-configurations-to-bamboo-specs-894743917.html).

If you can export the Plan configuration to Java Specs and it contains the instructions for your Matlab app, you can try following the instructions on the KB below and adapt to your YAML code (not guaranteed to work):

* [How to generate YAML Specs for any-task configurations](https://confluence.atlassian.com/bamkb/how-to-generate-yaml-specs-for-any-task-configurations-1052641946.html)

Kind regards,

Eduardo Alvarenga  
Atlassian Support APAC

**--please don't forget to Accept the answer if the reply is helpful--**

comments: author: Kapil Gupta
body: Hey [@Eduardo Alvarenga](/t5/user/viewprofilepage/user-id/4365410) ,

Thanks for your reply!

I have implemented export methods for all my tasks (three in our MATLAB plugin). When I try to export my plan to Java Specs, it does show me my task's conversion (see image1 below), but when I try to export my plan to YAML specs instead of using a keyword related to my task, it uses any-task keyword along with the key to convert the plan to specs (see image2 below).

**IMAGE 1:**

![Screenshot 2023-07-10 183947.png](https://community.atlassian.com/t5/image/serverpage/image-id/267751i24D6E1D8497AE01F/image-dimensions/465x220?v=v2 "Screenshot 2023-07-10 183947.png")

**IMAGE 2:**

**![Screenshot 2023-07-10 184016.png](https://community.atlassian.com/t5/image/serverpage/image-id/267755i2AE3CE1509CE32D3/image-dimensions/370x237?v=v2 "Screenshot 2023-07-10 184016.png")**

Few puzzles:

* Is this how it is supposed to work? For example, it would use any-task keyword itself when I try to export my plan as YAML (but it would work fine for Java specs)
* If not, how is the task keyword determined? I was expecting the YAML conversion to look something like this (see image3 below, the first line is the task keyword, i.e. runMATLABTest, instead of any-task).

**IMAGE 3:**

**![Screenshot 2023-07-10 184526.png](https://community.atlassian.com/t5/image/serverpage/image-id/267756i6A5EBC9146F1B262/image-dimensions/321x214?v=v2 "Screenshot 2023-07-10 184526.png")**

Regards,

Kapil


author: Eduardo Alvarenga
body: Hello [@Kapil Gupta](/t5/user/viewprofilepage/user-id/5223282)

Any-task is the generic implementation for apps that don't have a specific export/import structure. Each task is distinguished by its 'plugin-key' value. Just use the model on "Image 2" and it should be ok.

Thank you,

Eduardo Alvarenga  
Atlassian Support APAC

**--please don't forget to Accept the answer if the reply is helpful--**


author: Kapil Gupta
body: Hey [@Eduardo Alvarenga](/t5/user/viewprofilepage/user-id/4365410) ,

That is what I'm trying to check. I have extended bamboo-specs feature for my plugin tasks (now it should be able to import/export; and it indeed can for "Java specs"), why is it still using any-task for conversion to "YAML specs".

* I know model from Image 2 would work fine. I was just wondering if there is a way to use this task (which has extended bamboo specs) in my YAML file without using the any-task keyword and just some my-task specific keyword.
* Is something like IMAGE 3 not applicable?

Regards,

Kapil


author: Eduardo Alvarenga
body: Your app needs to have a proper builder, properties and exporter classes to be able to fully export to YAML (and that needs to be implemented).

When that's not implemented, simply use any-task.

* <https://docs.atlassian.com/bamboo-specs-docs/latest/specs.html?yaml#configuring-unsupported-tasks>
* <https://docs.atlassian.com/bamboo-specs/latest/com/atlassian/bamboo/specs/api/builders/task/Task.html>
* [Using the AnyTask as an alternative](https://developer.atlassian.com/server/bamboo/how-to-extend-bamboo-specs/#exporter-classes)

Cheers,

Eduardo Alvarenga  
Atlassian Support APAC

**--please don't forget to Accept the answer if the reply is helpful--**


author: Kapil Gupta
body: Hey [@Eduardo Alvarenga](/t5/user/viewprofilepage/user-id/4365410) ,

I have implemented the required builder, properties and exporter classes for my plugin as per this [doc](https://developer.atlassian.com/server/bamboo/how-to-extend-bamboo-specs/). But still I'm not able to export my plan to YAML specs as expected (something like image 3). When I try to provide the code snippet from image 3 in my YAML file and run the pipeline, I get an incorrect document structure error (below image).

![Screenshot 2023-07-10 195522.png](https://community.atlassian.com/t5/image/serverpage/image-id/267786i57AC3B8D7795FFC2/image-size/large?v=v2&px=999 "Screenshot 2023-07-10 195522.png")

* If bamboo-specs requirements are correctly implemented, should I see something like image 3 from previous replies?
* Am I providing an incorrect task name? If so, how is the task name determined?

If you'd like to have a look at the implementation, it is available [here](https://github.com/mathworks/matlab-bamboo-plugin/tree/kapilg/bamboo-specs).

Thanks and regards,

Kapil


author: Kapil Gupta
body: Hey [@Eduardo Alvarenga](/t5/user/viewprofilepage/user-id/4365410) and team,

Any idea why we might be encountering this error with our implementation? Or we might be missing?

Regards,

Kapil


author: Kapil Gupta
body: Hey [@Eduardo Alvarenga](/t5/user/viewprofilepage/user-id/4365410) and team,

We're still stuck here. It would be great if you could have a look and provide some guidance. Thanks in advance!

Regards,

Kapil


author: Kapil Gupta
body: Hey [@Eduardo Alvarenga](/t5/user/viewprofilepage/user-id/4365410) and team,

It would be great if you could have a look and provide some guidance. Thanks in advance!

Regards,

Kapil