Deleted tag in Bitbucket server still present under packed-ref folder post Source code checkout in Bamboo Server

XMLWordPrintable

    • Type: Suggestion
    • Resolution: Unresolved
    • None
    • Component/s: Repository (Bitbucket)
    • None
    • 0
    • 4

      Issue Summary

      When a tag is deleted in Bitbucket and the repository and branch is checked out in Bamboo using source code checkout task. packed-ref folder under .git directory in the buildworkingdirectory still contains the reference to the deleted tag.

      Steps to Reproduce

      1) Create a plan in Bamboo and link it to a Bitbucket server repository.

      2) Create a commit in anyone of the files in Bitbucket server repository and create a tag from this commit.

      3) Run the plan in Bamboo and the plan should run successfully.

      4) Delete the tag in Bitbucket server, this can be done from GUI or from the command line using the below 2 commands

      git tag -d TAG_NAME
      git push --delete origin refs/tags/TAG_NAME
      

      5) Run the plan in Bamboo again.

      Expected Results

      1) The deleted tag should not appear under packed-ref folder under .git directory of the branch which was checked out under buildworkingdirectory

      Actual Results

      1) The packed-ref folder contains the reference of the deleted tag.

      Example

      1) In Bitbucket server I've create a tag named BAM-25769 for one of the commits, see below

      2) I run the plan in Bamboo and check the packed-ref folder and can see reference of this tag which is good

      # pack-refs with: peeled fully-peeled sorted 
      ddc592b3a5e75b8c168764dddcb5a595dcfbd6fe refs/remotes/origin/master
      ddc592b3a5e75b8c168764dddcb5a595dcfbd6fe refs/tags/BAM-25769
      

      3) In Bitbucket server I go ahead and delete the tag and I can see no reference of this tag there, see below

      root@bitbucket715:/var/atlassian/application-data/bitbucket/repositories/testrepo6# git tag
      error: cannot run less: No such file or directory
      BAM-25769
      root@bitbucket715:/var/atlassian/application-data/bitbucket/repositories/testrepo6# git tag -d BAM-25769
      Deleted tag 'BAM-25769' (was ddc592b)
      root@bitbucket715:/var/atlassian/application-data/bitbucket/repositories/testrepo6# git push --delete origin refs/tags/TAG_NAME
      Username for 'http://bitbucket:7990': skumar14
      Password for 'http://skumar14@bitbucket:7990': 
      remote: warning: Deleting a non-existent ref.
      To http://bitbucket:7990/scm/tes/testrepo6.git
       - [deleted]         TAG_NAME
      root@bitbucket715:/var/atlassian/application-data/bitbucket/repositories/testrepo6# git tag
      error: cannot run less: No such file or directory
      

      4) If I check the packed-ref file in Bitbucket server for this Branch I will not find reference for this tag

      # pack-refs with: peeled fully-peeled sorted 
      dd44258f33f8b51ffd2f8583ab6bae5133543caf refs/remotes/origin/master
      

      5) Run the plan again in Bamboo with Force cleaned build and Build directory cleaned, but the packed-ref file will contain the reference of the deleted tag.

      # pack-refs with: peeled fully-peeled sorted 
      ddc592b3a5e75b8c168764dddcb5a595dcfbd6fe refs/remotes/origin/master
      ddc592b3a5e75b8c168764dddcb5a595dcfbd6fe refs/tags/BAM-25769
      

      6) If you do a manual git clone in Bamboo for that particular branch packed-ref folder will not contain the reference of the deleted tag.

      Workaround

      Delete the cache of the affected repository in Bamboo server and agents post deleting the git tag in Bitbucket server as per Git cache removal in Bamboo.
      This might increase the timing of the first build as Bamboo will retry to create the cache.
       

        1. screenshot-1.png
          14 kB
          Shashank Kumar

            Assignee:
            Unassigned
            Reporter:
            Shashank Kumar
            Votes:
            1 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated: