Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Bamboo Specs Multiple Projects in One Repo & Error Creating Exported Demo Spec

Deleted user July 24, 2018

Just upgraded from Bamboo 6.1 to 6.5.1...can't upgrade to 6.6.1 yet due to incompatible plugins. Just upgraded Bitbucket server to 5.11.1. Both are linked to each other and there are no issues with Application Links.

  1. Documentation states in multiple places "Store your build specs in a Bitbucket repo". Plural specs, singular repo. In the Bamboo Project Settings there's an option to add a spec repo to the project.
    • Is it possible to store multiple build specs in a single repo or is it only one build spec per repo? If so, what is the folder structure or naming convention to use?
    • If one spec per repo then this isn't ideal because we will have to have a separate repo for each build so that Operations can ensure that all necessary information is present. If we store the specs file in the same repo as the application code then the Developers will be able to bypass Operations and make changes to the Specs file without Operations oversight.
  2. Followed this tutorial: https://confluence.atlassian.com/bamboo0605/bamboo-specs/bamboo-yaml-specs/tutorial-bamboo-specs-yaml-stored-in-bitbucket-server
    • Step 2 is in the wrong place, it needs to be after Step 5.
    • Using the bamboo.yml the "Dragon Slayer Quest" build gets created in the "Tutorial" project.
      • Go to "View plan as Java Specs" and copy to PlanSpec.java....NOTE: Documentation all says "View plan as Bamboo Specs"
    • Delete build project from Bamboo
    • Delete bamboo.yml file, add PlanSpec.java file, and push to tutorial repo.
    • Scanning tutorial repo in linked repositories shows "Error in Bamboo Specs" but log file is empty.

Should I be able to create a build plan manually via the GUI, export its to a Java Specs file, and then make changes via the repo to manage the job? Should I be able to take the exported JavaSpecs file and create the same build job again in the event that the build job gets accidentally deleted?

 

EDIT:

Found something in the atlassian-bamboo.log:

java.lang.IllegalStateException: Unable to locate pom.xml file in....

 

Looks like I have the same issue as here: https://community.atlassian.com/t5/Bamboo-questions/Bamboo-specs-troubleshooting/qaq-p/702910

 

Shouldn't I be able to just export an existing Build Plan, add that file to a repo, and have the build start being managed that way?

1 answer

0 votes
Foong
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
July 24, 2018

Documentation states in multiple places "Store your build specs in a Bitbucket repo". Plural specs, singular repo.

The feature is called "Bamboo Specs". It does not mean plural.

Is it possible to store multiple build specs in a single repo or is it only one build spec per repo? If so, what is the folder structure or naming convention to use?

Yes, it is possible to have multiple Bamboo Specs in a single repo if using Bamboo Java Specs instead of YAML. The Java Specs code have to placed in folder "bamboo-specs" in the repo like YAML. For more info, refer to Tutorial: Bamboo Java Specs stored in Bitbucket Server

Step 2 is in the wrong place, it needs to be after Step 5.

Thanks for the feedback. It will be updated soon.

Delete bamboo.yml file, add PlanSpec.java file, and push to tutorial repo.

Scanning tutorial repo in linked repositories shows "Error in Bamboo Specs" but log file is empty.

Is the folder "bamboo-specs" only have a single PlanSpec.java file? For Bamboo Java Specs, it need to be the full Java project structure. After creating the Bamboo Java Specs with the following example command, the whole Java project have to be placed in "bamboo-specs" folder:

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

Should I be able to create a build plan manually via the GUI, export its to a Java Specs file, and then make changes via the repo to manage the job? Should I be able to take the exported JavaSpecs file and create the same build job again in the event that the build job gets accidentally deleted?

Shouldn't I be able to just export an existing Build Plan, add that file to a repo, and have the build start being managed that way?

Yes, it can be done. Make sure that the full Java project files from the above command is added to the folder "bamboo-specs".

Deleted user July 26, 2018

Thanks for the reply, made some headway. Documenting it in here in so it might help someone else.

1. Ran the following since I don't want to install maven:

