I currently have the starter license so I am not allowed to submit this to support and I am not allowed to post this issue to the Bamboo JIRA project either so I am posting it here.
As we know, the default JGit is buggy, so it is better to use a native git install by adding an appropriate capability. However, if you enable a native git capability where your system has the following conditions, you will get an NPE:
It is not a safe assumption that if you are not in a windows environment that `/usr/echo` or `/usr/bin/echo` exists. For example I am using a nixos install, and `echo` in my environment exists at `/run/current-system/sw/bin/echo`.
My workaround is to set `SSH_ASKPASS` to `/run/current-system/sw/bin/echo`.
Hi @Asa Riley,
Thanks for reaching out to us!
When Bamboo uses native Git, it simply calls the git executable that you have defined. If `SSH_ASKPASS` is not set, Git should try to send a prompt to the terminal to ask for password input, which appears to be where "echo" comes in.
Can you please paste the NullPointerException stack trace that you receive so we can review it further? This will help us see if we can resolve it here, or if we should file a bug report in the JIRA project.
Without that, I can only give a few suggestions here:
Since, by default, on most linux distributions, `/bin` and `/usr/bin` are already in the PATH, one thing to check could be whether `/run/current-system/sw/bin` is included in the PATH environment variable for the user that runs Bamboo. This should allow Git (and Bamboo) to call it.
Alternatively, you could set `core.askpass` in your git config as follows:
git config --global core.askpass /run/current-system/sw/bin/echo
Thank you!
Elias | Bamboo Support
Thanks for the response Elias.
`/run/current-system/sw/bin` is included in the PATH for the user that runs bamboo but it seems that bamboo does not check the PATH for `echo`. It only checks those two specific locations.
Here is the stack trace:
2018-06-26 16:48:42,811 ERROR [12-BranchDetectionBackgroundThread:pool-19-thread-2] [BranchDetectionServiceImpl] Repository error while detecting branches for plan JC-PR. java.lang.NullPointerException
com.atlassian.bamboo.repository.RepositoryException: java.lang.NullPointerException
at com.atlassian.bamboo.plugins.git.GitCommandProcessor.getGitVersion(GitCommandProcessor.java:245)
at com.atlassian.bamboo.plugins.git.NativeGitOperationHelper.<init>(NativeGitOperationHelper.java:125)
at com.atlassian.bamboo.plugins.git.GitOperationHelperFactory.createGitOperationHelper(GitOperationHelperFactory.java:45)
at com.atlassian.bamboo.plugins.git.v2.GitBranchDetector.getOpenBranches(GitBranchDetector.java:45)
at com.atlassian.bamboo.repository.RepositoryCachingFacadeImpl$2.getOpenBranchesCaller(RepositoryCachingFacadeImpl.java:72)
at com.atlassian.bamboo.repository.RepositoryCachingFacadeImpl$2.lambda$load$0(RepositoryCachingFacadeImpl.java:66)
at com.atlassian.bamboo.executor.RetryingTaskExecutor.rerun(RetryingTaskExecutor.java:112)
at com.atlassian.bamboo.executor.RetryingTaskExecutor.runTask(RetryingTaskExecutor.java:99)
at com.atlassian.bamboo.executor.RetryingTaskExecutor.retry(RetryingTaskExecutor.java:207)
at com.atlassian.bamboo.executor.RetryingTaskExecutor.retry(RetryingTaskExecutor.java:188)
at com.atlassian.bamboo.repository.RepositoryCachingFacadeImpl$2.load(RepositoryCachingFacadeImpl.java:63)
at com.atlassian.bamboo.repository.RepositoryCachingFacadeImpl$2.load(RepositoryCachingFacadeImpl.java:57)
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:126)
at com.atlassian.bamboo.plan.branch.BranchDetectionServiceImpl.lambda$getOpenBranches$4(BranchDetectionServiceImpl.java:534)
at com.atlassian.bamboo.variable.CustomVariableContextImpl.withVariableSubstitutor(CustomVariableContextImpl.java:185)
at com.atlassian.bamboo.plan.branch.BranchDetectionServiceImpl.getOpenBranches(BranchDetectionServiceImpl.java:533)
at com.atlassian.bamboo.plan.branch.BranchDetectionServiceImpl.createNewBranchesForChainNoLock(BranchDetectionServiceImpl.java:283)
at com.atlassian.bamboo.plan.branch.BranchDetectionServiceImpl$BranchDetector$1.lambda$run$0(BranchDetectionServiceImpl.java:134)
at org.springframework.orm.hibernate5.HibernateTemplate.doExecute(HibernateTemplate.java:383)
at org.springframework.orm.hibernate5.HibernateTemplate.execute(HibernateTemplate.java:335)
at com.atlassian.bamboo.plan.branch.BranchDetectionServiceImpl$BranchDetector$1.run(BranchDetectionServiceImpl.java:125)
at com.atlassian.bamboo.plugin.BambooPluginUtils$Runnable.call(BambooPluginUtils.java:106)
at com.atlassian.bamboo.plugin.BambooPluginUtils$Runnable.call(BambooPluginUtils.java:99)
at com.atlassian.bamboo.plugin.BambooPluginUtils.callUnsafeCode(BambooPluginUtils.java:53)
at com.atlassian.bamboo.plan.branch.BranchDetectionServiceImpl$BranchDetector.run(BranchDetectionServiceImpl.java:171)
at com.atlassian.bamboo.utils.BambooRunnables$1.run(BambooRunnables.java:48)
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: java.lang.NullPointerException
at java.lang.ProcessEnvironment.validateValue(ProcessEnvironment.java:120)
at java.lang.ProcessEnvironment.access$400(ProcessEnvironment.java:61)
at java.lang.ProcessEnvironment$Value.valueOf(ProcessEnvironment.java:203)
at java.lang.ProcessEnvironment$StringEnvironment.put(ProcessEnvironment.java:243)
at java.lang.ProcessEnvironment$StringEnvironment.put(ProcessEnvironment.java:221)
at java.util.AbstractMap.putAll(AbstractMap.java:281)
at com.atlassian.utils.process.ExternalProcessImpl.createDefaultProcess(ExternalProcessImpl.java:372)
at com.atlassian.utils.process.ExternalProcessImpl.createProcess(ExternalProcessImpl.java:385)
at com.atlassian.utils.process.ExternalProcessImpl.start(ExternalProcessImpl.java:339)
at com.atlassian.utils.process.ExternalProcessImpl.execute(ExternalProcessImpl.java:113)
at com.atlassian.bamboo.plugins.git.GitCommandProcessor.runCommand(GitCommandProcessor.java:664)
at com.atlassian.bamboo.plugins.git.GitCommandProcessor.runCommand(GitCommandProcessor.java:632)
at com.atlassian.bamboo.plugins.git.GitCommandProcessor$1.load(GitCommandProcessor.java:216)
at com.atlassian.bamboo.plugins.git.GitCommandProcessor$1.load(GitCommandProcessor.java:208)
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.plugins.git.GitCommandProcessor.getGitVersion(GitCommandProcessor.java:238)
... 36 more
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hey @Asa Riley,
Thanks for sending that.
Before setting SSH_ASKPASS, did Git commands work from the Bamboo server command line, as the user running Bamboo? If this does not work, then it looks like SSH_ASKPASS needs to be set explicitly in NixOS.
In the one previous support ticket where this was raised, the solution was the same as you workaround. The difference was that the other ticket was running inside a chroot – does your NixOS install use a similarly changed root?
Thank you in advance for you answer to this question. It will help me prepare documentation, and likely a bug report, on this issue.
Cheers,
Elias
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.