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,294,199
Community Members
 
Community Events
165
Community Groups

Bamboo yaml spec, create plan repositories

Edited

Hi there,

I followed the documentation of Bamboo Yaml specs to create plan repositories as below.

repositories:
 - my-test:
       type: bitbucket-server
       server: http://localhost:7990
       project: TestProject
       slug: test-service
       clone-url: ssh://git@scr.bsh-sdd.com:7990/testproject/test-service.git
       public-key: PUBLIC KEY
       private-key: ENCRYPTED_PRIVATE_KEY

I provided the actual public key and private key in the yaml and the pulic key is configured in the bit bucket server to my account.  When tried like this I am the error. 

Cannot read keypair, passphrase wasn't set

 But I am not sure how I should provide the passphrase.

 

And when I remove public-key and private-key fields I get below error.

Bamboo YAML import failed: Repository 'my-test' should be defined at 'repositories' list when referenced by Checkout task

Can someone help me here ?

1 answer

1 accepted

1 vote
Answer accepted

Hello @sasank nvs, Welcome to Atlassian Community!

To use an SSH private key with a passphrase, you should set the repository type as "git" and on your YAML file:

ssh-key: <Encryptedkey>
ssh-key-passphrase: <EncryptedPassphrase>

To generate an encrypted string to Specs -> Bamboo Specs Encryption (located on the top menu bar in Bamboo)

When using a Bitbucket-server repository type, Bamboo takes over SSH key management and won't allow personal keys to be used, nor passphrases.

 

Regards,

Eduardo Alvarenga
Atlassian Support APAC

Thanks @Eduardo Alvarenga for such a prompt reply. I was able to get it worked with git. But not able to get it working with Bitbucket. I tried below configuration but still I got the error. Also I don't have any access token configured on the Bitbucket repository.

- my-test:
    type: bitbucket-server
    server: Bitbucket
    project: testproject
    slug: test-service
    clone-url: ssh://git@scr.bsh-sdd.com:7990/testproject/test-service.git

Bamboo YAML import failed: Repository 'my-test' should be defined at 'repositories' list when referenced by Checkout task

I got the above error. 

You are missing a repository declaration. Try this:

Default Job:
key: JOB1
tasks:
- checkout:
repository: my-test
force-clean-build: 'false'
description: Checkout My-test

repositories:
- my-test:
    type: bitbucket-server
    server: Bitbucket
    project: testproject
    slug: test-service
    clone-url: ssh://git@scr.bsh-sdd.com:7990/testproject/test-service.git

Hello Eduardo,

I work together with Sasank on this issue and just figured out the solution

- The provided SSH key pair must be RSA keys (not OpenSSH)
- The public key is plain, the private key must be Bamboo encrypted
- The property viewer with the following value is required (otherwise an error message saying that changing the repo type is not allowed is thrown)
viewer: com.atlassian.bamboo.plugins.stash.atlassian-bamboo-plugin-stash:bbServerViewer
- I also added the public key to the bitbucket repo keys (in bitbucket project settings)

The final piece of repo config in the bamboo YAML spec looks like the following

repositories:
- my-test:
type: bitbucket-server
server: <bit bucket app link name>
project: <project-key>
slug: <repo-slug>
clone-url: <ssh-git-repo>
public-key: <public-key>
private-key: <private-key>
branch: master
viewer: com.atlassian.bamboo.plugins.stash.atlassian-bamboo-plugin-stash:bbServerViewer


As far as I have seen, all properties here are mandatory.

We would also like to specify the "Change detection part", especially to include only changes that matches a specific RegEx.

Unfortunately I couldn't find this part in the YAML specs reference, do you have hint for us?

Hey @Dimitri Dering @sasank nvs

I noticed the similarity between your work questions but didn't want to assume you teamed. But now that everything is clear, that makes things easier to understand.

Regarding the Change detection options, you can try adding something like this:

repositories:
- my-test:
(...)
change-detection:
file-filter-type: include_only
file-filter-pattern: ^(string1|string2)/.*

Modify the file-filter-pattern regex to what suits you.

Pro-tip. You can always use the Bamboo UI to export the Plan in either YAML or Java Specs format. For that, simply prepare your plan, then go to:

  • Actions -> Configure Plan -> Actions -> View Plan as (Java/YAML) Specs
Like Dimitri Dering likes this

perfect, this solved our issue completely

thank you very much

Thanks @Dimitri Dering. Please make sure to mark this question as Resolved.

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase
Published in Bamboo

Bamboo Data Center on Kubernetes

Hi, If you are running self-managed environments and looking to adopt modern infrastructure, Bamboo Data Center can now be deployed in a Kubernetes cluster. By leveraging Kubernetes, you can easily...

925 views 3 8
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you