Bamboo Github Branch Checkout Not Working
Asked by Ben Byers:

I had a branch plan that was working, but I made a push to GitHub that it keeps trying to checkout and is failing. It works fine locally and don't see any issues on GitHub's end.

The main issue seems to be at the end "Unable to find revision 9cedb3da35b811a682e459532f6867f034e9a7fc in repository" which is the most recent commit.

I've tried clearing the branch plan - I just started trying to get this setup today - and that didn't fix it at all.

java.lang.RuntimeException: com.atlassian.bamboo.repository.RepositoryException: Runtime exception.  
at com.atlassian.bamboo.executor.RetryingTaskExecutor.rerun(RetryingTaskExecutor.java:141)  
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.plugins.vcs.task.VcsCheckoutTask.execute(VcsCheckoutTask.java:123)  
at com.atlassian.bamboo.task.TaskExecutorImpl.lambda$executeTasks$3(TaskExecutorImpl.java:323)  
at com.atlassian.bamboo.task.TaskExecutorImpl.executeTaskWithPrePostActions(TaskExecutorImpl.java:258)  
at com.atlassian.bamboo.task.TaskExecutorImpl.executeTasks(TaskExecutorImpl.java:323)  
at com.atlassian.bamboo.task.TaskExecutorImpl.executePreparationTasks(TaskExecutorImpl.java:97)  
at com.atlassian.bamboo.build.pipeline.tasks.PrepareBuildTask.call(PrepareBuildTask.java:81)  
at com.atlassian.bamboo.v2.build.agent.DefaultBuildAgent.executeBuildPhase(DefaultBuildAgent.java:190)  
at com.atlassian.bamboo.v2.build.agent.DefaultBuildAgent.build(DefaultBuildAgent.java:162)  
at com.atlassian.bamboo.v2.build.agent.BuildAgentControllerImpl.lambda$waitAndPerformBuild$0(BuildAgentControllerImpl.java:137)  
at com.atlassian.bamboo.variable.CustomVariableContextImpl.withVariableSubstitutor(CustomVariableContextImpl.java:118)  
at com.atlassian.bamboo.v2.build.agent.BuildAgentControllerImpl.waitAndPerformBuild(BuildAgentControllerImpl.java:130)  
at com.atlassian.bamboo.v2.build.agent.DefaultBuildAgent.lambda$start$0(DefaultBuildAgent.java:110)  
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: com.atlassian.bamboo.repository.RepositoryException: Runtime exception.  
at com.atlassian.bamboo.plugins.git.v2.GitWorkingCopyManager.checkout(GitWorkingCopyManager.java:276)  
at com.atlassian.bamboo.plugins.git.v2.GitWorkingCopyManager.retrieveSourceCode(GitWorkingCopyManager.java:122)  
at com.atlassian.bamboo.plugins.github.GitHubWorkingCopyManager.retrieveSourceCode(GitHubWorkingCopyManager.java:54)  
at com.atlassian.bamboo.plugins.vcs.task.VcsCheckoutTask.fillWorkingDirFromVcs(VcsCheckoutTask.java:206)  
at com.atlassian.bamboo.plugins.vcs.task.VcsCheckoutTask.access$000(VcsCheckoutTask.java:54)  
at com.atlassian.bamboo.plugins.vcs.task.VcsCheckoutTask$1.call(VcsCheckoutTask.java:126)  
at com.atlassian.bamboo.plugins.vcs.task.VcsCheckoutTask$1.call(VcsCheckoutTask.java:123)  
at com.atlassian.bamboo.executor.RetryingTaskExecutor.rerun(RetryingTaskExecutor.java:112)  
... 20 more  
Caused by: java.lang.NullPointerException: Unable to find revision 9cedb3da35b811a682e459532f6867f034e9a7fc in repository  
at com.google.common.base.Preconditions.checkNotNull(Preconditions.java:895)  
at com.atlassian.bamboo.plugins.git.JGitOperationHelper.doCheckout(JGitOperationHelper.java:129)  
at com.atlassian.bamboo.plugins.git.JGitOperationHelper.checkout(JGitOperationHelper.java:264)  
at com.atlassian.bamboo.plugins.git.v2.GitWorkingCopyManager.lambda$checkout$1(GitWorkingCopyManager.java:247)  
at io.atlassian.util.concurrent.ManagedLocks$ManagedLockImpl.withLock(ManagedLocks.java:293)  
at com.atlassian.bamboo.plugins.git.v2.GitWorkingCopyManager.checkout(GitWorkingCopyManager.java:235)  
... 27 more


Answers:
author: Ben Byers
body: I modified the build configuration to do a clean checkout before each build and it is working now.