bamboo-specs not running from linked repository
Asked by Ryan Schaaf:

I've dug through the other articles and can't seem to find any help for my situation. We are attempting to link our source controlled \*Java\* bamboo-specs bitbucket repo into bamboo.

However, when I make a change ( done via Pull Request using FF merge strategy ), I can see the log in bamboo where it gets the merge update, however there is nothing indicating that the bamboo-specs ever tried to run ( success/error ).

To start with, I have verified that the bamboo-specs are good in that I can run the \`mvn test\` and \`mvn -Ppublish-specs\` locally with no issues. Attached is the pom.xml with no external dependencies

```
<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.4.1</version>
    <relativePath/>
  </parent>

  <groupId>com.mycompany</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>
```

Some things I am not sure if are affecting this:

1) We have disabled the local agent on the bamboo server for security ( only use remote agents ). Does this agent need to be enabled to process bamboo-specs??

- Our bamboo server does have maven and java installed.

2) In our PlanSpec.java, we define the bambooServer object using the actual URL ( eg: <http://mybamboo.com/bamboo> ) instead of localhost:8085. Do you have to use localhost to have this work?

3) In any case, how are credentials used when bamboo runs PlanSpec.java. Do we have to supply some sort of .credentials in our repo for it to use to authenticate?

4) The bamboo-specs linked repo is not used by any build plan. The idea is this is a separate repository that is only used to host our entire bamboo configuration.

- The linked Repository was granted full access to All Projects and All Linked Repositories


Answers:
author: Robert W
body: Hi Ryan,

We've opened a support case for this request. So we're not repeating information, let's focus on communicating through the support case.

Thanks

comments: author: Xavier Van Varenberg
body: Can the solution be posted here as well?   

I will create a ticket of my own, but the issue is fairly similar


author: Manasa Tumu
body: I have the same issue with scanning the bamboo specs for Bitbucket cloud. Do we have any solution yet?


author: Ryan Schaaf
body: Finally got it working. Your bamboo-specs repo needs to be nested. In that your root repo **has a folder called bamboo-specs** in the root, and your project sits under that. So  

bamboo-specs\\bamboo-specs\\src ...


author: Manasa Tumu
body: I have my repo structure as

bamboo-test.git

\|_ bamboo-specs

\|_ src/main/java/PlanSpec.java

what needs to be updated here? Please let me know. Thanks!


author: Ryan Schaaf
body: that was the structure that worked for me. I would reach out to atlassian support as your issue appears to be different than my own.


author: Manasa Tumu
body: When i try to run curl from my local, bamboo-specs are being detected and changes are updated.

curl -X POST -H "Content-Type: application/json" "<https://build.company.name/rest/api/latest/repository/scan?repositoryId=>

But from bamboo its not working.


author: Manasa Tumu
body: Can you provide your repo structure and what is the repository host you used for the bamboo configuration?


author: Jeremy Owen
body: Hey Ryan,

For points 1 - 3, none of these should be a factor with the RSS import as it works a little differently and point 4 is OK as well.

Firstly, in the logs do you see anything like this confirming that it's running the update?

```
2018-04-20 17:23:17,243 INFO [AtlassianEvent::0-BAM::EVENTS:pool-1-thread-11] [BranchChangedEventListener] Detected a possible Bamboo spec change in repository. Running update.
```

If so, are there any errors after that? Possibly Git errors or anything saying there was an exception trying to dispatch the *StashBranchChangedRemoteEvent*? E.g.

```
there was an exception thrown trying to dispatch event [com.atlassian.stash.plugin.remote.event.StashBranchChangedRemoteEvent
```

Also, what version of native Git are you running on the Bamboo Server and has it been added as a Server Capability in the Administration settings? Older version of native Git (such as 1.7.1) will cause issues.

Lastly, if Maven actually ran as part of the RSS import there should be logs located at *$bamboo-home/xml-data/repository-specs/\<repository-id\>*(the repository ID can be observed in the URL when mousing over the linked repository in the admin settings) which may shed more light on what went wrong.

comments: author: Ryan Schaaf
body: I never see anything confirming its trying to run the update. I see that it is getting the merge event from bitbucket:

```
2018-04-16 10:07:26,124 INFO [AtlassianEvent::0-BAM::EVENTS:pool-2-thread-1] [PullRequestAwareEventListener] Received pull request merged event [ bamboo-specs, from: refs/heads/devops-86, to: refs/heads/master]
```

After that a whole lot of nothing. No logs indicating it actually tried to execute a bamboo-specs update.

Both git and maven are added as server capabilities ( running native git 2.8.2 on the bamboo server )

![Screen Shot 2018-04-20 at 8.52.00 AM.png](https://community.atlassian.com/t5/image/serverpage/image-id/20220i1483B980C2A808BE/image-size/large?v=v2&px=999 "Screen Shot 2018-04-20 at 8.52.00 AM.png")![Screen Shot 2018-04-20 at 8.52.06 AM.png](https://community.atlassian.com/t5/image/serverpage/image-id/20219i326E735E0AF1D83E/image-size/large?v=v2&px=999 "Screen Shot 2018-04-20 at 8.52.06 AM.png")

And the linked repository is configured to be a bamboo-specs repo

![Screen Shot 2018-04-20 at 8.52.29 AM.png](https://community.atlassian.com/t5/image/serverpage/image-id/20221i3B1F767B7452F251/image-size/large?v=v2&px=999 "Screen Shot 2018-04-20 at 8.52.29 AM.png")


Tags: spec