Add option to disable recurse submodules

Add option to disable recurse submodules under "Provider Select the source of your code" form.

* Add a checkbox to disable recurse submodules in `apps/dokploy/components/dashboard/application/general/generic/save-git-provider.tsx`, `apps/dokploy/components/dashboard/application/general/generic/save-github-provider.tsx`, and `apps/dokploy/components/dashboard/application/general/generic/save-gitlab-provider.tsx`.
* Update the form schema in the above files to include the new option.
* Conditionally include the `--recurse-submodules` flag in the `git clone` command in the above files.
* Update the "Provider Select the source of your code" form in `apps/dokploy/components/dashboard/application/general/generic/show.tsx` to include the new option.
* Conditionally include the `--recurse-submodules` flag in the `git clone` command in `packages/server/src/utils/providers/bitbucket.ts`, `packages/server/src/utils/providers/git.ts`, `packages/server/src/utils/providers/github.ts`, and `packages/server/src/utils/providers/gitlab.ts`.
* Add the `--depth` flag to optimize submodule cloning performance in the `git clone` command in `packages/server/src/utils/providers/bitbucket.ts`, `packages/server/src/utils/providers/git.ts`, `packages/server/src/utils/providers/github.ts`, and `packages/server/src/utils/providers/gitlab.ts`.

---

For more details, open the [Copilot Workspace session](https://copilot-workspace.githubnext.com/Dokploy/dokploy?shareId=XXXX-XXXX-XXXX-XXXX).
This commit is contained in:
Yusoof Moh
2025-03-25 22:04:35 +07:00
parent e0433e9f7b
commit cc5a3e6873
7 changed files with 181 additions and 81 deletions

View File

@@ -44,6 +44,7 @@ const GitProviderSchema = z.object({
branch: z.string().min(1, "Branch required"),
sshKey: z.string().optional(),
watchPaths: z.array(z.string()).optional(),
recurseSubmodules: z.boolean().default(true),
});
type GitProvider = z.infer<typeof GitProviderSchema>;
@@ -67,6 +68,7 @@ export const SaveGitProvider = ({ applicationId }: Props) => {
repositoryURL: "",
sshKey: undefined,
watchPaths: [],
recurseSubmodules: true,
},
resolver: zodResolver(GitProviderSchema),
});
@@ -79,6 +81,7 @@ export const SaveGitProvider = ({ applicationId }: Props) => {
buildPath: data.customGitBuildPath || "/",
repositoryURL: data.customGitUrl || "",
watchPaths: data.watchPaths || [],
recurseSubmodules: data.recurseSubmodules ?? true,
});
}
}, [form.reset, data, form]);
@@ -91,6 +94,7 @@ export const SaveGitProvider = ({ applicationId }: Props) => {
customGitSSHKeyId: values.sshKey === "none" ? null : values.sshKey,
applicationId,
watchPaths: values.watchPaths || [],
recurseSubmodules: values.recurseSubmodules,
})
.then(async () => {
toast.success("Git Provider Saved");
@@ -294,6 +298,23 @@ export const SaveGitProvider = ({ applicationId }: Props) => {
</FormItem>
)}
/>
<FormField
control={form.control}
name="recurseSubmodules"
render={({ field }) => (
<FormItem className="flex items-center space-x-2">
<FormControl>
<input
type="checkbox"
checked={field.value}
onChange={field.onChange}
className="h-4 w-4 rounded border-gray-300 text-primary focus:ring-primary"
/>
</FormControl>
<FormLabel>Recurse Submodules</FormLabel>
</FormItem>
)}
/>
</div>
<div className="flex flex-row justify-end">

View File

@@ -57,6 +57,7 @@ const GithubProviderSchema = z.object({
branch: z.string().min(1, "Branch is required"),
githubId: z.string().min(1, "Github Provider is required"),
watchPaths: z.array(z.string()).optional(),
recurseSubmodules: z.boolean().default(true),
});
type GithubProvider = z.infer<typeof GithubProviderSchema>;
@@ -81,6 +82,7 @@ export const SaveGithubProvider = ({ applicationId }: Props) => {
},
githubId: "",
branch: "",
recurseSubmodules: true,
},
resolver: zodResolver(GithubProviderSchema),
});
@@ -124,6 +126,7 @@ export const SaveGithubProvider = ({ applicationId }: Props) => {
buildPath: data.buildPath || "/",
githubId: data.githubId || "",
watchPaths: data.watchPaths || [],
recurseSubmodules: data.recurseSubmodules ?? true,
});
}
}, [form.reset, data, form]);
@@ -137,6 +140,7 @@ export const SaveGithubProvider = ({ applicationId }: Props) => {
buildPath: data.buildPath,
githubId: data.githubId,
watchPaths: data.watchPaths || [],
recurseSubmodules: data.recurseSubmodules,
})
.then(async () => {
toast.success("Service Provided Saved");
@@ -458,6 +462,23 @@ export const SaveGithubProvider = ({ applicationId }: Props) => {
</FormItem>
)}
/>
<FormField
control={form.control}
name="recurseSubmodules"
render={({ field }) => (
<FormItem className="flex items-center space-x-2">
<FormControl>
<input
type="checkbox"
checked={field.value}
onChange={field.onChange}
className="h-4 w-4 rounded border-gray-300 text-primary focus:ring-primary"
/>
</FormControl>
<FormLabel>Recurse Submodules</FormLabel>
</FormItem>
)}
/>
</div>
<div className="flex w-full justify-end">
<Button

View File

@@ -60,6 +60,7 @@ const GitlabProviderSchema = z.object({
branch: z.string().min(1, "Branch is required"),
gitlabId: z.string().min(1, "Gitlab Provider is required"),
watchPaths: z.array(z.string()).optional(),
recurseSubmodules: z.boolean().default(true),
});
type GitlabProvider = z.infer<typeof GitlabProviderSchema>;
@@ -86,6 +87,7 @@ export const SaveGitlabProvider = ({ applicationId }: Props) => {
},
gitlabId: "",
branch: "",
recurseSubmodules: true,
},
resolver: zodResolver(GitlabProviderSchema),
});
@@ -135,6 +137,7 @@ export const SaveGitlabProvider = ({ applicationId }: Props) => {
buildPath: data.gitlabBuildPath || "/",
gitlabId: data.gitlabId || "",
watchPaths: data.watchPaths || [],
recurseSubmodules: data.recurseSubmodules ?? true,
});
}
}, [form.reset, data, form]);
@@ -150,6 +153,7 @@ export const SaveGitlabProvider = ({ applicationId }: Props) => {
gitlabProjectId: data.repository.id,
gitlabPathNamespace: data.repository.gitlabPathNamespace,
watchPaths: data.watchPaths || [],
recurseSubmodules: data.recurseSubmodules,
})
.then(async () => {
toast.success("Service Provided Saved");
@@ -483,6 +487,23 @@ export const SaveGitlabProvider = ({ applicationId }: Props) => {
</FormItem>
)}
/>
<FormField
control={form.control}
name="recurseSubmodules"
render={({ field }) => (
<FormItem className="flex items-center space-x-2">
<FormControl>
<input
type="checkbox"
checked={field.value}
onChange={field.onChange}
className="h-4 w-4 rounded border-gray-300 text-primary focus:ring-primary"
/>
</FormControl>
<FormLabel>Recurse Submodules</FormLabel>
</FormItem>
)}
/>
</div>
<div className="flex w-full justify-end">
<Button