Bamboo spec multi projects
Asked by sta-szek:

Hi guys,

First of all, I saw your great docs about bamboo java specs here: <https://docs.atlassian.com/bamboo-specs-docs/6.8.0/specs-java.html#introduction>

Also saw yaml version and I have few questions.

Since I have generic build and deployments jobs for, let's say, 30 projects I wanted to unify spec in one place.

Here is list of questions:

1. When do you plan to support all features in yamlspec that are supported in javaspec ? Is there any roadmap? Link?

2. Can I configure one repository with specs in bamboo and tell bamboo somehow:

* here is spec repo
* here is list of projects (name, key, repourl, ...)
* please combine it and create bamboo plans (build \& deployment) for all of them

3. If not, what is the best practice to avoid spec duplication? In my case it will be 30 projects with spec1, 10 projects with spec2 and 10 projects with spec3. It would be really nice to maintain 3 specs only, instead of 50 - it does not fit configuration as a code, but rather configuration hell.

4. We have monorepo strucutre:

* single GH repo
* directories inside: project1, project2, ..., projectN.

It works well with linked repositories and regex pattern for changes. The question is:

Can I add one more dir there, name it \*bamboo-spec-smth\* and tell bamboo to look into this directory?

Have in mind that I would like to have spec1, spec2, and spec3 only inside this directory, not spec1 duplicated 30 times.

Thanks!


Answers:
author: Victor Debone
body: Hello [@sta-szek](/t5/user/viewprofilepage/user-id/1191672),

From what I understood, you are asking those questions specific about YAML Specs. I will try to answer them based on that assumption:

1. There is no public roadmap for the moment. But I can tell you that there are some features in progress, one of them you can follow at <https://jira.atlassian.com/browse/BAM-19840>.
2. The YAML specs is a declarative approach to configure Bamboo, and if I understood correctly, you are asking if we can make of these YAMLs, templates. The answer is that for now we don't provide a way to reuse YAMLs as templates.
3. The current version of YAML supports only a single file placed at \`bamboo-specs/bamboo.yml\` in your repository. For each plan you want to configure, you need to create a new document inside the same YAML file, by starting a new line without indentation and \`---\` (three hyphens).  
   Note that the current YAML does not support deployment projects.
4. Yes for "Telling Bamboo to look into your Linked Repository". You can allow the [Scan for Specs on the linked repository](https://confluence.atlassian.com/bamboo/enabling-repository-stored-bamboo-specs-938641941.html).  
   For the duplication (or de-duplication) of specs, I understand that you want your 3 specs for multiple projects each and the answers for 3 \& 4 applies here as well.

Meanwhile, I see that you're actively using YAML and as you've may noticed, we are considering some improvements for YAML. We are looking to hear some more direct feedback from customers, so if you could reach me at vdebone@atlassian.com, you could make part of this conversation :)

comments: author: sta-szek
body: Hi,

First of all thanks for answering!

Actually my question was about java spec, not yaml - because I need deployments.

[@Victor Debone](/t5/user/viewprofilepage/user-id/1892075) can you response once again having JavaSpec in mind :)

Also, I know that JavaSpec must be java code inside project. What will happen if I will create some java lib with those spec classes and then import in every project as dependency? Will it be automatically scanned? Or is it bad approach?

Is it better to create GH repo with JavaSpec (loop inside main method to create builds and deployments for all 50 projects) and maintain it separately?

Or maybe in general, I will rephrase my question:

I have 50 projects. They can be divided into 3 by pipeline (build implementation). What can I do in order to avoid 50 JavaSpec in each project? Is it possible to have only 3 different JavaSpec? Is the idea with separate GH repo approach correct?

Thanks


author: Victor Debone
body: You're welcome!

Ok, thinking in Java then, you can do something like this

```
// This is pseudocode, only for insight purposes

class YourSpecsConfig {
  //Some methods and variables
}

YourSpecsConfig specsA = new YourSpecsConfig("A");
YourSpecsConfig specsB = new YourSpecsConfig("B");

Plan createPlan(String name, YourSpecsConfig specsConfig) {
  // Translate your custom class config to Bamboo Specs plans
}

Deployment createDeployment(String name, YourSpecsConfig specsConfig) {
// Translate your custom class config to Bamboo Specs deployments
}

// Later, with an array of plans generated
for (Plan p : plans) {
  bambooServer.publish(p);
}
// And deployments...
```

This could be distributed among other files and easily be just another module in your monorepo.

I'm not aware of your setup, but keep it mind that we don't support configurations on branches yet, so any changes to Specs should happen from master. This usually propels customers to use Bamboo Specs from a separated repo, in order to avoid commiting to master that often.

Did it help you? :)

Victor