docker run -it --rm -v "$(pwd)":/usr/src/mymaven -w /usr/src/mymaven maven mvn archetype:generate -B -DarchetypeGroupId=com.atlassian.bamboo -DarchetypeArtifactId=bamboo-specs-archetype -DarchetypeVersion=6.5.1 -DgroupId=com.my.company -DartifactId=bamboo-specs -Dversion=1.0.0-SNAPSHOT -Dpackage=com.my.company

 and it created this:

.
./bamboo-specs
./bamboo-specs/.hgignore
./bamboo-specs/pom.xml
./bamboo-specs/.gitignore
./bamboo-specs/.credentials
./bamboo-specs/src
./bamboo-specs/src/test
./bamboo-specs/src/test/java
./bamboo-specs/src/test/java/com
./bamboo-specs/src/test/java/com/my
./bamboo-specs/src/test/java/com/my/company
./bamboo-specs/src/test/java/com/my/company/PlanSpecTest.java
./bamboo-specs/src/main
./bamboo-specs/src/main/java
./bamboo-specs/src/main/java/com
./bamboo-specs/src/main/java/com/my
./bamboo-specs/src/main/java/com/my/company
./bamboo-specs/src/main/java/com/my/company/PlanSpec.java

 

2. Changed the project name to "Tutorial" and key to "DRAGON" in PlanSpec.java to match what's in the tutorial. Committed it to Bitbucket and the plan got created in Bamboo under the Tutorial project. Got e-mail that spec was successful.

 

3. Clicked "View Plan as Java Specs", copied, and overwrote contents in PlanSpec.java. Saw new build for plan and got e-mail that spec was successful.

 

4. Deleted plan "My Plan". Plan no longer shows "All Build Plans". However plan does show when I go to Projects > Tutorial for about 1-2 minutes but finally disappears.

 

5. Run Scan from "Spec Status" tab in Linked Repository and plan shows back up. Success I think. Here's the pom.xml in case someone else needs it:

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>

<parent>
<groupId>com.atlassian.bamboo</groupId>
<artifactId>bamboo-specs-parent</artifactId>
<version>6.5.1</version>
<relativePath/>
</parent>

<groupId>com.my.company</groupId>
<artifactId>bamboo-specs</artifactId>
<version>1.0.0-SNAPSHOT</version>
<packaging>jar</packaging>

<dependencies>
<dependency>
<groupId>com.atlassian.bamboo</groupId>
<artifactId>bamboo-specs-api</artifactId>
</dependency>
<dependency>
<groupId>com.atlassian.bamboo</groupId>
<artifactId>bamboo-specs</artifactId>
</dependency>

<!-- Test dependencies -->
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<scope>test</scope>
</dependency>
</dependencies>

<!-- run 'mvn test' to perform offline validation of the plan -->
<!-- run 'mvn -Ppublish-specs' to upload the plan to your Bamboo server -->
</project>

 

Say I have ProjectA with PlanA1 & PlanA2 and ProjectB with PlanB3 & PlanB4. What folder structure do the PlanSpecs.java files need to be organized in so that all 4 build plans can be stored in the same repository?

Is the "com.my.company" from above necessary? Just seems to add unnecessary folder depth.

Thanks.

Deleted user July 27, 2018

@Foong I just spent another 6 hours on this tonight trying to figure out the folder structure for storing multiple specs in a single repo. If you get a chance can you provide me with more info on the layout? Thanks

Foong
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
September 3, 2018

You can place all the Specs in different files like the following:

./bamboo-specs/src/main/java/com/my/company/ProjectAPlanA1.java
./bamboo-specs/src/main/java/com/my/company/ProjectAPlanA2.java
./bamboo-specs/src/main/java/com/my/company/ProjectBPlanB1.java
./bamboo-specs/src/main/java/com/my/company/ProjectBPlanB2.java
Raffi Enficiaud June 6, 2019

@Foongthanks. Then how do you selectively publish only one project (say all specs of ProjectA in your example) if you run the commands from {{mvn -Ppublish-specs}} ?

My intention is to have a common module that contains shared Java component, and then have for each of the projects a reference to that shared component.

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events