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

Bamboo source code checkout task using shallow clone is failing

    XMLWordPrintable

Details

    Description

      Issue Summary

      This is reproducible on Data Center: (yes)

      Steps to Reproduce

      With only 'shallow clones' enabled on the linked repository:

      1. Commit A is pushed to Branch X in Git;
      2. Git hook tells the Bamboo server to start a build on Commit A;
      3. The build is queued because all build agents are busy or maybe step #4 just happens very quickly;
      4. Commit B is pushed to Branch X in Git;
      5. The build of Commit A starts in the build agent;
      6. The shallow clone is performed and gets 1 commit: the HEAD of Branch X, which is now Commit B;
      7. The Bamboo agent attempts to check out Commit A and fails because only Commit B is present;
      8. This is tried a few more times but still fails.

      Expected Results

      If the ref is not the head, then on a retry the command "fetch --unshallow" runs. It will perform a full clone. 

      Actual Results

      The history of the branch that is trying to be built (from the Git server) is:

      commit ca56a6d54fbdeefff8d7a16df6d44566eed76929 (HEAD -> rel/5.0-dev, origin/rel/5.0-dev)
      commit 097b1fbe34b4c1b0a355041cbc5951695b380aa3. <- commit to build
      commit 7427e246ffb639b0efd781ea03e2fe77d74bcbe2
      

      Going to the Bamboo agent workspace, this is the only commit history of the repository by running "git log" even after trying to run the build again:

      commit ca56a6d54fbdeefff8d7a16df6d44566eed76929 (grafted, HEAD -> rel/5.0-dev)
      

      It is also possible to see multiple tentatives to checkout the same repository using a shallow fetch:

      This message may be present in the build logs multiple times
      simple	19-Oct-2023 14:57:57	Fetching 'refs/heads/master' from 'ssh://git@bitbucket.mydomain.net/proj/repository.git'. Will try to do a shallow fetch.
      simple	19-Oct-2023 14:57:57	/usr/bin/git fetch ssh://8447b150-c146-4e8b-a3e7-28eb07518b53@127.0.0.1:34841/proj/repository.git
      simple	19-Oct-2023 14:57:57	Warning: Permanently added '[127.0.0.1]:34841' (RSA) to the list of known hosts.
      simple	19-Oct-2023 14:57:57	remote: Total 0 (delta 0), reused 0 (delta 0), pack-reused 0        
      simple	19-Oct-2023 14:57:57	From ssh://127.0.0.1:34841/proj/repository
      simple	19-Oct-2023 14:57:57	 = [up to date]      master     -> master
      simple	19-Oct-2023 14:57:57	Checking out revision 097b1fbe34b4c1b0a355041cbc5951695b380aa3.
      simple	19-Oct-2023 14:57:57	/usr/bin/git show-ref master
      simple	19-Oct-2023 14:57:57	/usr/bin/git checkout -f 097b1fbe34b4c1b0a355041cbc5951695b380aa3
      simple	19-Oct-2023 14:57:57	fatal: reference is not a tree: 097b1fbe34b4c1b0a355041cbc5951695b380aa3
      error	19-Oct-2023 14:57:57	Checkout to revision 097b1fbe34b4c1b0a355041cbc5951695b380aa3 has failed.
      

      Workaround

      1. Run Bamboo with the following property to go back to 8.2.x behaviour:
        • -Dbamboo.native.git.folder.clearing.disabled=false
      2. Unselect "Use shallow clones" on the repository's Advanced configuration options

      Attachments

        Issue Links

          Activity

            People

              mgardias Marcin Gardias
              a87f315b12b5 Kerilen Serra
              Votes:
              1 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: