Bamboo + Stash Authentication problems

I'm runing Stash 3.2.2 and Bamboo 5.7.2 on Linux and, in general, they work together well.  However, for branch builds, I am frequently getting problems where builds do not start due to Bamboo forgetting the authentication to Stash.  Is there any way to stop this?

e.g.  #1 "Errors getting changes for DEV-FPM3-11 - This error may have occurred due to an authentication issue with Stash.  Save the repository configuration to refresh the authentication details".  However, when I try to save the repo config, the drop-down repository box just has a spinning icon next to it, and never displays a repository.  If I just blindly click the "Save Repository" button, the issue is not cleared and I get the following error:

e.g. #2 "Plan DEV-FPM3-11 Started but a fatal error occurred"  In the logs, I see the error:  java.lang.IllegalArgumentException: Unknown Repository Definition 18448388

7 answers

This widget could not be displayed.

Hello,

If you are running Bamboo and Stash and you have set up repositories in Bamboo by selecting Stash as Repository host, as mentioned earlier in this thread:

  1. When configuring repository definition on Bamboo side (either in Plan or in Administration/Linked repositories) Bamboo will create SSH keypair and will store private key in the repository configuration and upload public key to Stash (it can be seen in the list of SSH keys of a user X who defined repository on Bamboo side).
  2. When running a build Bamboo will present the private key thus making Stash recognise it as user X (no matter how plan was run).

Since you have removed SSH keys in Stash, it might be the case you have deleted keys that have been generated by Bamboo when configuring the repository. If this is the case, yes, it will be required to go through the repositories set up in Bamboo and hit the Save button as a new key-pair will be generated.

If you find this answer useful, I would kindly ask you to accept it so the same will be visible to others who might be facing the same issue you have inquired.

Thank you for your understanding.

Kind regards,
Rafael P. Sperafico
Atlassian Support

This widget could not be displayed.

Hello Richard,

Thank you for your question.

I would kindly suggest you on recreating the application link between Bamboo and Stash as per following:

When using Bamboo 5.6+ Stash 3.2+ newly created application link with default settings:

  • The servers have the same set of users and usernames (disabled)
  • I am an administrator on both instances (enabled)

Will result in application link created with:

  • Trusted Apps authentication (disabled)
  • OAuth authentication (enabled)
  • ** Allow 2-Legged OAuth (enabled)
  • ** Allow user impersonation through 2-Legged OAuth (disabled)
  • Basic Auth authentication (disabled)

In Stash, please make sure you have "Stash administration >> Settings >> Server Settings >> SSH access" configured as per following:

[x] SSH enabled
[x] SSH access keys enabled
SSH Port: 7999

Let me explain briefly how we authenticate when Bamboo works with Stash repositories.

  1. When configuring repository definition on Bamboo side (either in Plan or in Administration/Linked repositories) Bamboo will create SSH keypair and will store private key in the repository configuration and upload public key to Stash (it can be seen in the list of SSH keys of a user X who defined repository on Bamboo side).
  2. When running a build Bamboo will present the private key thus making Stash recognise it as user X (no matter how plan was run).

Please, make sure the user saving repository configuration in Bamboo has permissions to the repository in Stash.

If you find this answer useful, I would kindly ask you to accept it so the same will be visible to others who might be facing the same issue you have inquired.

Thank you for your understanding.

Kind regards,
Rafael P. Sperafico
Atlassian Support

We are also having these issues now. None of our branch changes in stash are triggering any Bamboo builds now. Could use an answer here.

This widget could not be displayed.

i've done that and i'm still getting errors:

 

cp-test - cptest : Plan 'CPTES-CPTES' could not be started. Exception: java.lang.RuntimeException: com.atlassian.bamboo.plugins.stash.repository.StashRepositoryException: com.atlassian.bamboo.repository.RepositoryException: com.atlassian.bamboo.plugins.git.GitCommandException: command /usr/bin/git ls-remote ssh://28b746c0-4473-44c6-904c-bdccc39795bb@127.0.0.1:49075/cyb/cybertests.git failed with code 128. Working directory was [.]., stderr:
[/opt/atlassian/bamboo-install/atlassian-bamboo-5.7.2/temp/bamboo-ssh.daffe1b7.sh: line 2: system.git.executable.ssh: command not found, fatal: Could not read from remote repository., , Please make sure you have the correct access rights, and the repository exists.]

