Push to same repository in more then one environment leads to "Can't guess branch name"

XMLWordPrintable

    • 3
    • Severity 3 - Minor

      Attempt to push changes for the same repository in multiple environments of the same deployment project will lead to error in most of them.

      Steps to Reproduce

      1. Create a build plan
      2. Create a deployment plan and associate to that build plan
      3. Create 2 environments with the following tasks:
        1. Checkout task - to checkout a 'dummie repository' (it does not need to be the same repository used in the plan)
        2. Script task - to add changes in this repository
        3. Commit task - to commit the changes
        4. Push task - to push the changes
      4. Add an after successful build plan trigger in the environment 1
      5. Add an after successful deployment trigger in the environment 2
      6. run the build plan

      Expected Results

      1. Environment 1 will be trigger after the build and will succeed.
      2. Environment 2 will be triggered after environment 1 and will succeed.

      Actual Results

      1. Environment 1 will be trigger after the build and will succeed.
      2. Environment 2 will be triggered after environment 1 and will fail with the following stack trace:
        01-Apr-2019 12:42:26  Error occurred while running Task '(4)' of type com.atlassian.bamboo.plugins.vcs:task.vcs.commit.
        01-Apr-2019 12:42:26  com.atlassian.bamboo.task.TaskException: An error occurred while committing changes to repository
        01-Apr-2019 12:42:26          at com.atlassian.bamboo.plugins.vcs.task.VcsCommitTask.execute(VcsCommitTask.java:81)
        01-Apr-2019 12:42:26          at com.atlassian.bamboo.task.TaskExecutorImpl.lambda$executeTasks$3(TaskExecutorImpl.java:319)
        01-Apr-2019 12:42:26          at com.atlassian.bamboo.task.TaskExecutorImpl.executeTaskWithPrePostActions(TaskExecutorImpl.java:252)
        01-Apr-2019 12:42:26          at com.atlassian.bamboo.task.TaskExecutorImpl.executeTasks(TaskExecutorImpl.java:319)
        01-Apr-2019 12:42:26          at com.atlassian.bamboo.task.TaskExecutorImpl.execute(TaskExecutorImpl.java:112)
        01-Apr-2019 12:42:26          at com.atlassian.bamboo.build.pipeline.tasks.ExecuteBuildTask.call(ExecuteBuildTask.java:73)
        01-Apr-2019 12:42:26          at com.atlassian.bamboo.v2.build.agent.DefaultBuildAgent.executeBuildPhase(DefaultBuildAgent.java:203)
        01-Apr-2019 12:42:26          at com.atlassian.bamboo.v2.build.agent.DefaultBuildAgent.build(DefaultBuildAgent.java:175)
        01-Apr-2019 12:42:26          at com.atlassian.bamboo.v2.build.agent.BuildAgentControllerImpl.lambda$waitAndPerformBuild$0(BuildAgentControllerImpl.java:131)
        01-Apr-2019 12:42:26          at com.atlassian.bamboo.variable.CustomVariableContextImpl.withVariableSubstitutor(CustomVariableContextImpl.java:185)
        01-Apr-2019 12:42:26          at com.atlassian.bamboo.v2.build.agent.BuildAgentControllerImpl.waitAndPerformBuild(BuildAgentControllerImpl.java:125)
        01-Apr-2019 12:42:26          at com.atlassian.bamboo.v2.build.agent.DefaultBuildAgent$1.run(DefaultBuildAgent.java:126)
        01-Apr-2019 12:42:26          at com.atlassian.bamboo.utils.BambooRunnables$1.run(BambooRunnables.java:48)
        01-Apr-2019 12:42:26          at com.atlassian.bamboo.security.ImpersonationHelper.runWith(ImpersonationHelper.java:26)
        01-Apr-2019 12:42:26          at com.atlassian.bamboo.security.ImpersonationHelper.runWithSystemAuthority(ImpersonationHelper.java:17)
        01-Apr-2019 12:42:26          at com.atlassian.bamboo.security.ImpersonationHelper$1.run(ImpersonationHelper.java:41)
        01-Apr-2019 12:42:26          at java.lang.Thread.run(Thread.java:745)
        01-Apr-2019 12:42:26  Caused by: com.atlassian.bamboo.repository.RepositoryException: Can't guess branch name for revision ae58ba239cbf8010043324bd2b49706b0f7073d8 when trying to perform push.
        01-Apr-2019 12:42:26          at com.atlassian.bamboo.plugins.git.NativeGitOperationHelper.pushRevision(NativeGitOperationHelper.java:139)
        01-Apr-2019 12:42:26          at com.atlassian.bamboo.plugins.git.v2.GitWorkingCopyManager.updateRemote(GitWorkingCopyManager.java:323)
        01-Apr-2019 12:42:26          at com.atlassian.bamboo.plugins.bitbucket.v2.BitbucketCloudWorkingCopyManager.updateRemote(BitbucketCloudWorkingCopyManager.java:84)
        01-Apr-2019 12:42:26          at com.atlassian.bamboo.plugins.vcs.task.VcsCommitTask.execute(VcsCommitTask.java:74)
        01-Apr-2019 12:42:26          ... 16 more

      Workaround

      Add a script task with a git pull after the git checkout task.

            Assignee:
            Unassigned
            Reporter:
            Daniel Santos (Inactive)
            Votes:
            1 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated: