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

Git checkout in Bamboo fails with:Cannot read keypair, it doesn't contain any line with '-----BEGIN'

Priidu Kull October 6, 2017

I am setting up a new instance of Bamboo. When I run my first build plan ( checkout from a git repository), it fails with the following error log:

com.atlassian.bamboo.repository.RepositoryException: com.google.common.util.concurrent.UncheckedExecutionException: java.lang.IllegalArgumentException: Cannot read keypair, it doesn't contain any line with '-----BEGIN'
	at com.atlassian.bamboo.v2.trigger.DefaultChangeDetectionManager.collectChangesSinceLastBuildInternal(DefaultChangeDetectionManager.java:335)
	at com.atlassian.bamboo.v2.trigger.DefaultChangeDetectionManager.collectChangesSinceRevisions(DefaultChangeDetectionManager.java:280)
	at com.atlassian.bamboo.v2.trigger.DefaultChangeDetectionManager.collectChangesSinceRevisions(DefaultChangeDetectionManager.java:190)
	at com.atlassian.bamboo.v2.trigger.DefaultChangeDetectionManager.collectAllChangesSinceLastBuild(DefaultChangeDetectionManager.java:152)
	at com.atlassian.bamboo.v2.trigger.ManualBuildDetectionAction.performDelayedChangeDetection(ManualBuildDetectionAction.java:156)
	at com.atlassian.bamboo.chains.ChainExecutionManagerImpl$1.getChainState(ChainExecutionManagerImpl.java:240)
	at com.atlassian.bamboo.chains.ChainExecutionManagerImpl.tryStartChainState(ChainExecutionManagerImpl.java:315)
	at com.atlassian.bamboo.chains.ChainExecutionManagerImpl.delayedStart(ChainExecutionManagerImpl.java:232)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:333)
	at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:190)
	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:157)
	at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:92)
	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
	at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:213)
	at com.sun.proxy.$Proxy194.delayedStart(Unknown Source)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:333)
	at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:207)
	at com.sun.proxy.$Proxy194.delayedStart(Unknown Source)
	at com.atlassian.bamboo.plan.PlanExecutionManagerImpl$1$1$1.lambda$call$0(PlanExecutionManagerImpl.java:374)
	at com.atlassian.bamboo.util.CacheAwareness$3.call(CacheAwareness.java:136)
	at com.atlassian.bamboo.util.CacheAwareness$3.call(CacheAwareness.java:133)
	at com.atlassian.bamboo.util.CacheAwareness.withValuesOlderThanTimestampReloaded(CacheAwareness.java:162)
	at com.atlassian.bamboo.util.CacheAwareness.withValuesOlderThanTimestampReloaded(CacheAwareness.java:133)
	at com.atlassian.bamboo.util.CacheAwareness.withValuesOlderThanTimestampReloaded(CacheAwareness.java:187)
	at com.atlassian.bamboo.plan.PlanExecutionManagerImpl$1$1$1.call(PlanExecutionManagerImpl.java:373)
	at com.atlassian.bamboo.plan.PlanExecutionManagerImpl$1$1$1.call(PlanExecutionManagerImpl.java:366)
	at io.atlassian.util.concurrent.ManagedLocks$ManagedLockImpl.withLock(ManagedLocks.java:293)
	at com.atlassian.bamboo.plan.PlanExecutionLockServiceImpl.lock(PlanExecutionLockServiceImpl.java:75)
	at com.atlassian.bamboo.plan.PlanExecutionManagerImpl.doWithProcessLock(PlanExecutionManagerImpl.java:655)
	at com.atlassian.bamboo.plan.PlanExecutionManagerImpl.access$400(PlanExecutionManagerImpl.java:130)
	at com.atlassian.bamboo.plan.PlanExecutionManagerImpl$1$1.run(PlanExecutionManagerImpl.java:362)
	at com.atlassian.bamboo.utils.BambooRunnables$1.run(BambooRunnables.java:47)
	at com.atlassian.bamboo.security.ImpersonationHelper.runWith(ImpersonationHelper.java:26)
	at com.atlassian.bamboo.security.ImpersonationHelper.runWithSystemAuthority(ImpersonationHelper.java:17)
	at com.atlassian.bamboo.security.ImpersonationHelper$1.run(ImpersonationHelper.java:41)
	at java.lang.Thread.run(Thread.java:748)