This error may have occurred due to an authentication issue with Stash. Save the repository configuration to refresh the authentication details.
(02 Mar 2015, 10:10:28 AM)

cp-test - cptest › CPTES-CPTES-1 : Errors getting changes for CPTES-CPTES-1

This error may have occurred due to an authentication issue with Stash. Save the repository configuration to refresh the authentication details.
(02 Mar 2015, 10:10:28 AM)
This widget could not be displayed.

Hello,

Just to give an update in here, this issue was related to ports used by Stash not accessible by Bamboo.

Please, refer to ResponseConnectTimeoutException: The host did not accept the connection within timeout of 1500 ms documentation for further information.

If you find this answer useful, I would kindly ask you to accept it so the same will be visible to others who might be facing the same issue you have inquired.

Thank you for your understanding.

Kind regards,
Rafael P. Sperafico
Atlassian Support

This widget could not be displayed.

So... we removed some bamboo ssh keys from a few user accounts in stash, not knowing what generated those. Now, several hundreds of branch build plans are blocked cause apparently they were the source of those keys (lesson learned). How do we refresh those repository configurations en mass? Not looking forward to having to click through 2 pages over 600 times....... surely there must be a more convenient way to do this?

This widget could not be displayed.

How could I get Bamboo to use just one account in Stash (always the same one)?

This widget could not be displayed.

Hello,

Instead of using Stash as Repository host, you could select Git instead. After that you could set up your Stash repositories and Bamboo to run from a SSH key-pair defined by you.

If you find this answer useful, I would kindly ask you to accept it so the same will be visible to others who might be facing the same issue you have inquired.

Thank you for your understanding.

Kind regards,
Rafael P. Sperafico
Atlassian Support

We are experiencing similar symptoms with Bamboo using Stash as its git repository (trusted apps, 2-legged Oauth). I'm not sure if they come from exactly the same root cause. I've got a support ticket open and will make sure this page is mentioned. In our case there's also a mass credential expiration in the wee hours of the morning and a whole slew authentication errors. It is nearly unique in my experience to hear a software vendor say "We can't make our company's code repository work reliably with our build tool. You should seriously consider patronizing one of our competitors."

Hello Todd, I have noticed your comment on my previous reply to this Answer and, just for clarification, in Bamboo when setting up a repository, you have several options you can select from as *Repository host*: - Stash - Bitbucket - Git - GitHub - Mercurial - CVS - Subversion - Perforce And when referring to select Git as repository host, this was related to the inquire "How could I get Bamboo to use just one account in Stash (always the same one)?" where you could setup Stash repositories in Bamboo as Git (*Repository host*) and use a pre-defined SSH keypair. PS. Please, notice Git is not GitHub. Could you please elaborate on your statement "We can't make our company's code repository work reliably with our build tool. You should seriously consider patronizing one of our competitors.", please? — Kind regards, Rafael P. Sperafico Atlassian Support

Thanks for the clarification. That seemed awfully strange.

What's the logic of tying a bamboo linked (or otherwise) repository to the *user* who created it? That seemingly unnecessarily confuses authorization as it means people can use a repository without knowing that it is tied to a given user who might (at any time) choose to delete the public key from their stash account or who may leave the company, etc). Why not allow the use of a statically configured key pair (or even a shared credential as the documentation here: https://confluence.atlassian.com/stash/ssh-access-keys-for-system-use-563609615.html#SSHaccesskeysforsystemuse-UsingSSHkeystoallowaccesstoStashrepositories) would indicate is supposed to work but as far as I can tell does not). Additionally, why on earth do the generated keys just say "http(s)://bamboo.example.com" and not mention the linked repository they belong to **at all**? How is that intended to be useful? As a further issue why do the public key entries not get deleted when the linked repository that generated them get deleted? (I'm happy to file issues for any/all of these if that's what makes sense.)

Suggest an answer

Log in or Sign up to answer
Atlassian Summit 2018

Meet the community IRL

Atlassian Summit is an excellent opportunity for in-person support, training, and networking.

Learn more
Community showcase
Posted Friday in Bitbucket

What is your #1 piece of advice to new users getting started using Bitbucket?

Hello Community! My name is Claire Maynard, and I’m a Product Marketing Manager on the Bitbucket team. I’m interested in hearing what advice or tips you have for new users getting started on ...

136 views 5 2
Join discussion

Atlassian User Groups

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

Find a group

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

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you