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

Exception on agent assignment removal affects other assignments of agent

    XMLWordPrintable

Details

    Description

      Summary

      1. Create several plans and assign them to some agent
      2. Change few records in DB table agent_assignment to have executable_id which doesn't have corresponding record in build table
      3. Open agent assignment page and see updated records were disappear from assignments list
      4. Try to remove some plan from agent assignment page
      5. It's removed but other records removed as well

      Reason

      Code to remove agent assignment removes all assignments for given agent and then iterates over them and create other assignment except removed by user. If it can't recreate existing assignment (plan doesn't exist or user have no permission to given plan/project) it drops remaining records and exits.

      Workaround

      Remove DB records from agent_assignment table which references to non existing plans. And then functionality should work as expected
      List of orphaned records

      SELECT
        q.title AS agent_name,
        aa.*
      FROM agent_assignment aa
        LEFT JOIN build b ON (aa.executable_id = b.build_id AND b.build_type = 'CHAIN')
        LEFT JOIN queue q ON aa.executor_id = q.queue_id
      WHERE aa.executable_type = 'PLAN' AND b.build_id IS NULL AND aa.executor_type = 'AGENT'
      UNION
      SELECT
        q.title AS agent_name,
        aa.*
      FROM agent_assignment aa
        LEFT JOIN build b ON (aa.executable_id = b.build_id AND b.build_type = 'JOB')
        LEFT JOIN queue q ON aa.executor_id = q.queue_id
      WHERE aa.executable_type = 'JOB' AND b.build_id IS NULL AND aa.executor_type = 'AGENT';
      

      Attachments

        Activity

          People

            achystoprudov Alexey Chystoprudov
            achystoprudov Alexey Chystoprudov
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: