Uploaded image for project: 'Bamboo Data Center'
  1. Bamboo Data Center
  2. BAM-17751

Bamboo's built-in jgit cannot perform SSH checkouts from Bitbucket Cloud

    XMLWordPrintable

Details

    Description

      Summary

      Following a recent change to Bitbucket Cloud's SSH infrastructure, when using Bamboo's built in jgit to perform SSH checkouts from Bitbucket Cloud (i.e. when the repository is set up as the type of Git, instead of as the type of Bitbucket Cloud), the checkout fails:

      Steps to Reproduce

      1. Remove any native git capabilities from Bamboo so built-in JGit is used instead
      2. Set up a plan with a linked repository to Bitbucket Cloud, using generic Git as the repository type instead of Bitbucket Cloud (so auth is performed over SSH)
      3. Run the build

      Expected Results

      The build checkout task should succeed

      Actual Results

      The checkout fails with the following errors appearing in the logs:

      atlassian-bamboo.log
      java.lang.RuntimeException: com.atlassian.bamboo.repository.RepositoryException: PROJ-PLAN-123: Cannot fetch branch 'refs/heads/master' from 'git@bitbucket.org:team/repository.git' to source directory '/var/application-data/atlassian/bamboo/bamboo-home/xml-data/build-dir/_git-repositories-cache/b819c2eb9f63c320d4133bd1309e21062cef8d78'. PROJ-PLAN-123: Cannot fetch branch 'refs/heads/master' from 'git@bitbucket.org:team/repository.git' to source directory '/var/application-data/atlassian/bamboo/bamboo-home/xml-data/build-dir/_git-repositories-cache/b819c2eb9f63c320d4133bd1309e21062cef8d78'. git@bitbucket.org:team/repository.git: channel is not opened.
      	at com.atlassian.bamboo.executor.RetryingTaskExecutor.rerun(RetryingTaskExecutor.java:132)
      	at com.atlassian.bamboo.executor.RetryingTaskExecutor.runTask(RetryingTaskExecutor.java:88)
      	at com.atlassian.bamboo.executor.RetryingTaskExecutor.retry(RetryingTaskExecutor.java:191)
      	at com.atlassian.bamboo.executor.RetryingTaskExecutor.retry(RetryingTaskExecutor.java:176)
      	at com.atlassian.bamboo.plugins.vcs.task.VcsCheckoutTask.execute(VcsCheckoutTask.java:172)
      	at com.atlassian.bamboo.task.TaskExecutorImpl.executeTasks(TaskExecutorImpl.java:220)
      	at com.atlassian.bamboo.task.TaskExecutorImpl.executePreparationTasks(TaskExecutorImpl.java:73)
      	at com.atlassian.bamboo.build.pipeline.tasks.PrepareBuildTask.call(PrepareBuildTask.java:74)
      	at com.atlassian.bamboo.v2.build.agent.DefaultBuildAgent.build(DefaultBuildAgent.java:186)
      	at com.atlassian.bamboo.v2.build.agent.BuildAgentControllerImpl.waitAndPerformBuild(BuildAgentControllerImpl.java:102)
      	at com.atlassian.bamboo.v2.build.agent.DefaultBuildAgent$1.run(DefaultBuildAgent.java:108)
      	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.repository.RepositoryException: PROJ-PLAN-123: Cannot fetch branch 'refs/heads/master' from 'git@bitbucket.org:team/repository.git' to source directory '/var/application-data/atlassian/bamboo/bamboo-home/xml-data/build-dir/_git-repositories-cache/b819c2eb9f63c320d4133bd1309e21062cef8d78'. PROJ-PLAN-123: Cannot fetch branch 'refs/heads/master' from 'git@bitbucket.org:team/repository.git' to source directory '/var/application-data/atlassian/bamboo/bamboo-home/xml-data/build-dir/_git-repositories-cache/b819c2eb9f63c320d4133bd1309e21062cef8d78'. git@bitbucket.org:team/repository.git: channel is not opened.
      	at com.atlassian.bamboo.plugins.git.JGitOperationHelper.fetch(JGitOperationHelper.java:345)
      	at com.atlassian.bamboo.plugins.git.GitRepository$3.call(GitRepository.java:383)
      	at com.atlassian.bamboo.plugins.git.GitRepository$3.call(GitRepository.java:378)
      	at com.atlassian.util.concurrent.ManagedLocks$ManagedLockImpl.withLock(ManagedLocks.java:312)
      	at com.atlassian.bamboo.plugins.git.GitRepository.retrieveSourceCode(GitRepository.java:377)
      	at com.atlassian.bamboo.plugins.vcs.task.VcsCheckoutTask.fillWorkingDirFromVcs(VcsCheckoutTask.java:252)
      	at com.atlassian.bamboo.plugins.vcs.task.VcsCheckoutTask.access$100(VcsCheckoutTask.java:56)
      	at com.atlassian.bamboo.plugins.vcs.task.VcsCheckoutTask$2.call(VcsCheckoutTask.java:177)
      	at com.atlassian.bamboo.plugins.vcs.task.VcsCheckoutTask$2.call(VcsCheckoutTask.java:173)
      	at com.atlassian.bamboo.executor.RetryingTaskExecutor.rerun(RetryingTaskExecutor.java:108)
      	... 15 more
      Caused by: com.atlassian.bamboo.repository.RepositoryException: PROJ-PLAN-123: Cannot fetch branch 'refs/heads/master' from 'git@bitbucket.org:team/repository.git' to source directory '/var/application-data/atlassian/bamboo/bamboo-home/xml-data/build-dir/_git-repositories-cache/b819c2eb9f63c320d4133bd1309e21062cef8d78'. git@bitbucket.org:team/repository.git: channel is not opened.
      	at com.atlassian.bamboo.plugins.git.JGitOperationHelper$3.doWithTransport(JGitOperationHelper.java:321)
      	at com.atlassian.bamboo.plugins.git.JGitOperationHelper$3.doWithTransport(JGitOperationHelper.java:298)
      	at com.atlassian.bamboo.plugins.git.JGitOperationHelper.withTransport(JGitOperationHelper.java:858)
      	at com.atlassian.bamboo.plugins.git.JGitOperationHelper.fetch(JGitOperationHelper.java:297)
      	... 24 more
      Caused by: org.eclipse.jgit.errors.TransportException: git@bitbucket.org:team/repository.git: channel is not opened.
      	at org.eclipse.jgit.transport.JschSession$JschProcess.<init>(JschSession.java:154)
      	at org.eclipse.jgit.transport.JschSession$JschProcess.<init>(JschSession.java:118)
      	at org.eclipse.jgit.transport.JschSession.exec(JschSession.java:91)
      	at org.eclipse.jgit.transport.TransportGitSsh$SshFetchConnection.<init>(TransportGitSsh.java:248)
      	at org.eclipse.jgit.transport.TransportGitSsh.openFetch(TransportGitSsh.java:147)
      	at org.eclipse.jgit.transport.FetchProcess.executeImp(FetchProcess.java:130)
      	at org.eclipse.jgit.transport.FetchProcess.execute(FetchProcess.java:116)
      	at org.eclipse.jgit.transport.Transport.fetch(Transport.java:1096)
      	at com.atlassian.bamboo.plugins.git.JGitOperationHelper$3.doWithTransport(JGitOperationHelper.java:315)
      	... 27 more
      Caused by: com.jcraft.jsch.JSchException: channel is not opened.
      	at com.jcraft.jsch.Channel.connect(Channel.java:197)
      	at org.eclipse.jgit.transport.JschSession$JschProcess.<init>(JschSession.java:150)
      	... 35 more
      

      Workaround

      • Install native git (which is the recommended git integration method anyway); or
      • Change repository type to Bitbucket Cloud so HTTPS authentication is used

      Attachments

        Issue Links

          Activity

            People

              pbruski Przemek Bruski
              dchevell Dave Chevell
              Votes:
              1 Vote for this issue
              Watchers:
              15 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: