Skip to content

Commit e14f278

Browse files
authored
Merge pull request #1656 from lorenzomigliorero/support-multiple-gitlab-groups
feat(gitlab): add support for multiple group names with a single provider
2 parents 571d73a + 33ab87f commit e14f278

File tree

3 files changed

+14
-4
lines changed

3 files changed

+14
-4
lines changed

apps/dokploy/components/dashboard/settings/git/gitlab/add-gitlab-provider.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -248,7 +248,9 @@ export const AddGitlabProvider = () => {
248248
name="groupName"
249249
render={({ field }) => (
250250
<FormItem>
251-
<FormLabel>Group Name (Optional)</FormLabel>
251+
<FormLabel>
252+
Group Name (Optional, Comma-Separated List)
253+
</FormLabel>
252254
<FormControl>
253255
<Input
254256
placeholder="For organization/group access use the slugish name of the group eg: my-org"

apps/dokploy/components/dashboard/settings/git/gitlab/edit-gitlab-provider.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,9 @@ export const EditGitlabProvider = ({ gitlabId }: Props) => {
156156
name="groupName"
157157
render={({ field }) => (
158158
<FormItem>
159-
<FormLabel>Group Name (Optional)</FormLabel>
159+
<FormLabel>
160+
Group Name (Optional, Comma-Separated List)
161+
</FormLabel>
160162
<FormControl>
161163
<Input
162164
placeholder="For organization/group access use the slugish name of the group eg: my-org"

packages/server/src/utils/providers/gitlab.ts

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -264,7 +264,11 @@ export const getGitlabRepositories = async (gitlabId?: string) => {
264264
const groupName = gitlabProvider.groupName?.toLowerCase();
265265

266266
if (groupName) {
267-
return full_path.toLowerCase().includes(groupName) && kind === "group";
267+
const isIncluded = groupName
268+
.split(",")
269+
.some((name) => full_path.toLowerCase().includes(name));
270+
271+
return isIncluded && kind === "group";
268272
}
269273
return kind === "user";
270274
});
@@ -431,7 +435,9 @@ export const testGitlabConnection = async (
431435
const { full_path, kind } = repo.namespace;
432436

433437
if (groupName) {
434-
return full_path.toLowerCase().includes(groupName) && kind === "group";
438+
return groupName
439+
.split(",")
440+
.some((name) => full_path.toLowerCase().includes(name));
435441
}
436442
return kind === "user";
437443
});

0 commit comments

Comments
 (0)