diff --git a/docs/integrations/gitlab/org.md b/docs/integrations/gitlab/org.md index 5078e93d77..ca40cefa9e 100644 --- a/docs/integrations/gitlab/org.md +++ b/docs/integrations/gitlab/org.md @@ -78,7 +78,7 @@ e.g. If `group` is `org/teams`, the name for `org/teams/avengers/gotg` will be For gitlab.com, when `orgEnabled: true`, the `group` parameter is required in order to limit the ingestion to a group within your organisation. `Group` -entities will only be ingested for the configured group, or it's descendant groups, +entities will only be ingested for the configured group, or its descendant groups, but not any ancestor groups higher than the configured group path. Only groups which contain members will be ingested. diff --git a/plugins/catalog-backend-module-gitlab/src/lib/client.ts b/plugins/catalog-backend-module-gitlab/src/lib/client.ts index e2c4914979..3675d7e779 100644 --- a/plugins/catalog-backend-module-gitlab/src/lib/client.ts +++ b/plugins/catalog-backend-module-gitlab/src/lib/client.ts @@ -115,25 +115,27 @@ export class GitLabClient { }, body: JSON.stringify({ variables: { group: groupPath, endCursor }, - query: `query listDescendantGroups($group: ID!, $endCursor: String) { - group(fullPath: $group) { - descendantGroups(first: 100, after: $endCursor) { - nodes { - id - name - description - fullPath - parent { + query: /* GraphQL */ ` + query listDescendantGroups($group: ID!, $endCursor: String) { + group(fullPath: $group) { + descendantGroups(first: 100, after: $endCursor) { + nodes { id + name + description + fullPath + parent { + id + } + } + pageInfo { + endCursor + hasNextPage } } - pageInfo { - endCursor - hasNextPage - } - } + } } - }`, + `, }), }, ).then(r => r.json()); @@ -189,7 +191,7 @@ export class GitLabClient { }, body: JSON.stringify({ variables: { group: groupPath, relations: relations, endCursor }, - query: `query getGroupMembers($group: ID!, $relations: [GroupMemberRelation!], $endCursor: String) { + query: /* GraphQL */ `query getGroupMembers($group: ID!, $relations: [GroupMemberRelation!], $endCursor: String) { group(fullPath: $group) { groupMembers(first: 100, relations: $relations, after: $endCursor) { nodes { diff --git a/plugins/catalog-backend-module-gitlab/src/lib/types.ts b/plugins/catalog-backend-module-gitlab/src/lib/types.ts index 1c08a0e253..5a4082eec3 100644 --- a/plugins/catalog-backend-module-gitlab/src/lib/types.ts +++ b/plugins/catalog-backend-module-gitlab/src/lib/types.ts @@ -80,7 +80,7 @@ export type GitLabGroupMembersResponse = { }; }; -export type GitLabSaasGroupsResponse = { +export type GitLabDescendantGroupsResponse = { errors: { message: string }[]; data: { group: {