Details
-
Bug
-
Resolution: Won't Fix
-
Low
-
None
-
None
-
None
Description
Summary
Defining SSH server capabilities breaks the check out of Git repos.
For example:
SSH | /usr/bin/ssh |
Steps to Reproduce
- Set up a Linked (generic) Git repo on a server with SSH access. To accomplish that, please refer to Git on the Server - Getting Git on a Server
- Set up the SSH key pairs properly as described on Sharing repository credentials
- Set up a Git repository to be used by Bamboo and supply the private key generated above
- Create a plan to check out source code from the repo above
- Run the Build
- Defining SSH server capabilities. For instance: |SSH|/usr/bin/ssh|
- Run the Build
Expected Results
When you run the Build as above it should just work on both scenarios.
Actual Results
If you define SSH on the server capability, Bamboo should work as well. However, it breaks as it seems to be pointing to a different known_hosts file. The error below can be found on the UI:
(com.atlassian.bamboo.repository.RepositoryException : java.lang.RuntimeException: com.atlassian.bamboo.repository.RepositoryException: com.atlassian.bamboo.plugins.git.GitCommandException: command /usr/bin/git ls-remote ssh://6de1e51d-2587-4ee9-ac97-c908a030b847@127.0.0.1:56648/Users/tbomfim/repo_clone/repotestbare.git failed with code 128. Working directory was [.]., stderr: [Host key verification failed., fatal: Could not read from remote repository., , Please make sure you have the correct access rights, and the repository exists.])
atlassian-bamboo.log
2015-04-02 16:44:10,425 ERROR [8-BranchDetectionBackgroundThread:pool-16-thread-1] [BambooPluginUtils] An unexpected error has occurred while detecting branches: BSP15919-BSP15919 com.google.common.util.concurrent.UncheckedExecutionException: com.atlassian.bamboo.plugins.git.GitCommandException: command /usr/bin/git ls-remote ssh://7b7852ba-8568-49b6-8f2c-2b7cc5d294fd@127.0.0.1:63080/for/repotest3.git failed with code 128. Working directory was [/Users/tbomfim/bamboo-home-5.6.2/xml-data/build-dir]., stderr: Authenticating remote session failed stdout: [Warning: Permanently added '[127.0.0.1]:63080' (RSA) to the list of known hosts., BAMBOO-SSH-PROXY: [While connecting to [git@localhost/127.0.0.1:7999]: Authenticating remote session failed], fatal: Could not read from remote repository., , Please make sure you have the correct access rights, and the repository exists.] at com.atlassian.bamboo.collections.AlwaysInvalidatingCacheDecorator.getUnchecked(AlwaysInvalidatingCacheDecorator.java:139) at com.atlassian.bamboo.util.CallableResultCache.call(CallableResultCache.java:143) at com.atlassian.bamboo.plugins.git.NativeGitOperationHelper.getRemoteRefs(NativeGitOperationHelper.java:500) at com.atlassian.bamboo.plugins.git.NativeGitOperationHelper.getOpenBranches(NativeGitOperationHelper.java:464) at com.atlassian.bamboo.plugins.git.GitRepository.getOpenBranches(GitRepository.java:461) at com.atlassian.bamboo.repository.RepositoryCachingFacadeImpl$1.load(RepositoryCachingFacadeImpl.java:37) at com.atlassian.bamboo.repository.RepositoryCachingFacadeImpl$1.load(RepositoryCachingFacadeImpl.java:29) at com.google.common.cache.LocalCache$LoadingValueReference.loadFuture(LocalCache.java:3568) at com.google.common.cache.LocalCache$Segment.loadSync(LocalCache.java:2350) at com.google.common.cache.LocalCache$Segment.lockedGetOrLoad(LocalCache.java:2313) at com.google.common.cache.LocalCache$Segment.get(LocalCache.java:2228) at com.google.common.cache.LocalCache.get(LocalCache.java:3965) at com.google.common.cache.LocalCache.getOrLoad(LocalCache.java:3969) at com.google.common.cache.LocalCache$LocalManualCache.get(LocalCache.java:4829) at com.atlassian.bamboo.repository.RepositoryCachingFacadeImpl.getOpenBranches(RepositoryCachingFacadeImpl.java:69) "atlassian-bamboo.log" 13970L, 1736826C at com.atlassian.bamboo.plan.branch.BranchDetectionServiceImpl$BranchDetector.run(BranchDetectionServiceImpl.java:310) at com.atlassian.bamboo.utils.BambooRunnables$1.run(BambooRunnables.java:49) at com.atlassian.bamboo.security.ImpersonationHelper.runWith(ImpersonationHelper.java:31) at com.atlassian.bamboo.security.ImpersonationHelper.runWithSystemAuthority(ImpersonationHelper.java:20) at com.atlassian.bamboo.security.ImpersonationHelper$1.run(ImpersonationHelper.java:52) at java.lang.Thread.run(Thread.java:745) Caused by: com.atlassian.bamboo.plugins.git.GitCommandException: command /usr/bin/git ls-remote ssh://347e5c2e-fcd4-4aa7-ab28-fea1788391cd@127.0.0.1:56648/for/repotest3.git failed with code 128. Working directory was [/Users/tbomfim/bamboo-home-5.6.2/xml-data/build-dir]., stderr: [Host key verification failed., fatal: Could not read from remote repository., , Please make sure you have the correct access rights, and the repository exists.] at com.atlassian.bamboo.plugins.git.GitCommandProcessor.runCommand(GitCommandProcessor.java:551) at com.atlassian.bamboo.plugins.git.GitCommandProcessor.getRemoteRefs(GitCommandProcessor.java:418) at com.atlassian.bamboo.plugins.git.NativeGitOperationHelper$1.call(NativeGitOperationHelper.java:488) at com.atlassian.bamboo.plugins.git.NativeGitOperationHelper$1.call(NativeGitOperationHelper.java:479) at com.atlassian.bamboo.util.CallableResultCache$1.load(CallableResultCache.java:52) at com.atlassian.bamboo.util.CallableResultCache$1.load(CallableResultCache.java:48) at com.google.common.cache.LocalCache$LoadingValueReference.loadFuture(LocalCache.java:3568) at com.google.common.cache.LocalCache$Segment.loadSync(LocalCache.java:2350) at com.google.common.cache.LocalCache$Segment.lockedGetOrLoad(LocalCache.java:2313) at com.google.common.cache.LocalCache$Segment.get(LocalCache.java:2228) at com.google.common.cache.LocalCache.get(LocalCache.java:3965) at com.google.common.cache.LocalCache.getOrLoad(LocalCache.java:3969) at com.google.common.cache.LocalCache$LocalManualCache.get(LocalCache.java:4829) at com.atlassian.bamboo.collections.AlwaysInvalidatingCacheDecorator.get(AlwaysInvalidatingCacheDecorator.java:81) at com.atlassian.bamboo.collections.AlwaysInvalidatingCacheDecorator.getUnchecked(AlwaysInvalidatingCacheDecorator.java:135) ... 30 more
Solution / Workaround
- If you manually run the git command shown in the UI and add the key to the known_hosts, you will be able to run the build (however it stops working after Bamboo is restarted):
$ /usr/bin/git ls-remote ssh://cd6e67f4-ffbf-44c7-b420-1cbaee5a7776@127.0.0.1:63080/Users/tbomfim/repo_clone/repotestbare.git The authenticity of host '[127.0.0.1]:63080 ([127.0.0.1]:63080)' can't be established. RSA key fingerprint is fc:1f:3c:61:5d:9a:28:b7:34:a5:93:3d:a0:12:2b:05. Are you sure you want to continue connecting (yes/no)? yes
- Edit the file known_hosts (eg: ~/.ssh/known_hosts) to set the above port "[127.0.0.1]:63080" to be a wild card, example:
[127.0.0.1]:* ssh-rsa xxxx...