Uploaded image for project: 'Bamboo'
  1. Bamboo
  2. BAM-14901

Stash: Branch with same short name as tag can not be checked out (error)

    XMLWordPrintable

    Details

      Description

      1. Connect a Stash instance with a repository that contains a branch and a tag with the same name (they differ only by their prefix). Full ref names like this (yes, unfortunately this is legal in Git):
        • refs/heads/release-1.0
        • refs/tags/release-1.0
      2. Set up a plan that uses this repository and select the release-1.0 branch
      3. Build the plan

      Expected: Checks out refs/heads/release-1.0 and builds that branch.
      Actual: The following error occurs:

      com.atlassian.bamboo.repository.RepositoryException: java.lang.RuntimeException: com.atlassian.bamboo.plugins.stash.repository.StashRepositoryException: com.atlassian.bamboo.repository.InvalidRepositoryException: Cannot determine head revision of 'ssh://git@rstocker:7999/project_1/rep_1.git' on branch 'heads/release-1.0'. Branch has probably been removed.
      	at com.atlassian.bamboo.v2.trigger.DefaultChangeDetectionManager.collectChangesSinceLastBuildInternal(DefaultChangeDetectionManager.java:398)
      	at com.atlassian.bamboo.v2.trigger.DefaultChangeDetectionManager.collectChangesSinceRevisions(DefaultChangeDetectionManager.java:286)
      	at com.atlassian.bamboo.v2.trigger.DefaultChangeDetectionManager.collectChangesSinceRevisions(DefaultChangeDetectionManager.java:185)
      	at com.atlassian.bamboo.v2.trigger.DefaultChangeDetectionManager.collectAllChangesSinceLastBuild(DefaultChangeDetectionManager.java:142)
      	at com.atlassian.bamboo.build.BuildDetectionActionFactoryImpl$InitialBuildDetectionAction.performDelayedChangeDetection(BuildDetectionActionFactoryImpl.java:248)
      	at com.atlassian.bamboo.chains.ChainExecutionManagerImpl$2.getChainState(ChainExecutionManagerImpl.java:209)
      	at com.atlassian.bamboo.chains.ChainExecutionManagerImpl.tryStartChainState(ChainExecutionManagerImpl.java:262)
      	at com.atlassian.bamboo.chains.ChainExecutionManagerImpl.delayedStart(ChainExecutionManagerImpl.java:198)
      	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
      	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      	at java.lang.reflect.Method.invoke(Method.java:606)
      	at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:304)
      	at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:182)
      	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:149)
      	at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:89)
      	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
      	at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)
      	at com.sun.proxy.$Proxy100.delayedStart(Unknown Source)
      	at com.atlassian.bamboo.plan.PlanExecutionManagerImpl$1$1$1$1.run(PlanExecutionManagerImpl.java:405)
      	at com.atlassian.bamboo.util.CacheAwareness.whileReadingThroughCaches(CacheAwareness.java:85)
      	at com.atlassian.bamboo.util.CacheAwareness.whileReadingThroughCaches(CacheAwareness.java:102)
      	at com.atlassian.bamboo.plan.PlanExecutionManagerImpl$1$1$1.call(PlanExecutionManagerImpl.java:400)
      	at com.atlassian.bamboo.plan.PlanExecutionManagerImpl$1$1$1.call(PlanExecutionManagerImpl.java:394)
      	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:761)
      	at com.atlassian.bamboo.plan.PlanExecutionManagerImpl.access$200(PlanExecutionManagerImpl.java:126)
      	at com.atlassian.bamboo.plan.PlanExecutionManagerImpl$1$1.run(PlanExecutionManagerImpl.java:388)
      	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: java.lang.RuntimeException: com.atlassian.bamboo.plugins.stash.repository.StashRepositoryException: com.atlassian.bamboo.repository.InvalidRepositoryException: Cannot determine head revision of 'ssh://git@rstocker:7999/project_1/rep_1.git' on branch 'heads/release-1.0'. Branch has probably been removed.
      	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.v2.trigger.DefaultChangeDetectionManager.collectionChangesWithRetry(DefaultChangeDetectionManager.java:501)
      	at com.atlassian.bamboo.v2.trigger.DefaultChangeDetectionManager.collectChangesSinceLastBuildInternal(DefaultChangeDetectionManager.java:358)
      	... 33 more
      Caused by: com.atlassian.bamboo.plugins.stash.repository.StashRepositoryException: com.atlassian.bamboo.repository.InvalidRepositoryException: Cannot determine head revision of 'ssh://git@rstocker:7999/project_1/rep_1.git' on branch 'heads/release-1.0'. Branch has probably been removed.
      	at com.atlassian.bamboo.plugins.stash.StashRepository.collectChangesSinceLastBuild(StashRepository.java:487)
      	at com.atlassian.bamboo.v2.trigger.DefaultChangeDetectionManager$2.call(DefaultChangeDetectionManager.java:506)
      	at com.atlassian.bamboo.v2.trigger.DefaultChangeDetectionManager$2.call(DefaultChangeDetectionManager.java:502)
      	at com.atlassian.bamboo.executor.RetryingTaskExecutor.rerun(RetryingTaskExecutor.java:108)
      	... 38 more
      Caused by: com.atlassian.bamboo.repository.InvalidRepositoryException: Cannot determine head revision of 'ssh://git@rstocker:7999/project_1/rep_1.git' on branch 'heads/release-1.0'. Branch has probably been removed.
      	at com.atlassian.bamboo.plugins.git.NativeGitOperationHelper.obtainLatestRevision(NativeGitOperationHelper.java:543)
      	at com.atlassian.bamboo.plugins.git.GitRepository.collectChangesSinceLastBuild(GitRepository.java:225)
      	at com.atlassian.bamboo.plugins.git.GitRepository.collectChangesSinceLastBuild(GitRepository.java:213)
      	at com.atlassian.bamboo.plugins.stash.StashRepository.collectChangesSinceLastBuild(StashRepository.java:483)
      	... 41 more
      

      The problem is that it uses heads/release-1.0 as the branch name. Also note that in the dropdown when selecting the branch, it shows up like this:

      This is how the data returned by Stash for this request looks like:

      I guess Bamboo just uses the displayId, instead of storing the full ref name or doing its own ref name shortening.

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              Unassigned Unassigned
              Reporter:
              rstocker Robin Stocker
              Votes:
              1 Vote for this issue
              Watchers:
              4 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: