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

Upgrade fail with Group already exists in the Remote Directory

      Issue Summary

      When upgrade from Bamboo 6.5.x or older to Bamboo 6.6.x or later, it fail with "Group already exists in the Remote Directory" when there is a LDAP user that is assigned with a local group membership and the same membership exist in LDAP server

      Steps to Reproduce

      1. Install Bamboo 6.5.x
      2. Create a user "test" in LDAP server
      3. Configure LDAP repository
      4. From Bamboo Administration, edit the LDAP user "test" to assign it to the local Bamboo group "bamboo-admin"
      5. Create a group "bamboo-admin" in LDAP server
      6. Assign LDAP user to the group "bamboo-admin" in LDAP server
        No error in Bamboo
      7. Upgrade Bamboo to version 6.6.x

      Expected Results

      Upgrade is successful

      Actual Results

      Upgrade fail with the below exception is thrown in the atlassian-bamboo.log file:

      2019-06-21 18:18:09,977 INFO [17-UpgradeTaskBackgroundThread:pool-31-thread-1] [AbstractUpgradeManager] 60602 : Move users to Embedded Crowd (post-bootstrap)
      2019-06-21 18:18:09,977 INFO [17-UpgradeTaskBackgroundThread:pool-31-thread-1] [AbstractUpgradeManager] -----------------------------------------------------
      2019-06-21 18:18:10,152 INFO [17-UpgradeTaskBackgroundThread:pool-31-thread-1] [AtlassianUserDataMigrator] Copying 2 groups...
      2019-06-21 18:18:10,170 INFO [17-UpgradeTaskBackgroundThread:pool-31-thread-1] [UpgradeTask60602MoveUsersToEmbeddedCrowd] Migration of groups took 118.7 ms
      2019-06-21 18:18:10,170 INFO [17-UpgradeTaskBackgroundThread:pool-31-thread-1] [AtlassianUserDataMigrator] Copying 2 users...
      2019-06-21 18:18:10,193 INFO [17-UpgradeTaskBackgroundThread:pool-31-thread-1] [UpgradeTask60602MoveUsersToEmbeddedCrowd] Migration of users took 23.45 ms
      2019-06-21 18:18:10,196 INFO [17-UpgradeTaskBackgroundThread:pool-31-thread-1] [AtlassianUserDataMigrator] Upgrading external membership information using data from the database
      2019-06-21 18:18:10,197 INFO [17-UpgradeTaskBackgroundThread:pool-31-thread-1] [AtlassianUserDataMigrator] Copying 1 local memberships of LDAP users...
      2019-06-21 18:18:10,445 WARN [17-UpgradeTaskBackgroundThread:pool-31-thread-1] [AtlassianUserDataMigrator] User not found in local repository. It might be available at external repository, creating user placeholder to be filled by Crowd on LDAP synchronization. User name: [test], group name: [bamboo-admin]
      2019-06-21 18:18:10,569 ERROR [17-UpgradeTaskBackgroundThread:pool-31-thread-1] [AbstractUpgradeManager] com.atlassian.crowd.exception.runtime.OperationFailedException: com.atlassian.crowd.exception.InvalidGroupException: Group already exists in the Remote Directory
      com.atlassian.crowd.exception.runtime.OperationFailedException: com.atlassian.crowd.exception.InvalidGroupException: Group already exists in the Remote Directory
      	at com.atlassian.crowd.embedded.core.CrowdServiceImpl.addUserToGroup(CrowdServiceImpl.java:557)
      	at com.atlassian.bamboo.upgrade.tasks.v6_6.ec.AtlassianUserDataMigrator.migrateMembershipInLocalGroup(AtlassianUserDataMigrator.java:389)
      	at com.atlassian.bamboo.upgrade.tasks.v6_6.ec.AtlassianUserDataMigrator.access$400(AtlassianUserDataMigrator.java:71)
      	at com.atlassian.bamboo.upgrade.tasks.v6_6.ec.AtlassianUserDataMigrator$4.processRowInternal(AtlassianUserDataMigrator.java:359)
      	at com.atlassian.bamboo.upgrade.tasks.v6_6.ec.SessionClearingRowCallbackHandler.processRow(SessionClearingRowCallbackHandler.java:36)
      	at org.springframework.jdbc.core.JdbcTemplate$RowCallbackHandlerResultSetExtractor.extractData(JdbcTemplate.java:1566)
      

      Notes

      Even though there is duplicate membership setting, Bamboo should skip the migration for duplicate membership instead of failing the upgrade

      Workaround

      1. Check the membership data in database:
        SELECT em.EXTENTITYID, ee.NAME, em.GROUPID, g.GROUPNAME
        FROM EXTERNAL_MEMBERS em
        JOIN EXTERNAL_ENTITIES ee ON em.EXTENTITYID=ee.ID
        JOIN GROUPS g ON em.GROUPID=g.ID;
        
      2. Compare it with LDAP server
      3. If there is any duplicate membership with LDAP server, delete it in the table EXTERNAL_MEMBERS
        DELETE FROM EXTERNAL_MEMBERS 
        WHERE EXTENTITYID=<userID>
        AND GROUPID=<groupID>;
        

            [BAM-20493] Upgrade fail with Group already exists in the Remote Directory

            Marcin Gardias made changes -
            Fix Version/s New: 6.10.2 [ 89592 ]
            Fix Version/s Original: 6.9.3 [ 88390 ]
            Monique Khairuliana (Inactive) made changes -
            Workflow Original: Bamboo Workflow 2016 v1 - Restricted [ 3244751 ] New: JAC Bug Workflow v3 [ 3386119 ]
            Status Original: Resolved [ 5 ] New: Closed [ 6 ]
            Marcin Gardias made changes -
            Resolution New: Fixed [ 1 ]
            Status Original: Open [ 1 ] New: Resolved [ 5 ]
            Marcin Gardias made changes -
            Fix Version/s New: 6.9.3 [ 88390 ]
            Marcin Gardias made changes -
            Assignee New: Marcin Gardias [ mgardias ]
            Pawel Skierczynski made changes -
            Component/s New: Upgrading [ 11560 ]
            Pawel Skierczynski made changes -
            Component/s New: User Management, Crowd & LDAP integration [ 11830 ]
            Occurrence Factor New: 10% [ 12830 ]
            Status Original: Needs Triage [ 10030 ] New: Open [ 1 ]
            Pawel Skierczynski made changes -
            Remote Link New: This issue links to "BDEV-15447 (Jira)" [ 432645 ]
            Pawel Skierczynski made changes -
            Labels New: bamboo-bugfix-kanban
            Bugfix Automation Bot made changes -
            Support reference count New: 5

              mgardias Marcin Gardias
              klfoong Foong (Inactive)
              Affected customers:
              0 This affects my team
              Watchers:
              1 Start watching this issue

                Created:
                Updated:
                Resolved: