gReview icon indicating copy to clipboard operation
gReview copied to clipboard

Question about strange key behaiviour

Open vrtareg opened this issue 9 years ago • 4 comments

Hi Team

I would like to check if you faced problem with configuration when PlugIn with linked Git Repository completely ignores the uploaded key and tries to load a key for the server which is configured in "$HOME/.ssh/config" file of user under which Bamboo is running.

I am trying to reproduce same on dev instance and it is working absolutely fine there.

I have tried to remove and recreate repository again on live instance but with no change.

I would like to check if there is any configuration that PlugIn is using could be damaged as there was another conversation earlier which I have resolved byt uninstalling conflicting PlugIn - #37

Looks like that Live instance database data could be contaminated and it will be necessary to fix it manually.

Any ideas?

2016-09-30 15:10:42,868 ERROR [6-DelayedChangeDetectionThread:pool-12-thread-563] [ChainExecutionManagerImpl:1462] Plan 'AAAAA-BBB' could not be started. Exception: org.eclipse.jgit.errors.TransportException: ssh://[email protected]:29418/tool/systems: java.io.FileNotFoundException: /bamboo/.ssh/id_rsa_gerrit (No such file or directory) com.atlassian.bamboo.repository.RepositoryException: org.eclipse.jgit.errors.TransportException: ssh://[email protected]:29418/tool/systems: java.io.FileNotFoundException: /bamboo/.ssh/id_rsa_gerrit (No such file or directory) at com.houghtonassociates.bamboo.plugins.dao.jgit.JGitRepository.getHeadRefForBranch(JGitRepository.java:308) at com.houghtonassociates.bamboo.plugins.dao.jgit.JGitRepository.getLatestRevisionForBranch(JGitRepository.java:333) at com.houghtonassociates.bamboo.plugins.GerritRepositoryAdapter.getBuildChangesFromJGit(GerritRepositoryAdapter.java:948) at com.houghtonassociates.bamboo.plugins.GerritRepositoryAdapter.collectChangesSinceLastBuild(GerritRepositoryAdapter.java:890) at com.atlassian.bamboo.v2.trigger.DefaultChangeDetectionManager.collectChangesWithRetry(DefaultChangeDetectionManager.java:553) at com.atlassian.bamboo.v2.trigger.DefaultChangeDetectionManager.lambda$createBuildRepositoryChanges$48(DefaultChangeDetectionManager.java:424) at com.atlassian.bamboo.variable.CustomVariableContextImpl.withVariableSubstitutor(CustomVariableContextImpl.java:215) at com.atlassian.bamboo.v2.trigger.DefaultChangeDetectionManager.collectChangesSinceLastBuildInternal(DefaultChangeDetectionManager.java:359) at com.atlassian.bamboo.v2.trigger.DefaultChangeDetectionManager.collectChangesSinceRevisions(DefaultChangeDetectionManager.java:307) at com.atlassian.bamboo.v2.trigger.DefaultChangeDetectionManager.collectChangesSinceRevisions(DefaultChangeDetectionManager.java:199) at com.atlassian.bamboo.v2.trigger.DefaultChangeDetectionManager.collectAllChangesSinceLastBuild(DefaultChangeDetectionManager.java:156) at com.atlassian.bamboo.v2.trigger.ManualBuildDetectionAction.performDelayedChangeDetection(ManualBuildDetectionAction.java:172) at com.atlassian.bamboo.chains.ChainExecutionManagerImpl$2.getChainState(ChainExecutionManagerImpl.java:250) at com.atlassian.bamboo.chains.ChainExecutionManagerImpl.tryStartChainState(ChainExecutionManagerImpl.java:341) at com.atlassian.bamboo.chains.ChainExecutionManagerImpl.delayedStart(ChainExecutionManagerImpl.java:239) at sun.reflect.GeneratedMethodAccessor3684.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:317) 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:207) at com.sun.proxy.$Proxy156.delayedStart(Unknown Source) at com.atlassian.bamboo.plan.PlanExecutionManagerImpl$2$1$1.lambda$call$140(PlanExecutionManagerImpl.java:426) at com.atlassian.bamboo.util.CacheAwareness$3.call(CacheAwareness.java:134) at com.atlassian.bamboo.util.CacheAwareness$3.call(CacheAwareness.java:130) at com.atlassian.bamboo.util.CacheAwareness.withValuesOlderThanTimestampReloaded(CacheAwareness.java:163) at com.atlassian.bamboo.util.CacheAwareness.withValuesOlderThanTimestampReloaded(CacheAwareness.java:129) at com.atlassian.bamboo.util.CacheAwareness.withValuesOlderThanTimestampReloaded(CacheAwareness.java:194) at com.atlassian.bamboo.plan.PlanExecutionManagerImpl$2$1$1.call(PlanExecutionManagerImpl.java:425) at com.atlassian.bamboo.plan.PlanExecutionManagerImpl$2$1$1.call(PlanExecutionManagerImpl.java:416) at com.atlassian.util.concurrent.ManagedLocks$ManagedLockImpl.withLock(ManagedLocks.java:312) at com.atlassian.bamboo.plan.PlanExecutionLockServiceImpl.lock(PlanExecutionLockServiceImpl.java:85) at com.atlassian.bamboo.plan.PlanExecutionManagerImpl.doWithProcessLock(PlanExecutionManagerImpl.java:796) at com.atlassian.bamboo.plan.PlanExecutionManagerImpl.access$400(PlanExecutionManagerImpl.java:128) at com.atlassian.bamboo.plan.PlanExecutionManagerImpl$2$1.run(PlanExecutionManagerImpl.java:410) 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(Unknown Source) Caused by: org.eclipse.jgit.errors.TransportException: ssh://[email protected]:29418/tool/systems: java.io.FileNotFoundException: /bamboo/.ssh/id_rsa_gerrit (No such file or directory) at org.eclipse.jgit.transport.JschConfigSessionFactory.getSession(JschConfigSessionFactory.java:159) at org.eclipse.jgit.transport.SshTransport.getSession(SshTransport.java:136) at org.eclipse.jgit.transport.TransportGitSsh$SshFetchConnection.<init>(TransportGitSsh.java:262) at org.eclipse.jgit.transport.TransportGitSsh.openFetch(TransportGitSsh.java:161) at com.houghtonassociates.bamboo.plugins.dao.jgit.JGitRepository.getHeadRefForBranch(JGitRepository.java:301) ... 42 more Caused by: com.jcraft.jsch.JSchException: java.io.FileNotFoundException: /bamboo/.ssh/id_rsa_gerrit (No such file or directory) at com.jcraft.jsch.KeyPair.load(KeyPair.java:525) at com.jcraft.jsch.IdentityFile.newInstance(IdentityFile.java:40) at com.jcraft.jsch.JSch.addIdentity(JSch.java:393) at com.jcraft.jsch.JSch.addIdentity(JSch.java:353) at org.eclipse.jgit.transport.JschConfigSessionFactory.getJSch(JschConfigSessionFactory.java:261) at com.houghtonassociates.bamboo.plugins.dao.jgit.JGitRepository$1.getJSch(JGitRepository.java:171) at org.eclipse.jgit.transport.JschConfigSessionFactory.createSession(JschConfigSessionFactory.java:219) at org.eclipse.jgit.transport.JschConfigSessionFactory.createSession(JschConfigSessionFactory.java:175) at org.eclipse.jgit.transport.JschConfigSessionFactory.getSession(JschConfigSessionFactory.java:109) ... 46 more Caused by: java.io.FileNotFoundException: /bamboo/.ssh/id_rsa_gerrit (No such file or directory) at java.io.FileInputStream.open0(Native Method) at java.io.FileInputStream.open(Unknown Source) at java.io.FileInputStream.<init>(Unknown Source) at java.io.FileInputStream.<init>(Unknown Source) at com.jcraft.jsch.Util.fromFile(Util.java:508) at com.jcraft.jsch.KeyPair.load(KeyPair.java:522) ... 54 more

