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

Rebuild with a custom revision that does not exist on the current branch fails with fatal: bad object error

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • Low
    • None
    • 8.2.4, 9.4.1
    • Repository (Git)
    • None

    Description

      Problem

      Rebuild with a custom revision that does not exist on the current branch fails with fatal: bad object error when it is performed on an agent that does not have the commit already in the Git cache.

      Steps to Reproduce

      1. Create a build plan linked to a git repository
      2. Run the plan as customized and specify a revision that does not exist on the current branch
      3. The build will succeed as Bamboo will detect the revision doesn't exist on the branch and perform a full fetch
      4. Perform a rebuild of that same build on the same agent, it will succeed
      5. Clear the Git cache for that repository on the agent or dedicate the plan to an agent that has never fetched that revision to populate its cache.
      6. Rebuild it on that new agent or the agent that had its Git cache cleared

      Expected Results

      Bamboo performs a full fetch on the rebuild and can successfully perform the build

      Actual Results

      Bamboo does not perform a full fetch on rebuild and the build fails

      The below error is present in the build log:

      Caused by: com.atlassian.bamboo.plugins.git.GitCommandException: command [/usr/local/bin/git log -1 --encoding=UTF-8 --format=%H 7c2cf3faa342ee28674a9ab91795b7c3a504b24d] failed with code 128. Working directory was [/Users/user/bamboo-agent-home/xml-data/build-dir/_git-repositories-cache/1de3badc407e6ee60f0392d61c0934e3924af8b4]., stderr:
      fatal: bad object 7c2cf3faa342ee28674a9ab91795b7c3a504b24d
      
      	at com.atlassian.bamboo.plugins.git.GitCommandProcessor.runCommand(GitCommandProcessor.java:773)
      	at com.atlassian.bamboo.plugins.git.GitCommandProcessor.runCommand(GitCommandProcessor.java:702)
      	at com.atlassian.bamboo.plugins.git.GitCommandProcessor.getShaOf(GitCommandProcessor.java:459)
      	at com.atlassian.bamboo.plugins.git.GitCommandProcessor.getShaOf(GitCommandProcessor.java:431)
      	at com.atlassian.bamboo.plugins.git.NativeGitOperationHelper.checkRevisionExistsInCacheRepository(NativeGitOperationHelper.java:720)
      

      Workaround

      Enable Plan Configuration >> Repositories >> (select a repository) >> Advanced Options >> Fetch whole repository to ensure full fetches are always performed and do the rebuild.

      However this will mean that the entire repository (all branches) needs to be fetched which will increase your build times – so you may want to disable it again after performing the rebuild.

      Attachments

        Issue Links

          Activity

            People

              94ce1c6f8249 Bruno Benvenuti
              jowen@atlassian.com Jeremy Owen
              Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

                Created:
                Updated: