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

Selectable branches marked for deletion cause scan failures in Bamboo Specs

    XMLWordPrintable

Details

    Description

      Problem

      When a branch is marked for deletion by a repository event, it enters a grace period before being permanently deleted by Bamboo. During this interim, the branch remains listed in the Bamboo specs scan dropdown menu, allowing users to select it for scanning operations. This unintended behavior can lead to scan failures as operations are attempted on branches that are in the process of being removed.

      Environment

      Bamboo latest version.

      Steps to Reproduce

      1. Use Bamboo specs and a linked repository
      2. Delete a branch on the repository end
      3. Bamboo receives the pull request from the repository and marks the branch for deletion (the deletion should happen after the period set in the Plan > Branches tab > Delete plan branch option)
      4. In the meantime, while the branch is not deleted from Bamboo, if we go to the Bamboo administration Overview > Linked repositories > Select the corresponding repo > Specs status tab > and search for such a branch in the dropdown menu, it's possible to select the branch and click to scan
      5. Several error messages will show up on the logs explaining that the remote branch is no longer available, but no message appears in the Bamboo UI
      6. Also, the UI doesn't show any issues; the scan button can be hit again and again, but nothing seems to happenBamboo specs scan button.mov

      Expected Results

      When the branch is marked for deletion on Bamboo, and the customer tries to scan that same branch, a message explaining what is happening would be very appreciated, avoiding any misleading.

      Actual Results

      We can click the specs scan button several times, and nothing happens. It's necessary to go to the <Bamboo_home>/logs/atlassian-bamboo.logs to check what's going on.

      Here are some messages you may see:

      • Received stash branch deletion event:
        INFO [AtlassianEvent::0-BAM::EVENTS:pool-2-thread-47] [BranchDeletedEventListener] Received stash branch deletion event [ embedded, <branch-type>/<branch-name>]
        
      • Branch marked as removed:
        INFO [AtlassianEvent::0-BAM::EVENTS:pool-2-thread-47] [ChainBranchManagerImpl] Marking VCS branch <branch-type>/<branch-name> of chain branch ABCDEF as removed because its name matches <branch-type>/<branch-name>
        
      • After the above branch deletion, the specs execution failed to execute the goal:
        [ERROR] Failed to execute goal com.atlassian.bamboo:bamboo-specs-runner:run (default-cli) on project bamboo-specs-generator: Execution default-cli of goal com.atlassian.bamboo:bamboo-specs-runner:run failed: java.lang.reflect.InvocationTargetException: java.nio.file.NoSuchFileException: /home/hdev/bamboo-home/local-working-dir/serverSide/REPOSITORY_STORED_SPECS/repository-<repository-number>-<branch-type>/<branch-name>... 
      • And additional error messages come up, citing that the YAML file doesn't exist:
        ...
        Caused by: java.lang.RuntimeException: java.nio.file.NoSuchFileException: /bamboo-home/local-working-dir/serverSide/REPOSITORY_STORED_SPECS/repository-<repository-number>-<branch-type>/<branch-name>/internal-yamls/plan/<plan-number>.yaml
        
      • Finally, hitting the Unable to scan repository embedded (<repository-number>) for Bamboo Specs:
        ERROR [AtlassianEvent::0-BAM::EVENTS:pool-2-thread-41] [AsynchronousAbleEventDispatcher] There was an exception thrown trying to dispatch event [com.atlassian.stash.plugin.remote.event.StashBranchChangedRemoteEvent@78abcdef[branchName=<branch-type>/<branch-name>,committer=<commiter-name>=embedded,sourceId=<id>,sourceUrl=repository-URL]] from the invoker [com.atlassian.event.internal.ComparableListenerInvoker@bv4f5o]
        java.lang.RuntimeException: com.atlassian.bamboo.repository.RepositoryException: Unable to scan repository embedded (<repository-number>) for Bamboo Specs. Listener: 
        ...
        Caused by: java.lang.RuntimeException: com.atlassian.bamboo.repository.RepositoryException: Unable to scan repository embedded (<repository-number>) for Bamboo Specs
        

      Workaround

      No workaround is available. The best approach is not scanning a branch deleted on the repository end.

      Notes

      To check if the described scan button behavior matches your scenario, please go to the <Bamboo_home>/logs/atlassian-bamboo.logs and search for messages related to "[BranchDeletedEventListener] Received stash branch deletion event..." for the corresponding branch.

      Also, the Bamboo plan related to the affected branch should appear disabled automatically.

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              a87f315b12b5 Kerilen Serra
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated: