Hi All,
I am using YAML spec with Atlassian Bamboo version 8.0.6 and configured plan repository with in the YAML spec. Please find the steps I used and error message.
How to pass empty passphrase? or what is workaround for this issue?
Any help will be greatly appreciated.
1). Generated SSH key
ssh-keygen -t ed25519 -C "l.xxxx@gmail.com"
2). Configured public key on Bitbucket server project level.
3). My plan repository YAML spec looks like below. sshKey_devops_public_key and bamboo.sshKey_devops_private_key are global variables. Used passphrase while generating SSH key.
repositories:
- spec-repo:
scope: global
- app-repo:
type: bitbucket-server
server: Bitbucket
project: DEV
slug: simple-java-maven-app
clone-url: ssh://git@xxxxxx:7999/dev/xxxx-app.git
public-key: ${bamboo.sshKey_devops_public_key}
private-key: ${bamboo.sshKey_devops_private_key}
branch: master
command-timeout-minutes: '180'
use-shallow-clones: 'false'
cache-on-agents: 'false'
submodules: 'false'
verbose-logs: 'false'
fetch-all: 'false'
lfs: 'false'
viewer: com.atlassian.bamboo.plugins.stash.atlassian-bamboo-plugin-stash:bbServerViewer
The above YAML spec not working and getting below error.
17-Apr-2022 01:41:20 java.lang.IllegalArgumentException: Cannot read keypair, passphrase wasn't set.
Here is the link to full error message: https://pastebin.com/8LXC69Z3
Hello @Mohan L
Please check the following question that shows some good tips on using git and bitbucket type repositories.
Regards,
Eduardo Alvarenga
Atlassian Support APAC
Hi @Eduardo Alvarenga ,
It works when I hard code public-key and private-key values in YAML spec like below:
public-key: <hard code public key>
private-key: <Hard code Bamboo encrypted private key>
However I am getting same "java.lang.IllegalArgumentException: Cannot read keypair, passphrase wasn't set" when I try to create global variable with the public key and Bamboo encrypted private key.
Is there any way to keep the public and private key values out of YAML spec and reference in the spec instead of hard code it?
public-key: ${bamboo.sshKey_devops_public_key}
private-key: ${bamboo.sshKey_devops_private_key}
Thanks
Mohan
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello @Mohan L
Bamboo will interpret the public-key and private-key fields as strings and will not expand variables there. If you want to have dynamic authentication you can use Global Shared credentials or Project Shared credentials -- available in Bamboo Data Center only.
Note: Your SSH private key needs to be converted to PEM format before getting added to Bamboo Shared credentials. Something like this will do the job:
openssl rsa -in id_rsa -outform pem > id_rsa.pem
Example:
- Calibration-git-local:
type: git
url: ssh://git@git.mydomain.net:7999/cal/calibration.git
branch: master
shared-credentials: shared-ssh-key
And then I have a Shared credential called shared-ssh-key of type SSH in Bamboo.
Regards,
Eduardo Alvarenga
Atlassian Support APAC
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Eduardo Alvarenga ,
Thanks for your time.
1). Converted private key to converted to PEM format
2). Created shared-ssh-key in global shared credentials
3). spec looks like below:
The error turned "Document structure is incorrect".
Does bitbucket-server type support shared-credentials?
repositories:
- spec-repo:
scope: global
- app-repo:
type: bitbucket-server
server: Bitbucket
project: DEV
slug: simple-java-maven-app
clone-url: ssh://git@xxxxxx:7999/dev/simple-java-maven-app.git
shared-credentials: shared-ssh-key
branch: master
command-timeout-minutes: '180'
use-shallow-clones: 'false'
cache-on-agents: 'false'
submodules: 'false'
verbose-logs: 'false'
fetch-all: 'false'
lfs: 'false'
viewer: com.atlassian.bamboo.plugins.stash.atlassian-bamboo-plugin-stash:bbServerViewer
17-Apr-2022 07:43:47 Bamboo YAML import failed: Document structure is incorrect: Found following unused properties: repositories / [1] / app-repo / shared-credentials, repositories / [1] / app-repo / branch, repositories / [1] / app-repo / command-timeout-minutes, repositories / [1] / app-repo / use-shallow-clones, repositories / [1] / app-repo / cache-on-agents, repositories / [1] / app-repo / submodules, repositories / [1] / app-repo / verbose-logs, repositories / [1] / app-repo / fetch-all, repositories / [1] / app-repo / lfs, repositories / [1] / app-repo / viewer. 17-Apr-2022 07:43:47 Every property must have a correct key recognizable by Bamboo and must be used as part of the configuration in the current YAML document. Common sources of these problems are typos in properties keys, unused jobs, and mixing a plan and its permissions configuration in one YAML document. 17-Apr-2022 07:43:47 17-Apr-2022 07:43:47 17-Apr-2022 07:43:47 Do you need help? Please visit http://docs.atlassian.com/bamboo/docs-0800/Bamboo+Specs+troubleshooting 17-Apr-2022 07:43:47
Thanks
Mohan
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello @Mohan L
As the error states you have a few issues, I can highlight this one:
The "shared-credentials" property is only valid if used along with "git" type repositories. When using a "bitbucket-server" type repository, Bamboo expects that you declare the following information:
When using Bamboo Specs in interactive mode, the Bamboo server can and fetch the data such as clone url or SSH keys from the Bitbucket Server. In RSS mode, it is not possible, as user session is not available during the automatic update. Therefore the following properties are mandatory when in RSS mode:
- SSH private key of the repository (the key can be defined in both Bamboo Specs Encryption and plain format).
- SSH public key of the repository.
- SSH clone url of this repository, as used by git commands (can be found on repository’s page in Bitbucket Server).
or
Regards,
Eduardo Alvarenga
Atlassian Support APAC
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@Eduardo Alvarenga I need help with my concern about Bamboo Yaml Spec. May I know if you can help me figure out my concern please. Will you be free today or any from your team can see what is the issue here.
Thanks,
Jeff
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.