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

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root

Avatar

1 badge earned

Collect

Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!

Challenges
Coins

Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.

Recognition
Ribbon

Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!

Leaderboard

Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,640,976
Community Members
 
Community Events
196
Community Groups

Bamboo Specs BitbucketServerRepository and SSH Keys

I'm trying to create a build plan using Bamboo Java Specs using the stored specs feature storing the specs in my Bitbucket Server repo (our Bitbucket Server and Bamboo instances are linked correctly). I have got Bamboo picking up the specs file but it fails with this exception:

java.lang.IllegalArgumentException: 
com.atlassian.bamboo.specs.api.exceptions.PropertiesValidationException: Clone url or ssh key pair is not valid

My plan looks something like this:

new Plan(project(), "name", "key")
...
.planRepositories(new BitbucketServerRepository()
.name(PROJECTNAME)
.oid(new BambooOid(BAMBOOOID))
.repositoryViewer(new BitbucketServerRepositoryViewer())
.server(new ApplicationLink()
.name("Bitbucket")
.id(BITBUCKETSERVERID))
.projectKey(PROJECTKEY)
.repositorySlug(REPOSLUG)
.sshPublicKey(PUBLICKEY)
.sshPrivateKey(PRIVATEKEY)
.sshCloneUrl(CLONEURL)
.branch("main")
.remoteAgentCacheEnabled(false)
.fetchWholeRepository(true)
.changeDetection(new VcsChangeDetection())
)

I initially just tried using the public key and private key from an existing build we created in the UI, but it was always a long-shot and didn't work. From reading this page on the API - https://docs.atlassian.com/bamboo-specs/6.5.0/com/atlassian/bamboo/specs/builders/repository/bitbucket/server/BitbucketServerRepository.html - it seems like I need to specify these rather than letting Bamboo create its own.

So my question is, do I need to create a user in Bitbucket for Bamboo (using one of our Bitbucket licences) and then generate SSH keys on the Bamboo host as if it were a normal user and use these or am I missing something here?

2 answers

Update: I've managed to get the repo public SSH key (created by bamboo creating the linked repository), but I'm not sure where the Bamboo private key is

Update 2: created a private SSH key for the account running Bamboo on the box its hosted on. Put that into the spec file along with the public access key for the repo and still getting 

Clone url or ssh key pair is not valid

 Running out of ideas fast

Like Jonny Carter likes this
Jonny Carter
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
Jul 18, 2022

I have this same basic problem. If I comment out the `sshPrivateKey()` and `sshPublicKey` method calls on my `BitbucketServerRepository`, I can run the plan spec locally. Those properties are required for use with repository-hosted specs, though.

0 votes
Jonny Carter
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
Jul 18, 2022 • edited

Okay, the thing that finally got this fixed for me was to use

.linkedRepositories("my-linked-repo-id")

instead of

.planRepositories( new BitbucketServerRepository() 
/...
)

Then there is no need to specify an ssh key pair, or any of the repo configuration.

Of course, specifying the linked repo seems to be a manual affair:

https://confluence.atlassian.com/bamboo/linking-to-source-code-repositories-671089223.html

This guide on creating a linked repo indicates that you need to publish the repository separately from the planspec: https://confluence.atlassian.com/bamkb/create-linked-repository-with-bamboo-java-specs-1014269419.html

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events