Regards, Areg

vrtareg avatar Sep 30 '16 15:09 vrtareg

Any ideas please. Any reason that code check could look for the SSH config file instead of uploaded key?

vrtareg avatar Oct 05 '16 12:10 vrtareg

It's hard to say without debugging on the local instance. Judging by the log, the file it's attempting to load is pointing to:

java.io.FileNotFoundException: /bamboo/.ssh/id_rsa_gerrit (No such file or directory)

My guess is the file provided in the target configuration is no longer pointing to a valid location or somehow the permissions aren't set correctly for Bamboo to read from this location.

onepremise avatar Oct 07 '16 14:10 onepremise

Check is quite simple. Create Plan and configure repository in it to Gerrit server A Check if plan working with uploaded key

In Bamboo running user home .ssh folder create config file and add line that will tell to use non existing ssh key for Gerrit server A.

Theoretically Bamboo user running ssh configuration should not affect gReview configuration as it is separate key ....

Actually it is affecting.

Once .ssh/config is deleted all working good. Once it is in place all falling apart ...

vrtareg avatar Nov 08 '16 14:11 vrtareg

Is this the same setup as mentioned in your previous bug?

Java: jdk 1.8.77 Bamboo 5.10.3 Plug-In latest from marketplace.atlassian.com Linux: RedHat Enterprise 6.6 (aka Cents 6.6)

It looks like there might be a search path issue. What user are you running your service under. Can you try dedicating your servlet container to run under a user dedicated to this service alone? If you haven't done so already.

onepremise avatar Nov 09 '16 15:11 onepremise