Import group members during group migration
From #298745 (closed)
Problem to solve
In order to associate imported group epics (and any other group relation) with their original authors we need to import group members into the group first.
Proposed solution
Create a new pipeline that runs prior to any other relation pipeline in order to map users between instances and create group members for found users. If user is not found - do nothing (user creation is out of scope of this issue).
A GraphQL query can look something like this:
query groupMembers($full_path: ID!, $cursor: String) {
group(fullPath: $full_path) {
groupMembers(relations: DIRECT, first: 100, after: $cursor) {
page_info: pageInfo {
end_cursor: endCursor
has_next_page: hasNextPage
}
nodes {
created_at: createdAt
updated_at: updatedAt
expires_at: expiresAt
access_level: accessLevel {
integer_value: integerValue
}
user {
public_email: publicEmail
}
}
}
}
}
- Create new pipeline to import group members (e.g.
GroupMemberPipeline
) with the query above - Fetch direct group members using GraphQL with the query above
- For fetched user, if publicEmail is present, find by primary/secondary email such user. If it's found - create groupMember with this user. If not - do nothing.
- If publicEmail is not present - do nothing.
Edited by Kassio Borges