Skip to content

Commit 325a0ae

Browse files
authored
Merge pull request #3631 from Dokploy/3223-dokploy-selfhosted-gitlab-ce-selfhosted-error-postgre
feat(gitlab): add optional internal URL for GitLab integration
2 parents e4c440b + a8293b7 commit 325a0ae

11 files changed

Lines changed: 7322 additions & 2418 deletions

File tree

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

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ import {
2121
FormControl,
2222
FormField,
2323
FormItem,
24+
FormDescription,
2425
FormLabel,
2526
FormMessage,
2627
} from "@/components/ui/form";
@@ -35,6 +36,10 @@ const Schema = z.object({
3536
gitlabUrl: z.string().min(1, {
3637
message: "GitLab URL is required",
3738
}),
39+
gitlabInternalUrl: z
40+
.union([z.string().url(), z.literal("")])
41+
.optional()
42+
.transform((v) => (v === "" ? undefined : v)),
3843
applicationId: z.string().min(1, {
3944
message: "Application ID is required",
4045
}),
@@ -66,6 +71,7 @@ export const AddGitlabProvider = () => {
6671
redirectUri: webhookUrl,
6772
name: "",
6873
gitlabUrl: "https://gitlab.com",
74+
gitlabInternalUrl: "",
6975
},
7076
resolver: zodResolver(Schema),
7177
});
@@ -80,6 +86,7 @@ export const AddGitlabProvider = () => {
8086
redirectUri: webhookUrl,
8187
name: "",
8288
gitlabUrl: "https://gitlab.com",
89+
gitlabInternalUrl: "",
8390
});
8491
}, [form, isOpen]);
8592

@@ -92,6 +99,7 @@ export const AddGitlabProvider = () => {
9299
name: data.name || "",
93100
redirectUri: data.redirectUri || "",
94101
gitlabUrl: data.gitlabUrl || "https://gitlab.com",
102+
gitlabInternalUrl: data.gitlabInternalUrl || undefined,
95103
})
96104
.then(async () => {
97105
await utils.gitProvider.getAll.invalidate();
@@ -192,6 +200,29 @@ export const AddGitlabProvider = () => {
192200
)}
193201
/>
194202

203+
<FormField
204+
control={form.control}
205+
name="gitlabInternalUrl"
206+
render={({ field }) => (
207+
<FormItem>
208+
<FormLabel>Internal URL (Optional)</FormLabel>
209+
<FormControl>
210+
<Input
211+
placeholder="http://gitlab:80"
212+
{...field}
213+
value={field.value ?? ""}
214+
/>
215+
</FormControl>
216+
<FormDescription>
217+
Use when GitLab runs on the same instance as Dokploy.
218+
Used for OAuth token exchange to reach GitLab via
219+
internal network (e.g. Docker service name).
220+
</FormDescription>
221+
<FormMessage />
222+
</FormItem>
223+
)}
224+
/>
225+
195226
<FormField
196227
control={form.control}
197228
name="redirectUri"

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

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ import {
2020
FormControl,
2121
FormField,
2222
FormItem,
23+
FormDescription,
2324
FormLabel,
2425
FormMessage,
2526
} from "@/components/ui/form";
@@ -33,6 +34,10 @@ const Schema = z.object({
3334
gitlabUrl: z.string().url({
3435
message: "Invalid Gitlab URL",
3536
}),
37+
gitlabInternalUrl: z
38+
.union([z.string().url(), z.literal("")])
39+
.optional()
40+
.transform((v) => (v === "" ? undefined : v)),
3641
groupName: z.string().optional(),
3742
});
3843

@@ -61,6 +66,7 @@ export const EditGitlabProvider = ({ gitlabId }: Props) => {
6166
groupName: "",
6267
name: "",
6368
gitlabUrl: "https://gitlab.com",
69+
gitlabInternalUrl: "",
6470
},
6571
resolver: zodResolver(Schema),
6672
});
@@ -72,6 +78,7 @@ export const EditGitlabProvider = ({ gitlabId }: Props) => {
7278
groupName: gitlab?.groupName || "",
7379
name: gitlab?.gitProvider.name || "",
7480
gitlabUrl: gitlab?.gitlabUrl || "",
81+
gitlabInternalUrl: gitlab?.gitlabInternalUrl || "",
7582
});
7683
}, [form, isOpen]);
7784

@@ -82,6 +89,7 @@ export const EditGitlabProvider = ({ gitlabId }: Props) => {
8289
groupName: data.groupName || "",
8390
name: data.name || "",
8491
gitlabUrl: data.gitlabUrl || "",
92+
gitlabInternalUrl: data.gitlabInternalUrl ?? null,
8593
})
8694
.then(async () => {
8795
await utils.gitProvider.getAll.invalidate();
@@ -151,6 +159,29 @@ export const EditGitlabProvider = ({ gitlabId }: Props) => {
151159
)}
152160
/>
153161

162+
<FormField
163+
control={form.control}
164+
name="gitlabInternalUrl"
165+
render={({ field }) => (
166+
<FormItem>
167+
<FormLabel>Internal URL (Optional)</FormLabel>
168+
<FormControl>
169+
<Input
170+
placeholder="http://gitlab:80"
171+
{...field}
172+
value={field.value ?? ""}
173+
/>
174+
</FormControl>
175+
<FormDescription>
176+
Use when GitLab runs on the same instance as Dokploy.
177+
Used for OAuth token exchange to reach GitLab via
178+
internal network (e.g. Docker service name).
179+
</FormDescription>
180+
<FormMessage />
181+
</FormItem>
182+
)}
183+
/>
184+
154185
<FormField
155186
control={form.control}
156187
name="groupName"
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
ALTER TABLE "gitlab" ADD COLUMN "gitlabInternalUrl" text;

0 commit comments

Comments
 (0)