1

I currently try to automate the process of creating a new Bamboo linked repository and start the scan. I've already looked over the documentation of the REST API, tried to generate a new plan and enabling a scan, but that didn't work.

I also tried the Java Maven Package from Atlassian, but that needs user credentials as an authentication method, whilst I need to authenticate via a Security token. There is a link to an API in that Maven Package, which I tried to send a request to with the yaml code, but it always responds with the status code 500 and a Java Stacktrace. It's probably due to a wrong request body, but I can't figure out, how to include the yaml content the same way, as the maven package.

Is there a way to create a linked repository via the REST API?

Thanks in advance!

Jan
  • 93
  • 3
  • 8

1 Answers1

0

Is there a way to create a linked repository via the REST API?

No and there won't ever be one because they're deprecating the Bamboo server in favour of their cloud-based alternative (which is based on a totally different API). See https://jira.atlassian.com/browse/BAM-18453

Java Maven Package from Atlassian

What package is that? Based on what I said earlier the only way for you to programmatically create a linked repo is to mimic the browser POST request to updateLinkedRepository.action. That means that you'll need to login first to get a JSESSIONID cookie (xsrf token can be disabled, see https://confluence.atlassian.com/bamkb/rest-api-calls-fail-due-to-missing-xsrf-token-899447048.html#RESTAPIcallsfailduetoMissingXSRFToken-Workaround). Ping me if you need help, I still have ansible code for the login part.

Alex
  • 1,313
  • 14
  • 28
  • Thank you for your answer! I've come to the same conclusion after a while and many different tries. For the Java Maven Dependency, I found this [link](https://confluence.atlassian.com/bamboo/tutorial-create-a-simple-plan-with-bamboo-java-specs-894743911.html). I tried it. It works, but only with user credentials and not with bearer token or anything other. – Jan Jul 26 '21 at 05:53
  • 1
    Right. _Java Maven Dependency_ is `com.atlassian.bamboo:bamboo-specs` and it indeed takes only a username/password auth as you can see here https://bitbucket.org/atlassian/bamboo-specs/src/d65f9cde562c866dea3e02f5f8919d5dbab0978b/bamboo-specs-impl/src/main/java/com/atlassian/bamboo/specs/util/RestHelper.java#lines-60:64. Just create and dedicate a user for uploading specs. I have a custom BambooServer class which allows you to place (and rename) the `.credentials` file in user's home dir so you don't need to distribute it per project. – Alex Jul 27 '21 at 07:20
  • The conclusion mentioning the deprecation of Bamboo Server was a bit hasty and misleading: Bamboo Datacenter works like the old good Bamboo server. – Raffi Feb 26 '22 at 20:04