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

Branch build fails after cleaning up the repository cache on remote agents

XMLWordPrintable

      Issue Summary

      After cleaning the repository cache on remote agents, a branch build fails during the source code checkout task with the error: file:///data/builds/_git-repositories-cache/<CACHE> did not send all necessary objects

      Steps to Reproduce

      • Create a Git repository and add a commit to main (or master or whatever)
      • Create a branch foo and add a commit to that branch (it’s important that this branch shouldn't be using the same commit as the main)
      • Create a branch bar and add a commit to that branch (again this bar branch must be using a different commit than the other branches)
      • Create a Bamboo plan with a Source Code Checkout task for this Git repository and run a build on a remote agent
      • Create a plan branch for that plan for branch foo and run a build on that same remote agent
      • Create a plan branch for that plan for branch bar and run a build on that same remote agent
      • Now you should have a _git-repositories-cache repo and three workspaces on the remote agent. If you go to the workspace for the bar branch build and run git branch -a you should see origin/foo as one of the branches there.
      • Now, go to the Bamboo UI and clear the cache for that repository so it’s deleted from the _git-cached-repositories on the remote agent.
      • Make sure to run the builds in this order: first, do a build of main, then run a build of bar (don’t build foo!)

      The bar build fails with the error above, complaining about fatal: bad object refs/remotes/origin/foo. When you build the main it will create a new version of the cache and it will pull the commits needed for the main (but not any other commits). When you build the branch bar it will pull the commits needed for that branch (but not any other commits). When the Source Code Checkout for bar tries to run git fetch it will try to fetch the origin/foo branch, but that branch and its commit don't exist any longer in the cached repository.

      Expected Results

      The checkout succeeds.

      Actual Results

      The bar build fails with the error above, complaining about fatal: bad object refs/remotes/origin/foo. When you build the main it will create a new version of the cache and it will pull the commits needed for the main (but not any other commits). When you build the branch bar it will pull the commits needed for that branch (but not any other commits). When the Source Code Checkout for bar tries to run git fetch it will try to fetch the origin/foo branch, but that branch and its commit don't exist any longer in the cached repository.

      file:///data/builds/_git-repositories-cache/<CACHE> did not send all necessary objects

      Workaround

      One of the below:

      1. Enable "Force clean build" in the Source Code Checkout task.
      2. Add a "Clean working directory" task at the beginning of the job to clean up the build directory and therefore the branch successfully checks out.
      3. Enable "Fetch the whole repository" for the repository.

              Unassigned Unassigned
              7bef8aece2a3 Eduardo Collaziol
              Votes:
              1 Vote for this issue
              Watchers:
              5 Start watching this issue

                Created:
                Updated:
                Resolved: