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

Bamboo yaml spec, create plan repositories

sasank nvs
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
April 4, 2022

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
Eduardo Alvarenga
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
April 4, 2022

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

sasank nvs
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
April 4, 2022

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. 

Eduardo Alvarenga
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
April 4, 2022

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
Dimitri Dering April 4, 2022

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?

Eduardo Alvarenga
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
April 4, 2022

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
Dimitri Dering April 4, 2022

perfect, this solved our issue completely

thank you very much

Eduardo Alvarenga
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
April 4, 2022

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

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events