Caused by: com.google.common.util.concurrent.UncheckedExecutionException: java.lang.IllegalArgumentException: Cannot read keypair, it doesn't contain any line with '-----BEGIN'
	at com.google.common.cache.LocalCache$Segment.get(LocalCache.java:2203)
	at com.google.common.cache.LocalCache.get(LocalCache.java:3937)
	at com.google.common.cache.LocalCache.getOrLoad(LocalCache.java:3941)
	at com.google.common.cache.LocalCache$LocalLoadingCache.get(LocalCache.java:4824)
	at com.atlassian.bamboo.collections.AlwaysInvalidatingCacheDecorator.get(AlwaysInvalidatingCacheDecorator.java:64)
	at com.atlassian.bamboo.collections.AlwaysInvalidatingCacheDecorator.getUnchecked(AlwaysInvalidatingCacheDecorator.java:125)
	at com.atlassian.bamboo.util.CallableResultCache.call(CallableResultCache.java:141)
	at com.atlassian.bamboo.plugins.git.NativeGitOperationHelper.getRemoteRefs(NativeGitOperationHelper.java:521)
	at com.atlassian.bamboo.plugins.git.NativeGitOperationHelper.getOpenBranches(NativeGitOperationHelper.java:496)
	at com.atlassian.bamboo.plugins.git.v2.GitBranchDetector.getOpenBranches(GitBranchDetector.java:33)
	at com.atlassian.bamboo.repository.RepositoryCachingFacadeImpl$2.getOpenBranchesCaller(RepositoryCachingFacadeImpl.java:71)
	at com.atlassian.bamboo.repository.RepositoryCachingFacadeImpl$2.load(RepositoryCachingFacadeImpl.java:60)
	at com.atlassian.bamboo.repository.RepositoryCachingFacadeImpl$2.load(RepositoryCachingFacadeImpl.java:56)
	at com.google.common.cache.LocalCache$LoadingValueReference.loadFuture(LocalCache.java:3527)
	at com.google.common.cache.LocalCache$Segment.loadSync(LocalCache.java:2319)
	at com.google.common.cache.LocalCache$Segment.lockedGetOrLoad(LocalCache.java:2282)
	at com.google.common.cache.LocalCache$Segment.get(LocalCache.java:2197)
	at com.google.common.cache.LocalCache.get(LocalCache.java:3937)
	at com.google.common.cache.LocalCache.getOrLoad(LocalCache.java:3941)
	at com.google.common.cache.LocalCache$LocalLoadingCache.get(LocalCache.java:4824)
	at com.atlassian.bamboo.repository.RepositoryCachingFacadeImpl.getOpenBranches(RepositoryCachingFacadeImpl.java:125)
	at com.atlassian.bamboo.v2.trigger.DefaultChangeDetectionManager.handleRepositoryExceptionForDeletedBranch(DefaultChangeDetectionManager.java:484)
	at com.atlassian.bamboo.v2.trigger.DefaultChangeDetectionManager.handleRepositoryExceptionForDeletedBranchWithRetry(DefaultChangeDetectionManager.java:514)
	at com.atlassian.bamboo.v2.trigger.DefaultChangeDetectionManager.collectionChangesWithRetry(DefaultChangeDetectionManager.java:470)
	at com.atlassian.bamboo.v2.trigger.DefaultChangeDetectionManager.lambda$createBuildRepositoryChanges$0(DefaultChangeDetectionManager.java:369)
	at com.atlassian.bamboo.variable.CustomVariableContextImpl.withVariableSubstitutor(CustomVariableContextImpl.java:185)
	at com.atlassian.bamboo.v2.trigger.DefaultChangeDetectionManager.collectChangesSinceLastBuildInternal(DefaultChangeDetectionManager.java:331)
	... 43 more
Caused by: java.lang.IllegalArgumentException: Cannot read keypair, it doesn't contain any line with '-----BEGIN'
	at com.google.common.base.Preconditions.checkArgument(Preconditions.java:122)
	at com.atlassian.bamboo.plugins.ssh.ProxyConnectionDataBuilderImpl.withKeyFromReader(ProxyConnectionDataBuilderImpl.java:89)
	at com.atlassian.bamboo.plugins.ssh.ProxyConnectionDataBuilderImpl.withKeyFromString(ProxyConnectionDataBuilderImpl.java:69)
	at com.atlassian.bamboo.plugins.ssh.ProxyConnectionDataBuilderImpl.withKeyFromString(ProxyConnectionDataBuilderImpl.java:30)
	at com.atlassian.bamboo.plugins.git.NativeGitOperationHelper.adjustRepositoryAccess(NativeGitOperationHelper.java:193)
	at com.atlassian.bamboo.plugins.git.NativeGitOperationHelper.lambda$getRemoteRefs$0(NativeGitOperationHelper.java:510)
	at com.atlassian.bamboo.util.CallableResultCache$1.load(CallableResultCache.java:38)
	at com.atlassian.bamboo.util.CallableResultCache$1.load(CallableResultCache.java:34)
	at com.google.common.cache.LocalCache$LoadingValueReference.loadFuture(LocalCache.java:3527)
	at com.google.common.cache.LocalCache$Segment.loadSync(LocalCache.java:2319)
	at com.google.common.cache.LocalCache$Segment.lockedGetOrLoad(LocalCache.java:2282)
	at com.google.common.cache.LocalCache$Segment.get(LocalCache.java:2197)
	... 69 more

 

When I set up my repo, I pressed "test connection" and was successful in creating a connection. Git checkout only fail when running the build plan. 

For the id_rsa file I use a proper id_rsa file, it does being with -----BEGIN

All help with the issue will be much appreciated.

repo config.pngtask.png

3 answers

0 votes
Teddi May 16, 2018

Hello,

 

This seems to be caused by entering a private ssh key where Bamboo needs the key itself. In Bamboo 6.5 when setting up shared credentials, you get to enter your key in an input box labelled "SSH Key". Below this box is the text "SSH private key you want to use to access the repository." Make sure to enter the private key.

 

Regards,

Theodor

0 votes
Nik P May 3, 2018

Facing the same problem. Any answers ?

0 votes
somethingblue
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
October 14, 2017

Hi Priidu,

  • What version of Bamboo are you using?

I found a bug that seems to resemble what you're experiencing.  You can find it at BAM-18359. Take a look at the issue and if you believe it applies, there is a workaround that you can try:

Workaround

  1. Disable Override the plan's default repository settings
  2. Press save
  3. Enable Override the plan's default repository settings and select the new repository
  4. Press save

If that does work for you please vote on the issue and you'll be notified of any changes to the issue.

Cheers,

Branden

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events