Is there additional training/examples/support for setting up and running Bamboo Specs?
Asked by Jason Templeman:

Having a lot of issue getting this running and not finding many resources online. I need to get this working quickly and look for and help I can get. Not using Docker so in the process of getting "Process Bamboo Specs in Docker" disabled by our IT department but still need to know the best way to setup our environment. We have 60+ plans and would like to have 1 repository contain all the Bamboo Spec's Java files.  

I was able to create a new project and plan but haven't been able to create a new plan in our existing project.  

<br />


Answers:
author: Jeyanthan I
body: Hi Jason,
> I was able to create a new project and plan but haven't been able to create a new plan in our existing project.

Creating a Specs plan under a project should be pretty straight forward. This guide will help you understand how to create plans with Bamboo Java Specs - [Create a simple plan with Bamboo Java Specs](https://confluence.atlassian.com/bamboo/tutorial-create-a-simple-plan-with-bamboo-specs-894743911.html).

As you already have existing data with plans and deployments and you wanted to move them to RSS, I encourage you to export your existing Bamboo configs to Specs by following [this documentation](https://confluence.atlassian.com/display/BAMBOO/Exporting+existing+plans+to+Bamboo+Specs)

This will speed up your learning process and as make your migration experience seamless. It's a perfect starting point if you don't know much about Bamboo Specs or configuration-as-code in general. In the code generated during export, you'll see how the structure of Bamboo is represented by various dedicated Java classes and method calls.

More details on this can be found in this blog post:

* [How to win at CI with configuration-as-code and Bamboo Specs - Atlassian Blog](https://www.atlassian.com/blog/bamboo/win-ci-configuration-as-code-bamboo-specs)

Documentation reference for both YAML Specs and Bamboo Java Specs, please refer the below reference.

* [Java Specs and YAML - Reference](https://docs.atlassian.com/bamboo-specs-docs/latest/)

Hope that helps.

Cheers,  
Jey

comments: author: Jason Templeman
body: Thanks for the feedback. Let me continue by saying I am not a developer but I do know the Bamboo UI fairly well as well as Bitbucket and git. I'm not familiar with Java but will cross that bridge once I can the exported plans working. I'm also not part of IT do I don't have access to the Bamboo Server.

Edited response...

Is there a page that states the requirements to get Specs operational? By default it users Docker which was not available. I had that disabled and not I'm getting an error not being able to reach [https://repo.maven.apache.org/maven2.](https://repo.maven.apache.org/maven2.?) I've asked them to add the proxy to the XML file. Each time I hit a snag I loose a full day of production. Is there anything else I should expect?

I was able to kind of/sort of get something working (changed source code in Bitbucket and got email stating there was a Specs failure due to issue above). This is a simple tutorial plan the just creates a plan and adds a "Hello World" job task.

I still cannot find any suggestion as to how a specs repo should be configured. All I see is the add a bamboo-specs folder to the project. Seeing how I want all our Specs in on repo would I expect something like this?

bamboo-specs  
\|  
- plan1  
- src  
- main  
- java  
- project  
- PlanSpec.java  
- plan2  
- src  
- main  
- java  
- project  
- PlanSpec.java  

or

bamboo-specs  
\|  
- src  
- main  
- java  
- plan1  
- PlanSpec.java  
-plan2  
- PlanSpec.java


author: Jeyanthan I
body: Hi [@Jason Templeman](/t5/user/viewprofilepage/user-id/2649265)
> Let me continue by saying I am not a developer but I do know the Bamboo UI fairly well as well as Bitbucket and git. I'm not familiar with Java but will cross that bridge once I can the exported plans working

In that case, I suggest you to check if YAML specs is easier for you to implement.
> Seeing how I want all our Specs in on repo would I expect something like this?

Your latter interpretation is almost correct. They should all be in one folder 'bamboo-specs'.  
Then, within each, we can have a file per project, with each having the @BambooSpec annotation above the class declaration. For instance, it should look like this:

```
specsrepo/bamboo-specs/src/main/java| => tree.??? tutorial    ??? PlanSpec.java    ??? PlanSpec2.java
```

Each of the PlanSpec.java files contains the code for a separate build plan of the same project or a different project.

This [Bamboo specs - Troubleshooting FAQs](https://confluence.atlassian.com/bamboo/bamboo-specs-troubleshooting-938844477.html) might help.

Should you have any further queries, feel free to contact Support (if you have the appropriate license) or here.


author: Jeyanthan I
body: Added to my previous comment, I thought this java property might come handy while debugging issues with your Specs code. It adds verbose logging to your atlassian-bamboo.log:

"-*Dbamboo.specs.log.level=DEBUG* " in \<Bamboo-install\>/bin/setenv.sh under *JVM_SUPPORT_RECOMMENDED_ARGS* .

You would need to restart Bamboo to apply this change.


author: Jimmy Seddon
body: Hey [@Jason Templeman](/t5/user/viewprofilepage/user-id/2649265),

I'd like to echo [@Jeyanthan I](/t5/user/viewprofilepage/user-id/1124775)'s statement, feel free to post any additional questions here. While I will not claim to be an expert with specs by any means. Our company, has been doing our best to standardize on Bamboo specs, we have been using both Java and YAML (there are certain things YAML just can accomplish that require Java specs). We are a .NET shop that is starting to move into docker containers as well as NodeJS so I'm happy to offer advice where I can based on our experiences.

-Jimmy


author: Jason Templeman
body: Thanks so much for the information. This really helps out a lot. Still waiting for our IT to update the proxy setting but do want to go ahead and start getting the file structure going. Do the files have to start with PlanSpec? Want something more meaningful than 2, 3, etc. Thinking (if PlanSpec is required) PlanSpec_description-here.java.  

Here is what I have.  
![Specs Layout.png](https://community.atlassian.com/t5/image/serverpage/image-id/79600i54DF833C1D2F61B3/image-size/large?v=v2&px=999 "Specs Layout.png")

Do I need the .credentials file or is just for running locally? The plan I d/l from Bamboo does have a PlanPermissions section but not sure where this comes into play.


author: Jason Templeman
body: Little off topic but need to get a response and hope to get an answer here. I was trying to get things into a new repo and something went south so I tried to start from scratch. Want to re-iterate that I'm not a Java developer and don't know Maven.  

Having issues running maven setup. Running Bamboo 6.6.3 and running this per the website.  

    mvn archetype:generate -B \  -DarchetypeGroupId=com.atlassian.bamboo -DarchetypeArtifactId=bamboo-specs-archetype \  -DarchetypeVersion=6.2.1 \  -DgroupId=com.my.company -DartifactId=bamboo-specs \  -Dversion=1.0.0-SNAPSHOT -Dpackage=com.my.company

Cannot be sure of what I initially ran but from my history looks like

```
mvn archetype:generate -B -DarchetypeGroupId=com.atlassian.bamboo -DarchetypeArtifactId=bamboo-specs-archetype -DarchetypeVersion=6.2.1 -DgroupId=com.atlassian.bamboo -DartifactId=bamboo-specs -Dversion=1.0.0-SNAPSHOT -Dpackage=tutorial -Dtemplate=minimal=6.2.1 -DgroupId=com.atlassian.bamboo -DartifactId=bamboo-specs -Dversion=1.0.0-SNAPSHOT -Dpac??
```

Getting an error of

\[INFO\] Scanning for projects...  
\[INFO\]  
\[INFO\] ------------------\< org.apache.maven:standalone-pom \>-------------------  
\[INFO\] Building Maven Stub Project (No POM) 1  
\[INFO\] --------------------------------\[ pom \]---------------------------------  
\[INFO\]  
\[INFO\] \>\>\> maven-archetype-plugin:3.1.2:generate (default-cli) \> generate-sources @ standalone-pom \>\>\>  
\[INFO\]  
\[INFO\] \<\<\< maven-archetype-plugin:3.1.2:generate (default-cli) \< generate-sources @ standalone-pom \<\<\<  
\[INFO\]  
\[INFO\]  
\[INFO\] --- maven-archetype-plugin:3.1.2:generate (default-cli) @ standalone-pom ---  
\[INFO\] Generating project in Batch mode  
\[WARNING\] No archetype found in remote catalog. Defaulting to internal catalog  
\[WARNING\] Archetype not found in any catalog. Falling back to central repository.  
\[WARNING\] Add a repository with id 'archetype' in your settings.xml if archetype's repository is elsewhere.  
\[INFO\] Downloading from central: <https://repo.maven.apache.org/maven2/com/atlassian/bamboo/bamboo-specs-archetype/6.2.1/bamboo-specs-archetype-6.2.1.pom>  
\[INFO\] ------------------------------------------------------------------------  
\[INFO\] BUILD FAILURE  
\[INFO\] ------------------------------------------------------------------------  
\[INFO\] Total time: 49.733 s  
\[INFO\] Finished at: 2020-01-20T08:33:07-05:00  
\[INFO\] ------------------------------------------------------------------------  
\[ERROR\] Failed to execute goal org.apache.maven.plugins:maven-archetype-plugin:3.1.2:generate (default-cli) on project standalone-pom: The desired archetype does not exist (com.atlassian.bamboo:bamboo-specs-arc 1\]

Thanks for all the help


author: Jimmy Seddon
body: Hi [@Jason Templeman](/t5/user/viewprofilepage/user-id/2649265),

I haven't done too much with the Java specs personally, but I think your archetype version might be incorrect based on the version of Bamboo you are running.

You can find a listing of the versions here:

<https://mvnrepository.com/artifact/com.atlassian.bamboo/bamboo-specs-archetype>

I hope that helps!

-Jimmy


author: Jason Templeman
body: Thanks. Were running Bamboo 6.6.3. That seemed to work. Going to do more investigation tomorrow.


author: Jeyanthan I
body: Hi [@Jason Templeman](/t5/user/viewprofilepage/user-id/2649265),

As [@Jimmy Seddon](/t5/user/viewprofilepage/user-id/512822) mentioned, you'll just have to modify your command to work with 6.6.3.

    mvn archetype:generate -B \  -DarchetypeGroupId=com.atlassian.bamboo -DarchetypeArtifactId=bamboo-specs-archetype \  -DarchetypeVersion=6.6.3 \  -DgroupId=com.my.company -DartifactId=bamboo-specs \  -Dversion=1.0.0-SNAPSHOT -Dpackage=com.my.company

Let us know if you can run this successfully.

Cheers,  
Jey


author: Jason Templeman
body: That worked. Thanks for all the help. You guys rock!

Going to start pulling in Java files from my current plans and have a few questions.

1. Is there anything special about the name PlanSpec.java? Thinking about keeping with names along the lines of PlanSpec_descript_name.java
2. Are the credentials only used when running from within an IDE or are they also used for the automated process when you check in an update into Bitbucket? I don't like having the username/password in a human readable file in Bitbucket.
3. Should I just be able to cut and paste the generated code into a new class file? I know I need to change the name if I rename the file but was wondering if there is anything else that needs to be added/deleted before running.
4. I created a new class and modified the copied the generated Java Specs file and corrected the error (as PlanSpecs.java was renamed I had to update the public class name and names in main accordingly. My question is in regards to the test file. I copied the one from the example and updated the plan name but it appears that the generated specs code doesn't have a createPlan function. Are there any examples or documentation on how to test the generated java specs file?


author: Jeyanthan I
body: Hey [@Jason Templeman](/t5/user/viewprofilepage/user-id/2649265) ,

I'm glad you got it running. Although I prefer to assist you further in a separate thread, I'll stop with answering just these.
> Is there anything special about the name PlanSpec.java? Thinking about keeping with names along the lines of PlanSpec_descript_name.java

Yes, it is possible to keep a descriptive name of your preference as I mentioned in my previous comment.
> Are the credentials only used when running from within an IDE or are they also used for the automated process when you check in an update into Bitbucket? I don't like having the username/password in a human readable file in Bitbucket.

The .credentials file is necessary only for Bamboo Specs and not for RSS (Repository Stored Specs).
> Should I just be able to cut and paste the generated code into a new class file? I know I need to change the name if I rename the file but was wondering if there is anything else that needs to be added/deleted before running

My approach would be to construct a plan in the UI and generate Java specs code (under Plan configuration page) from it and make customisations from there on top of the existing skeleton you have generated from Maven.
> I created a new class and modified the copied the generated Java Specs file and corrected the error (as PlanSpecs.java was renamed I had to update the public class name and names in main accordingly. My question is in regards to the test file. I copied the one from the example and updated the plan name but it appears that the generated specs code doesn't have a createPlan function. Are there any examples or documentation on how to test the generated java specs file?

Did the documentation help you construct one? <https://docs.atlassian.com/bamboo-specs-docs/6.9.0/specs.html?yaml#plan>

Cheers,  
Jey


author: Jason Templeman
body: Again thanks for all the help.

Still nothing on the test side but will work on that latter.


author: Jeyanthan I
body: Sure thing. Glad that I could be of help.

Cheers,  
Jey


Tags: spec