Implement enableSubmodules feature across various Git provider components and update database schema. This change introduces a new boolean field enableSubmodules to control submodule behavior in Git operations, replacing the previous recurseSubmodules field. Updates include modifications to the UI components, API routers, and database schema to accommodate this new feature.

This commit is contained in:
Mauricio Siu
2025-04-26 16:35:02 -06:00
parent 1911b5b674
commit ceb16ae9f7
22 changed files with 11000 additions and 97 deletions

View File

@@ -23,6 +23,7 @@ import {
TooltipProvider, TooltipProvider,
TooltipTrigger, TooltipTrigger,
} from "@/components/ui/tooltip"; } from "@/components/ui/tooltip";
import { Switch } from "@/components/ui/switch";
import { api } from "@/utils/api"; import { api } from "@/utils/api";
import { zodResolver } from "@hookform/resolvers/zod"; import { zodResolver } from "@hookform/resolvers/zod";
import { KeyRoundIcon, LockIcon, X } from "lucide-react"; import { KeyRoundIcon, LockIcon, X } from "lucide-react";
@@ -44,7 +45,7 @@ const GitProviderSchema = z.object({
branch: z.string().min(1, "Branch required"), branch: z.string().min(1, "Branch required"),
sshKey: z.string().optional(), sshKey: z.string().optional(),
watchPaths: z.array(z.string()).optional(), watchPaths: z.array(z.string()).optional(),
recurseSubmodules: z.boolean().default(true), enableSubmodules: z.boolean().default(false),
}); });
type GitProvider = z.infer<typeof GitProviderSchema>; type GitProvider = z.infer<typeof GitProviderSchema>;
@@ -68,7 +69,7 @@ export const SaveGitProvider = ({ applicationId }: Props) => {
repositoryURL: "", repositoryURL: "",
sshKey: undefined, sshKey: undefined,
watchPaths: [], watchPaths: [],
recurseSubmodules: true, enableSubmodules: false,
}, },
resolver: zodResolver(GitProviderSchema), resolver: zodResolver(GitProviderSchema),
}); });
@@ -81,7 +82,7 @@ export const SaveGitProvider = ({ applicationId }: Props) => {
buildPath: data.customGitBuildPath || "/", buildPath: data.customGitBuildPath || "/",
repositoryURL: data.customGitUrl || "", repositoryURL: data.customGitUrl || "",
watchPaths: data.watchPaths || [], watchPaths: data.watchPaths || [],
recurseSubmodules: data.recurseSubmodules ?? true, enableSubmodules: data.enableSubmodules ?? false,
}); });
} }
}, [form.reset, data, form]); }, [form.reset, data, form]);
@@ -94,7 +95,7 @@ export const SaveGitProvider = ({ applicationId }: Props) => {
customGitSSHKeyId: values.sshKey === "none" ? null : values.sshKey, customGitSSHKeyId: values.sshKey === "none" ? null : values.sshKey,
applicationId, applicationId,
watchPaths: values.watchPaths || [], watchPaths: values.watchPaths || [],
recurseSubmodules: values.recurseSubmodules, enableSubmodules: values.enableSubmodules,
}) })
.then(async () => { .then(async () => {
toast.success("Git Provider Saved"); toast.success("Git Provider Saved");
@@ -298,20 +299,19 @@ export const SaveGitProvider = ({ applicationId }: Props) => {
</FormItem> </FormItem>
)} )}
/> />
<FormField <FormField
control={form.control} control={form.control}
name="recurseSubmodules" name="enableSubmodules"
render={({ field }) => ( render={({ field }) => (
<FormItem className="flex items-center space-x-2"> <FormItem className="flex items-center space-x-2">
<FormControl> <FormControl>
<input <Switch
type="checkbox"
checked={field.value} checked={field.value}
onChange={field.onChange} onCheckedChange={field.onChange}
className="h-4 w-4 rounded border-gray-300 text-primary focus:ring-primary"
/> />
</FormControl> </FormControl>
<FormLabel>Recurse Submodules</FormLabel> <FormLabel className="!mt-0">Enable Submodules</FormLabel>
</FormItem> </FormItem>
)} )}
/> />

View File

@@ -30,6 +30,7 @@ import {
SelectTrigger, SelectTrigger,
SelectValue, SelectValue,
} from "@/components/ui/select"; } from "@/components/ui/select";
import { Switch } from "@/components/ui/switch";
import { import {
Tooltip, Tooltip,
TooltipContent, TooltipContent,
@@ -57,7 +58,7 @@ const GithubProviderSchema = z.object({
branch: z.string().min(1, "Branch is required"), branch: z.string().min(1, "Branch is required"),
githubId: z.string().min(1, "Github Provider is required"), githubId: z.string().min(1, "Github Provider is required"),
watchPaths: z.array(z.string()).optional(), watchPaths: z.array(z.string()).optional(),
recurseSubmodules: z.boolean().default(true), enableSubmodules: z.boolean().default(false),
}); });
type GithubProvider = z.infer<typeof GithubProviderSchema>; type GithubProvider = z.infer<typeof GithubProviderSchema>;
@@ -82,7 +83,7 @@ export const SaveGithubProvider = ({ applicationId }: Props) => {
}, },
githubId: "", githubId: "",
branch: "", branch: "",
recurseSubmodules: true, enableSubmodules: false,
}, },
resolver: zodResolver(GithubProviderSchema), resolver: zodResolver(GithubProviderSchema),
}); });
@@ -126,7 +127,7 @@ export const SaveGithubProvider = ({ applicationId }: Props) => {
buildPath: data.buildPath || "/", buildPath: data.buildPath || "/",
githubId: data.githubId || "", githubId: data.githubId || "",
watchPaths: data.watchPaths || [], watchPaths: data.watchPaths || [],
recurseSubmodules: data.recurseSubmodules ?? true, enableSubmodules: data.enableSubmodules ?? false,
}); });
} }
}, [form.reset, data, form]); }, [form.reset, data, form]);
@@ -140,7 +141,7 @@ export const SaveGithubProvider = ({ applicationId }: Props) => {
buildPath: data.buildPath, buildPath: data.buildPath,
githubId: data.githubId, githubId: data.githubId,
watchPaths: data.watchPaths || [], watchPaths: data.watchPaths || [],
recurseSubmodules: data.recurseSubmodules, enableSubmodules: data.enableSubmodules,
}) })
.then(async () => { .then(async () => {
toast.success("Service Provided Saved"); toast.success("Service Provided Saved");
@@ -462,20 +463,19 @@ export const SaveGithubProvider = ({ applicationId }: Props) => {
</FormItem> </FormItem>
)} )}
/> />
<FormField <FormField
control={form.control} control={form.control}
name="recurseSubmodules" name="enableSubmodules"
render={({ field }) => ( render={({ field }) => (
<FormItem className="flex items-center space-x-2"> <FormItem className="flex items-center space-x-2">
<FormControl> <FormControl>
<input <Switch
type="checkbox"
checked={field.value} checked={field.value}
onChange={field.onChange} onCheckedChange={field.onChange}
className="h-4 w-4 rounded border-gray-300 text-primary focus:ring-primary"
/> />
</FormControl> </FormControl>
<FormLabel>Recurse Submodules</FormLabel> <FormLabel className="!mt-0">Enable Submodules</FormLabel>
</FormItem> </FormItem>
)} )}
/> />

View File

@@ -31,6 +31,7 @@ import {
SelectTrigger, SelectTrigger,
SelectValue, SelectValue,
} from "@/components/ui/select"; } from "@/components/ui/select";
import { Switch } from "@/components/ui/switch";
import { import {
Tooltip, Tooltip,
TooltipContent, TooltipContent,
@@ -60,7 +61,7 @@ const GitlabProviderSchema = z.object({
branch: z.string().min(1, "Branch is required"), branch: z.string().min(1, "Branch is required"),
gitlabId: z.string().min(1, "Gitlab Provider is required"), gitlabId: z.string().min(1, "Gitlab Provider is required"),
watchPaths: z.array(z.string()).optional(), watchPaths: z.array(z.string()).optional(),
recurseSubmodules: z.boolean().default(true), enableSubmodules: z.boolean().default(false),
}); });
type GitlabProvider = z.infer<typeof GitlabProviderSchema>; type GitlabProvider = z.infer<typeof GitlabProviderSchema>;
@@ -87,7 +88,7 @@ export const SaveGitlabProvider = ({ applicationId }: Props) => {
}, },
gitlabId: "", gitlabId: "",
branch: "", branch: "",
recurseSubmodules: true, enableSubmodules: false,
}, },
resolver: zodResolver(GitlabProviderSchema), resolver: zodResolver(GitlabProviderSchema),
}); });
@@ -137,7 +138,7 @@ export const SaveGitlabProvider = ({ applicationId }: Props) => {
buildPath: data.gitlabBuildPath || "/", buildPath: data.gitlabBuildPath || "/",
gitlabId: data.gitlabId || "", gitlabId: data.gitlabId || "",
watchPaths: data.watchPaths || [], watchPaths: data.watchPaths || [],
recurseSubmodules: data.recurseSubmodules ?? true, enableSubmodules: data.enableSubmodules ?? false,
}); });
} }
}, [form.reset, data, form]); }, [form.reset, data, form]);
@@ -153,7 +154,7 @@ export const SaveGitlabProvider = ({ applicationId }: Props) => {
gitlabProjectId: data.repository.id, gitlabProjectId: data.repository.id,
gitlabPathNamespace: data.repository.gitlabPathNamespace, gitlabPathNamespace: data.repository.gitlabPathNamespace,
watchPaths: data.watchPaths || [], watchPaths: data.watchPaths || [],
recurseSubmodules: data.recurseSubmodules, enableSubmodules: data.enableSubmodules,
}) })
.then(async () => { .then(async () => {
toast.success("Service Provided Saved"); toast.success("Service Provided Saved");
@@ -489,18 +490,16 @@ export const SaveGitlabProvider = ({ applicationId }: Props) => {
/> />
<FormField <FormField
control={form.control} control={form.control}
name="recurseSubmodules" name="enableSubmodules"
render={({ field }) => ( render={({ field }) => (
<FormItem className="flex items-center space-x-2"> <FormItem className="flex items-center space-x-2">
<FormControl> <FormControl>
<input <Switch
type="checkbox"
checked={field.value} checked={field.value}
onChange={field.onChange} onCheckedChange={field.onChange}
className="h-4 w-4 rounded border-gray-300 text-primary focus:ring-primary"
/> />
</FormControl> </FormControl>
<FormLabel>Recurse Submodules</FormLabel> <FormLabel className="!mt-0">Enable Submodules</FormLabel>
</FormItem> </FormItem>
)} )}
/> />

View File

@@ -31,6 +31,7 @@ import {
SelectTrigger, SelectTrigger,
SelectValue, SelectValue,
} from "@/components/ui/select"; } from "@/components/ui/select";
import { Switch } from "@/components/ui/switch";
import { import {
Tooltip, Tooltip,
TooltipContent, TooltipContent,
@@ -58,6 +59,7 @@ const BitbucketProviderSchema = z.object({
branch: z.string().min(1, "Branch is required"), branch: z.string().min(1, "Branch is required"),
bitbucketId: z.string().min(1, "Bitbucket Provider is required"), bitbucketId: z.string().min(1, "Bitbucket Provider is required"),
watchPaths: z.array(z.string()).optional(), watchPaths: z.array(z.string()).optional(),
enableSubmodules: z.boolean().default(false),
}); });
type BitbucketProvider = z.infer<typeof BitbucketProviderSchema>; type BitbucketProvider = z.infer<typeof BitbucketProviderSchema>;
@@ -84,6 +86,7 @@ export const SaveBitbucketProviderCompose = ({ composeId }: Props) => {
bitbucketId: "", bitbucketId: "",
branch: "", branch: "",
watchPaths: [], watchPaths: [],
enableSubmodules: false,
}, },
resolver: zodResolver(BitbucketProviderSchema), resolver: zodResolver(BitbucketProviderSchema),
}); });
@@ -130,6 +133,7 @@ export const SaveBitbucketProviderCompose = ({ composeId }: Props) => {
composePath: data.composePath, composePath: data.composePath,
bitbucketId: data.bitbucketId || "", bitbucketId: data.bitbucketId || "",
watchPaths: data.watchPaths || [], watchPaths: data.watchPaths || [],
enableSubmodules: data.enableSubmodules ?? false,
}); });
} }
}, [form.reset, data, form]); }, [form.reset, data, form]);
@@ -145,6 +149,7 @@ export const SaveBitbucketProviderCompose = ({ composeId }: Props) => {
sourceType: "bitbucket", sourceType: "bitbucket",
composeStatus: "idle", composeStatus: "idle",
watchPaths: data.watchPaths, watchPaths: data.watchPaths,
enableSubmodules: data.enableSubmodules,
}) })
.then(async () => { .then(async () => {
toast.success("Service Provided Saved"); toast.success("Service Provided Saved");
@@ -469,6 +474,21 @@ export const SaveBitbucketProviderCompose = ({ composeId }: Props) => {
</FormItem> </FormItem>
)} )}
/> />
<FormField
control={form.control}
name="enableSubmodules"
render={({ field }) => (
<FormItem className="flex items-center space-x-2">
<FormControl>
<Switch
checked={field.value}
onCheckedChange={field.onChange}
/>
</FormControl>
<FormLabel className="!mt-0">Enable Submodules</FormLabel>
</FormItem>
)}
/>
</div> </div>
<div className="flex w-full justify-end"> <div className="flex w-full justify-end">
<Button <Button

View File

@@ -19,6 +19,7 @@ import {
SelectTrigger, SelectTrigger,
SelectValue, SelectValue,
} from "@/components/ui/select"; } from "@/components/ui/select";
import { Switch } from "@/components/ui/switch";
import { import {
Tooltip, Tooltip,
TooltipContent, TooltipContent,
@@ -43,6 +44,7 @@ const GitProviderSchema = z.object({
branch: z.string().min(1, "Branch required"), branch: z.string().min(1, "Branch required"),
sshKey: z.string().optional(), sshKey: z.string().optional(),
watchPaths: z.array(z.string()).optional(), watchPaths: z.array(z.string()).optional(),
enableSubmodules: z.boolean().default(false),
}); });
type GitProvider = z.infer<typeof GitProviderSchema>; type GitProvider = z.infer<typeof GitProviderSchema>;
@@ -65,6 +67,7 @@ export const SaveGitProviderCompose = ({ composeId }: Props) => {
composePath: "./docker-compose.yml", composePath: "./docker-compose.yml",
sshKey: undefined, sshKey: undefined,
watchPaths: [], watchPaths: [],
enableSubmodules: false,
}, },
resolver: zodResolver(GitProviderSchema), resolver: zodResolver(GitProviderSchema),
}); });
@@ -77,6 +80,7 @@ export const SaveGitProviderCompose = ({ composeId }: Props) => {
repositoryURL: data.customGitUrl || "", repositoryURL: data.customGitUrl || "",
composePath: data.composePath, composePath: data.composePath,
watchPaths: data.watchPaths || [], watchPaths: data.watchPaths || [],
enableSubmodules: data.enableSubmodules ?? false,
}); });
} }
}, [form.reset, data, form]); }, [form.reset, data, form]);
@@ -91,6 +95,7 @@ export const SaveGitProviderCompose = ({ composeId }: Props) => {
composePath: values.composePath, composePath: values.composePath,
composeStatus: "idle", composeStatus: "idle",
watchPaths: values.watchPaths || [], watchPaths: values.watchPaths || [],
enableSubmodules: values.enableSubmodules,
}) })
.then(async () => { .then(async () => {
toast.success("Git Provider Saved"); toast.success("Git Provider Saved");
@@ -295,6 +300,21 @@ export const SaveGitProviderCompose = ({ composeId }: Props) => {
</FormItem> </FormItem>
)} )}
/> />
<FormField
control={form.control}
name="enableSubmodules"
render={({ field }) => (
<FormItem className="flex items-center space-x-2">
<FormControl>
<Switch
checked={field.value}
onCheckedChange={field.onChange}
/>
</FormControl>
<FormLabel className="!mt-0">Enable Submodules</FormLabel>
</FormItem>
)}
/>
</div> </div>
<div className="flex flex-row justify-end"> <div className="flex flex-row justify-end">

View File

@@ -31,6 +31,7 @@ import {
SelectTrigger, SelectTrigger,
SelectValue, SelectValue,
} from "@/components/ui/select"; } from "@/components/ui/select";
import { Switch } from "@/components/ui/switch";
import { import {
Tooltip, Tooltip,
TooltipContent, TooltipContent,
@@ -59,6 +60,7 @@ const GiteaProviderSchema = z.object({
branch: z.string().min(1, "Branch is required"), branch: z.string().min(1, "Branch is required"),
giteaId: z.string().min(1, "Gitea Provider is required"), giteaId: z.string().min(1, "Gitea Provider is required"),
watchPaths: z.array(z.string()).optional(), watchPaths: z.array(z.string()).optional(),
enableSubmodules: z.boolean().default(false),
}); });
type GiteaProvider = z.infer<typeof GiteaProviderSchema>; type GiteaProvider = z.infer<typeof GiteaProviderSchema>;
@@ -83,6 +85,7 @@ export const SaveGiteaProviderCompose = ({ composeId }: Props) => {
giteaId: "", giteaId: "",
branch: "", branch: "",
watchPaths: [], watchPaths: [],
enableSubmodules: false,
}, },
resolver: zodResolver(GiteaProviderSchema), resolver: zodResolver(GiteaProviderSchema),
}); });
@@ -136,6 +139,7 @@ export const SaveGiteaProviderCompose = ({ composeId }: Props) => {
composePath: data.composePath || "./docker-compose.yml", composePath: data.composePath || "./docker-compose.yml",
giteaId: data.giteaId || "", giteaId: data.giteaId || "",
watchPaths: data.watchPaths || [], watchPaths: data.watchPaths || [],
enableSubmodules: data.enableSubmodules ?? false,
}); });
} }
}, [form.reset, data, form]); }, [form.reset, data, form]);
@@ -151,6 +155,7 @@ export const SaveGiteaProviderCompose = ({ composeId }: Props) => {
sourceType: "gitea", sourceType: "gitea",
composeStatus: "idle", composeStatus: "idle",
watchPaths: data.watchPaths, watchPaths: data.watchPaths,
enableSubmodules: data.enableSubmodules,
} as any) } as any)
.then(async () => { .then(async () => {
toast.success("Service Provider Saved"); toast.success("Service Provider Saved");
@@ -469,6 +474,21 @@ export const SaveGiteaProviderCompose = ({ composeId }: Props) => {
</FormItem> </FormItem>
)} )}
/> />
<FormField
control={form.control}
name="enableSubmodules"
render={({ field }) => (
<FormItem className="flex items-center space-x-2">
<FormControl>
<Switch
checked={field.value}
onCheckedChange={field.onChange}
/>
</FormControl>
<FormLabel className="!mt-0">Enable Submodules</FormLabel>
</FormItem>
)}
/>
</div> </div>
<div className="flex justify-end"> <div className="flex justify-end">

View File

@@ -30,6 +30,7 @@ import {
SelectTrigger, SelectTrigger,
SelectValue, SelectValue,
} from "@/components/ui/select"; } from "@/components/ui/select";
import { Switch } from "@/components/ui/switch";
import { import {
Tooltip, Tooltip,
TooltipContent, TooltipContent,
@@ -57,6 +58,7 @@ const GithubProviderSchema = z.object({
branch: z.string().min(1, "Branch is required"), branch: z.string().min(1, "Branch is required"),
githubId: z.string().min(1, "Github Provider is required"), githubId: z.string().min(1, "Github Provider is required"),
watchPaths: z.array(z.string()).optional(), watchPaths: z.array(z.string()).optional(),
enableSubmodules: z.boolean().default(false),
}); });
type GithubProvider = z.infer<typeof GithubProviderSchema>; type GithubProvider = z.infer<typeof GithubProviderSchema>;
@@ -82,6 +84,7 @@ export const SaveGithubProviderCompose = ({ composeId }: Props) => {
githubId: "", githubId: "",
branch: "", branch: "",
watchPaths: [], watchPaths: [],
enableSubmodules: false,
}, },
resolver: zodResolver(GithubProviderSchema), resolver: zodResolver(GithubProviderSchema),
}); });
@@ -125,6 +128,7 @@ export const SaveGithubProviderCompose = ({ composeId }: Props) => {
composePath: data.composePath, composePath: data.composePath,
githubId: data.githubId || "", githubId: data.githubId || "",
watchPaths: data.watchPaths || [], watchPaths: data.watchPaths || [],
enableSubmodules: data.enableSubmodules ?? false,
}); });
} }
}, [form.reset, data, form]); }, [form.reset, data, form]);
@@ -140,6 +144,7 @@ export const SaveGithubProviderCompose = ({ composeId }: Props) => {
sourceType: "github", sourceType: "github",
composeStatus: "idle", composeStatus: "idle",
watchPaths: data.watchPaths, watchPaths: data.watchPaths,
enableSubmodules: data.enableSubmodules,
}) })
.then(async () => { .then(async () => {
toast.success("Service Provided Saved"); toast.success("Service Provided Saved");
@@ -460,6 +465,21 @@ export const SaveGithubProviderCompose = ({ composeId }: Props) => {
</FormItem> </FormItem>
)} )}
/> />
<FormField
control={form.control}
name="enableSubmodules"
render={({ field }) => (
<FormItem className="flex items-center space-x-2">
<FormControl>
<Switch
checked={field.value}
onCheckedChange={field.onChange}
/>
</FormControl>
<FormLabel className="!mt-0">Enable Submodules</FormLabel>
</FormItem>
)}
/>
</div> </div>
<div className="flex w-full justify-end"> <div className="flex w-full justify-end">
<Button <Button

View File

@@ -31,6 +31,7 @@ import {
SelectTrigger, SelectTrigger,
SelectValue, SelectValue,
} from "@/components/ui/select"; } from "@/components/ui/select";
import { Switch } from "@/components/ui/switch";
import { import {
Tooltip, Tooltip,
TooltipContent, TooltipContent,
@@ -60,6 +61,7 @@ const GitlabProviderSchema = z.object({
branch: z.string().min(1, "Branch is required"), branch: z.string().min(1, "Branch is required"),
gitlabId: z.string().min(1, "Gitlab Provider is required"), gitlabId: z.string().min(1, "Gitlab Provider is required"),
watchPaths: z.array(z.string()).optional(), watchPaths: z.array(z.string()).optional(),
enableSubmodules: z.boolean().default(false),
}); });
type GitlabProvider = z.infer<typeof GitlabProviderSchema>; type GitlabProvider = z.infer<typeof GitlabProviderSchema>;
@@ -87,6 +89,7 @@ export const SaveGitlabProviderCompose = ({ composeId }: Props) => {
gitlabId: "", gitlabId: "",
branch: "", branch: "",
watchPaths: [], watchPaths: [],
enableSubmodules: false,
}, },
resolver: zodResolver(GitlabProviderSchema), resolver: zodResolver(GitlabProviderSchema),
}); });
@@ -136,6 +139,7 @@ export const SaveGitlabProviderCompose = ({ composeId }: Props) => {
composePath: data.composePath, composePath: data.composePath,
gitlabId: data.gitlabId || "", gitlabId: data.gitlabId || "",
watchPaths: data.watchPaths || [], watchPaths: data.watchPaths || [],
enableSubmodules: data.enableSubmodules ?? false,
}); });
} }
}, [form.reset, data, form]); }, [form.reset, data, form]);
@@ -153,6 +157,7 @@ export const SaveGitlabProviderCompose = ({ composeId }: Props) => {
sourceType: "gitlab", sourceType: "gitlab",
composeStatus: "idle", composeStatus: "idle",
watchPaths: data.watchPaths, watchPaths: data.watchPaths,
enableSubmodules: data.enableSubmodules,
}) })
.then(async () => { .then(async () => {
toast.success("Service Provided Saved"); toast.success("Service Provided Saved");
@@ -485,6 +490,21 @@ export const SaveGitlabProviderCompose = ({ composeId }: Props) => {
</FormItem> </FormItem>
)} )}
/> />
<FormField
control={form.control}
name="enableSubmodules"
render={({ field }) => (
<FormItem className="flex items-center space-x-2">
<FormControl>
<Switch
checked={field.value}
onCheckedChange={field.onChange}
/>
</FormControl>
<FormLabel className="!mt-0">Enable Submodules</FormLabel>
</FormItem>
)}
/>
</div> </div>
<div className="flex w-full justify-end"> <div className="flex w-full justify-end">
<Button <Button

View File

@@ -0,0 +1,2 @@
ALTER TABLE "application" ADD COLUMN "enableSubmodules" boolean DEFAULT false;--> statement-breakpoint
ALTER TABLE "compose" ADD COLUMN "enableSubmodules" boolean DEFAULT false;

View File

@@ -0,0 +1,2 @@
ALTER TABLE "application" ALTER COLUMN "enableSubmodules" SET NOT NULL;--> statement-breakpoint
ALTER TABLE "compose" ALTER COLUMN "enableSubmodules" SET NOT NULL;

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -596,6 +596,20 @@
"when": 1743923992280, "when": 1743923992280,
"tag": "0084_thin_iron_lad", "tag": "0084_thin_iron_lad",
"breakpoints": true "breakpoints": true
},
{
"idx": 85,
"version": "7",
"when": 1745705609181,
"tag": "0085_equal_captain_stacy",
"breakpoints": true
},
{
"idx": 86,
"version": "7",
"when": 1745706676004,
"tag": "0086_rainy_gertrude_yorkes",
"breakpoints": true
} }
] ]
} }

View File

@@ -355,6 +355,7 @@ export const applicationRouter = createTRPCRouter({
applicationStatus: "idle", applicationStatus: "idle",
githubId: input.githubId, githubId: input.githubId,
watchPaths: input.watchPaths, watchPaths: input.watchPaths,
enableSubmodules: input.enableSubmodules,
}); });
return true; return true;
@@ -382,6 +383,7 @@ export const applicationRouter = createTRPCRouter({
gitlabProjectId: input.gitlabProjectId, gitlabProjectId: input.gitlabProjectId,
gitlabPathNamespace: input.gitlabPathNamespace, gitlabPathNamespace: input.gitlabPathNamespace,
watchPaths: input.watchPaths, watchPaths: input.watchPaths,
enableSubmodules: input.enableSubmodules,
}); });
return true; return true;
@@ -407,6 +409,7 @@ export const applicationRouter = createTRPCRouter({
applicationStatus: "idle", applicationStatus: "idle",
bitbucketId: input.bitbucketId, bitbucketId: input.bitbucketId,
watchPaths: input.watchPaths, watchPaths: input.watchPaths,
enableSubmodules: input.enableSubmodules,
}); });
return true; return true;
@@ -432,6 +435,7 @@ export const applicationRouter = createTRPCRouter({
applicationStatus: "idle", applicationStatus: "idle",
giteaId: input.giteaId, giteaId: input.giteaId,
watchPaths: input.watchPaths, watchPaths: input.watchPaths,
enableSubmodules: input.enableSubmodules,
}); });
return true; return true;
@@ -479,6 +483,7 @@ export const applicationRouter = createTRPCRouter({
sourceType: "git", sourceType: "git",
applicationStatus: "idle", applicationStatus: "idle",
watchPaths: input.watchPaths, watchPaths: input.watchPaths,
enableSubmodules: input.enableSubmodules,
}); });
return true; return true;

View File

@@ -182,6 +182,7 @@ export const applications = pgTable("application", {
onDelete: "set null", onDelete: "set null",
}, },
), ),
enableSubmodules: boolean("enableSubmodules").notNull().default(false),
dockerfile: text("dockerfile"), dockerfile: text("dockerfile"),
dockerContextPath: text("dockerContextPath"), dockerContextPath: text("dockerContextPath"),
dockerBuildStage: text("dockerBuildStage"), dockerBuildStage: text("dockerBuildStage"),
@@ -470,6 +471,7 @@ export const apiSaveGithubProvider = createSchema
buildPath: true, buildPath: true,
githubId: true, githubId: true,
watchPaths: true, watchPaths: true,
enableSubmodules: true,
}) })
.required(); .required();
@@ -484,6 +486,7 @@ export const apiSaveGitlabProvider = createSchema
gitlabProjectId: true, gitlabProjectId: true,
gitlabPathNamespace: true, gitlabPathNamespace: true,
watchPaths: true, watchPaths: true,
enableSubmodules: true,
}) })
.required(); .required();
@@ -496,6 +499,7 @@ export const apiSaveBitbucketProvider = createSchema
bitbucketId: true, bitbucketId: true,
applicationId: true, applicationId: true,
watchPaths: true, watchPaths: true,
enableSubmodules: true,
}) })
.required(); .required();
@@ -508,6 +512,7 @@ export const apiSaveGiteaProvider = createSchema
giteaRepository: true, giteaRepository: true,
giteaId: true, giteaId: true,
watchPaths: true, watchPaths: true,
enableSubmodules: true,
}) })
.required(); .required();
@@ -528,6 +533,7 @@ export const apiSaveGitProvider = createSchema
customGitBuildPath: true, customGitBuildPath: true,
customGitUrl: true, customGitUrl: true,
watchPaths: true, watchPaths: true,
enableSubmodules: true,
}) })
.required() .required()
.merge( .merge(

View File

@@ -72,6 +72,7 @@ export const compose = pgTable("compose", {
), ),
command: text("command").notNull().default(""), command: text("command").notNull().default(""),
// //
enableSubmodules: boolean("enableSubmodules").notNull().default(false),
composePath: text("composePath").notNull().default("./docker-compose.yml"), composePath: text("composePath").notNull().default("./docker-compose.yml"),
suffix: text("suffix").notNull().default(""), suffix: text("suffix").notNull().default(""),
randomize: boolean("randomize").notNull().default(false), randomize: boolean("randomize").notNull().default(false),

View File

@@ -356,6 +356,7 @@ export const deployRemoteCompose = async ({
deployment.logPath, deployment.logPath,
true, true,
); );
console.log(command);
} else if (compose.sourceType === "raw") { } else if (compose.sourceType === "raw") {
command += getCreateComposeFileCommand(compose, deployment.logPath); command += getCreateComposeFileCommand(compose, deployment.logPath);
} else if (compose.sourceType === "gitea") { } else if (compose.sourceType === "gitea") {

View File

@@ -37,7 +37,7 @@ export const cloneBitbucketRepository = async (
bitbucketBranch, bitbucketBranch,
bitbucketId, bitbucketId,
bitbucket, bitbucket,
recurseSubmodules = true, enableSubmodules,
} = entity; } = entity;
if (!bitbucketId) { if (!bitbucketId) {
@@ -60,13 +60,12 @@ export const cloneBitbucketRepository = async (
bitbucketBranch!, bitbucketBranch!,
"--depth", "--depth",
"1", "1",
...(enableSubmodules ? ["--recurse-submodules"] : []),
cloneUrl, cloneUrl,
outputPath, outputPath,
"--progress", "--progress",
]; ];
if (recurseSubmodules) {
cloneArgs.splice(4, 0, "--recurse-submodules");
}
await spawnAsync("git", cloneArgs, (data) => { await spawnAsync("git", cloneArgs, (data) => {
if (writeStream.writable) { if (writeStream.writable) {
writeStream.write(data); writeStream.write(data);
@@ -89,7 +88,7 @@ export const cloneRawBitbucketRepository = async (entity: Compose) => {
bitbucketOwner, bitbucketOwner,
bitbucketBranch, bitbucketBranch,
bitbucketId, bitbucketId,
recurseSubmodules = true, enableSubmodules,
} = entity; } = entity;
if (!bitbucketId) { if (!bitbucketId) {
@@ -113,13 +112,12 @@ export const cloneRawBitbucketRepository = async (entity: Compose) => {
bitbucketBranch!, bitbucketBranch!,
"--depth", "--depth",
"1", "1",
...(enableSubmodules ? ["--recurse-submodules"] : []),
cloneUrl, cloneUrl,
outputPath, outputPath,
"--progress", "--progress",
]; ];
if (recurseSubmodules) {
cloneArgs.splice(4, 0, "--recurse-submodules");
}
await spawnAsync("git", cloneArgs); await spawnAsync("git", cloneArgs);
} catch (error) { } catch (error) {
throw error; throw error;
@@ -135,7 +133,7 @@ export const cloneRawBitbucketRepositoryRemote = async (compose: Compose) => {
bitbucketBranch, bitbucketBranch,
bitbucketId, bitbucketId,
serverId, serverId,
recurseSubmodules = true, enableSubmodules,
} = compose; } = compose;
if (!serverId) { if (!serverId) {
@@ -160,7 +158,7 @@ export const cloneRawBitbucketRepositoryRemote = async (compose: Compose) => {
try { try {
const cloneCommand = ` const cloneCommand = `
rm -rf ${outputPath}; rm -rf ${outputPath};
git clone --branch ${bitbucketBranch} --depth 1 ${recurseSubmodules ? "--recurse-submodules" : ""} ${cloneUrl} ${outputPath} git clone --branch ${bitbucketBranch} --depth 1 ${enableSubmodules ? "--recurse-submodules" : ""} ${cloneUrl} ${outputPath}
`; `;
await execAsyncRemote(serverId, cloneCommand); await execAsyncRemote(serverId, cloneCommand);
} catch (error) { } catch (error) {
@@ -181,7 +179,7 @@ export const getBitbucketCloneCommand = async (
bitbucketBranch, bitbucketBranch,
bitbucketId, bitbucketId,
serverId, serverId,
recurseSubmodules = true, enableSubmodules,
} = entity; } = entity;
if (!serverId) { if (!serverId) {
@@ -213,7 +211,7 @@ export const getBitbucketCloneCommand = async (
const cloneCommand = ` const cloneCommand = `
rm -rf ${outputPath}; rm -rf ${outputPath};
mkdir -p ${outputPath}; mkdir -p ${outputPath};
if ! git clone --branch ${bitbucketBranch} --depth 1 ${recurseSubmodules ? "--recurse-submodules" : ""} --progress ${cloneUrl} ${outputPath} >> ${logPath} 2>&1; then if ! git clone --branch ${bitbucketBranch} --depth 1 ${enableSubmodules ? "--recurse-submodules" : ""} --progress ${cloneUrl} ${outputPath} >> ${logPath} 2>&1; then
echo "❌ [ERROR] Fail to clone the repository ${repoclone}" >> ${logPath}; echo "❌ [ERROR] Fail to clone the repository ${repoclone}" >> ${logPath};
exit 1; exit 1;
fi fi

View File

@@ -17,7 +17,7 @@ export const cloneGitRepository = async (
customGitUrl?: string | null; customGitUrl?: string | null;
customGitBranch?: string | null; customGitBranch?: string | null;
customGitSSHKeyId?: string | null; customGitSSHKeyId?: string | null;
recurseSubmodules?: boolean; enableSubmodules?: boolean;
}, },
logPath: string, logPath: string,
isCompose = false, isCompose = false,
@@ -28,7 +28,7 @@ export const cloneGitRepository = async (
customGitUrl, customGitUrl,
customGitBranch, customGitBranch,
customGitSSHKeyId, customGitSSHKeyId,
recurseSubmodules = true, enableSubmodules,
} = entity; } = entity;
if (!customGitUrl || !customGitBranch) { if (!customGitUrl || !customGitBranch) {
@@ -83,13 +83,12 @@ export const cloneGitRepository = async (
customGitBranch, customGitBranch,
"--depth", "--depth",
"1", "1",
...(enableSubmodules ? ["--recurse-submodules"] : []),
customGitUrl, customGitUrl,
outputPath, outputPath,
"--progress", "--progress",
]; ];
if (recurseSubmodules) {
cloneArgs.splice(4, 0, "--recurse-submodules");
}
await spawnAsync( await spawnAsync(
"git", "git",
cloneArgs, cloneArgs,
@@ -124,7 +123,7 @@ export const getCustomGitCloneCommand = async (
customGitBranch?: string | null; customGitBranch?: string | null;
customGitSSHKeyId?: string | null; customGitSSHKeyId?: string | null;
serverId: string | null; serverId: string | null;
recurseSubmodules?: boolean; enableSubmodules: boolean;
}, },
logPath: string, logPath: string,
isCompose = false, isCompose = false,
@@ -136,7 +135,7 @@ export const getCustomGitCloneCommand = async (
customGitBranch, customGitBranch,
customGitSSHKeyId, customGitSSHKeyId,
serverId, serverId,
recurseSubmodules = true, enableSubmodules,
} = entity; } = entity;
if (!customGitUrl || !customGitBranch) { if (!customGitUrl || !customGitBranch) {
@@ -193,7 +192,7 @@ export const getCustomGitCloneCommand = async (
} }
command.push( command.push(
`if ! git clone --branch ${customGitBranch} --depth 1 ${recurseSubmodules ? "--recurse-submodules" : ""} --progress ${customGitUrl} ${outputPath} >> ${logPath} 2>&1; then `if ! git clone --branch ${customGitBranch} --depth 1 ${enableSubmodules ? "--recurse-submodules" : ""} --progress ${customGitUrl} ${outputPath} >> ${logPath} 2>&1; then
echo "❌ [ERROR] Fail to clone the repository ${customGitUrl}" >> ${logPath}; echo "❌ [ERROR] Fail to clone the repository ${customGitUrl}" >> ${logPath};
exit 1; exit 1;
fi fi
@@ -273,14 +272,14 @@ export const cloneGitRawRepository = async (entity: {
customGitUrl?: string | null; customGitUrl?: string | null;
customGitBranch?: string | null; customGitBranch?: string | null;
customGitSSHKeyId?: string | null; customGitSSHKeyId?: string | null;
recurseSubmodules?: boolean; enableSubmodules?: boolean;
}) => { }) => {
const { const {
appName, appName,
customGitUrl, customGitUrl,
customGitBranch, customGitBranch,
customGitSSHKeyId, customGitSSHKeyId,
recurseSubmodules = true, enableSubmodules,
} = entity; } = entity;
if (!customGitUrl || !customGitBranch) { if (!customGitUrl || !customGitBranch) {
@@ -332,13 +331,12 @@ export const cloneGitRawRepository = async (entity: {
customGitBranch, customGitBranch,
"--depth", "--depth",
"1", "1",
...(enableSubmodules ? ["--recurse-submodules"] : []),
customGitUrl, customGitUrl,
outputPath, outputPath,
"--progress", "--progress",
]; ];
if (recurseSubmodules) {
cloneArgs.splice(4, 0, "--recurse-submodules");
}
await spawnAsync("git", cloneArgs, (_data) => {}, { await spawnAsync("git", cloneArgs, (_data) => {}, {
env: { env: {
...process.env, ...process.env,
@@ -359,7 +357,7 @@ export const cloneRawGitRepositoryRemote = async (compose: Compose) => {
customGitUrl, customGitUrl,
customGitSSHKeyId, customGitSSHKeyId,
serverId, serverId,
recurseSubmodules = true, enableSubmodules,
} = compose; } = compose;
if (!serverId) { if (!serverId) {
@@ -414,7 +412,7 @@ export const cloneRawGitRepositoryRemote = async (compose: Compose) => {
} }
command.push( command.push(
`if ! git clone --branch ${customGitBranch} --depth 1 ${recurseSubmodules ? "--recurse-submodules" : ""} --progress ${customGitUrl} ${outputPath} ; then `if ! git clone --branch ${customGitBranch} --depth 1 ${enableSubmodules ? "--recurse-submodules" : ""} --progress ${customGitUrl} ${outputPath} ; then
echo "[ERROR] Fail to clone the repository "; echo "[ERROR] Fail to clone the repository ";
exit 1; exit 1;
fi fi

View File

@@ -119,6 +119,7 @@ export const getGiteaCloneCommand = async (
giteaRepository, giteaRepository,
serverId, serverId,
gitea, gitea,
enableSubmodules,
} = entity; } = entity;
if (!serverId) { if (!serverId) {
@@ -155,7 +156,7 @@ export const getGiteaCloneCommand = async (
rm -rf ${outputPath}; rm -rf ${outputPath};
mkdir -p ${outputPath}; mkdir -p ${outputPath};
if ! git clone --branch ${giteaBranch} --depth 1 --recurse-submodules ${cloneUrl} ${outputPath} >> ${logPath} 2>&1; then if ! git clone --branch ${giteaBranch} --depth 1 ${enableSubmodules ? "--recurse-submodules" : ""} ${cloneUrl} ${outputPath} >> ${logPath} 2>&1; then
echo "❌ [ERROR] Failed to clone the repository ${repoClone}" >> ${logPath}; echo "❌ [ERROR] Failed to clone the repository ${repoClone}" >> ${logPath};
exit 1; exit 1;
fi fi
@@ -174,7 +175,14 @@ export const cloneGiteaRepository = async (
const { APPLICATIONS_PATH, COMPOSE_PATH } = paths(); const { APPLICATIONS_PATH, COMPOSE_PATH } = paths();
const writeStream = createWriteStream(logPath, { flags: "a" }); const writeStream = createWriteStream(logPath, { flags: "a" });
const { appName, giteaBranch, giteaId, giteaOwner, giteaRepository } = entity; const {
appName,
giteaBranch,
giteaId,
giteaOwner,
giteaRepository,
enableSubmodules,
} = entity;
if (!giteaId) { if (!giteaId) {
throw new TRPCError({ throw new TRPCError({
@@ -211,7 +219,7 @@ export const cloneGiteaRepository = async (
giteaBranch!, giteaBranch!,
"--depth", "--depth",
"1", "1",
"--recurse-submodules", ...(enableSubmodules ? ["--recurse-submodules"] : []),
cloneUrl, cloneUrl,
outputPath, outputPath,
"--progress", "--progress",
@@ -232,7 +240,14 @@ export const cloneGiteaRepository = async (
}; };
export const cloneRawGiteaRepository = async (entity: Compose) => { export const cloneRawGiteaRepository = async (entity: Compose) => {
const { appName, giteaRepository, giteaOwner, giteaBranch, giteaId } = entity; const {
appName,
giteaRepository,
giteaOwner,
giteaBranch,
giteaId,
enableSubmodules,
} = entity;
const { COMPOSE_PATH } = paths(); const { COMPOSE_PATH } = paths();
if (!giteaId) { if (!giteaId) {
@@ -265,7 +280,7 @@ export const cloneRawGiteaRepository = async (entity: Compose) => {
giteaBranch!, giteaBranch!,
"--depth", "--depth",
"1", "1",
"--recurse-submodules", ...(enableSubmodules ? ["--recurse-submodules"] : []),
cloneUrl, cloneUrl,
outputPath, outputPath,
"--progress", "--progress",
@@ -283,6 +298,7 @@ export const cloneRawGiteaRepositoryRemote = async (compose: Compose) => {
giteaBranch, giteaBranch,
giteaId, giteaId,
serverId, serverId,
enableSubmodules,
} = compose; } = compose;
if (!serverId) { if (!serverId) {
@@ -307,7 +323,7 @@ export const cloneRawGiteaRepositoryRemote = async (compose: Compose) => {
try { try {
const command = ` const command = `
rm -rf ${outputPath}; rm -rf ${outputPath};
git clone --branch ${giteaBranch} --depth 1 ${cloneUrl} ${outputPath} git clone --branch ${giteaBranch} --depth 1 ${enableSubmodules ? "--recurse-submodules" : ""} ${cloneUrl} ${outputPath}
`; `;
await execAsyncRemote(serverId, command); await execAsyncRemote(serverId, command);
} catch (error) { } catch (error) {

View File

@@ -83,18 +83,18 @@ interface CloneGithubRepository {
repository: string | null; repository: string | null;
logPath: string; logPath: string;
type?: "application" | "compose"; type?: "application" | "compose";
recurseSubmodules?: boolean; enableSubmodules: boolean;
} }
export const cloneGithubRepository = async ({ export const cloneGithubRepository = async ({
logPath, logPath,
type = "application", type = "application",
recurseSubmodules = true,
...entity ...entity
}: CloneGithubRepository) => { }: CloneGithubRepository) => {
const isCompose = type === "compose"; const isCompose = type === "compose";
const { APPLICATIONS_PATH, COMPOSE_PATH } = paths(); const { APPLICATIONS_PATH, COMPOSE_PATH } = paths();
const writeStream = createWriteStream(logPath, { flags: "a" }); const writeStream = createWriteStream(logPath, { flags: "a" });
const { appName, repository, owner, branch, githubId } = entity; const { appName, repository, owner, branch, githubId, enableSubmodules } =
entity;
if (!githubId) { if (!githubId) {
throw new TRPCError({ throw new TRPCError({
@@ -136,13 +136,12 @@ export const cloneGithubRepository = async ({
branch!, branch!,
"--depth", "--depth",
"1", "1",
...(enableSubmodules ? ["--recurse-submodules"] : []),
cloneUrl, cloneUrl,
outputPath, outputPath,
"--progress", "--progress",
]; ];
if (recurseSubmodules) {
cloneArgs.splice(4, 0, "--recurse-submodules");
}
await spawnAsync("git", cloneArgs, (data) => { await spawnAsync("git", cloneArgs, (data) => {
if (writeStream.writable) { if (writeStream.writable) {
writeStream.write(data); writeStream.write(data);
@@ -160,10 +159,17 @@ export const cloneGithubRepository = async ({
export const getGithubCloneCommand = async ({ export const getGithubCloneCommand = async ({
logPath, logPath,
type = "application", type = "application",
recurseSubmodules = true,
...entity ...entity
}: CloneGithubRepository & { serverId: string }) => { }: CloneGithubRepository & { serverId: string }) => {
const { appName, repository, owner, branch, githubId, serverId } = entity; const {
appName,
repository,
owner,
branch,
githubId,
serverId,
enableSubmodules,
} = entity;
const isCompose = type === "compose"; const isCompose = type === "compose";
if (!serverId) { if (!serverId) {
throw new TRPCError({ throw new TRPCError({
@@ -218,7 +224,7 @@ export const getGithubCloneCommand = async ({
const cloneCommand = ` const cloneCommand = `
rm -rf ${outputPath}; rm -rf ${outputPath};
mkdir -p ${outputPath}; mkdir -p ${outputPath};
if ! git clone --branch ${branch} --depth 1 ${recurseSubmodules ? "--recurse-submodules" : ""} --progress ${cloneUrl} ${outputPath} >> ${logPath} 2>&1; then if ! git clone --branch ${branch} --depth 1 ${enableSubmodules ? "--recurse-submodules" : ""} --progress ${cloneUrl} ${outputPath} >> ${logPath} 2>&1; then
echo "❌ [ERROR] Fail to clone repository ${repoclone}" >> ${logPath}; echo "❌ [ERROR] Fail to clone repository ${repoclone}" >> ${logPath};
exit 1; exit 1;
fi fi
@@ -229,14 +235,8 @@ echo "Cloned ${repoclone} to ${outputPath}: ✅" >> ${logPath};
}; };
export const cloneRawGithubRepository = async (entity: Compose) => { export const cloneRawGithubRepository = async (entity: Compose) => {
const { const { appName, repository, owner, branch, githubId, enableSubmodules } =
appName, entity;
repository,
owner,
branch,
githubId,
recurseSubmodules = true,
} = entity;
if (!githubId) { if (!githubId) {
throw new TRPCError({ throw new TRPCError({
@@ -260,13 +260,11 @@ export const cloneRawGithubRepository = async (entity: Compose) => {
branch!, branch!,
"--depth", "--depth",
"1", "1",
...(enableSubmodules ? ["--recurse-submodules"] : []),
cloneUrl, cloneUrl,
outputPath, outputPath,
"--progress", "--progress",
]; ];
if (recurseSubmodules) {
cloneArgs.splice(4, 0, "--recurse-submodules");
}
await spawnAsync("git", cloneArgs); await spawnAsync("git", cloneArgs);
} catch (error) { } catch (error) {
throw error; throw error;
@@ -281,7 +279,7 @@ export const cloneRawGithubRepositoryRemote = async (compose: Compose) => {
branch, branch,
githubId, githubId,
serverId, serverId,
recurseSubmodules = true, enableSubmodules,
} = compose; } = compose;
if (!serverId) { if (!serverId) {
@@ -308,7 +306,7 @@ export const cloneRawGithubRepositoryRemote = async (compose: Compose) => {
try { try {
const command = ` const command = `
rm -rf ${outputPath}; rm -rf ${outputPath};
git clone --branch ${branch} --depth 1 ${recurseSubmodules ? "--recurse-submodules" : ""} ${cloneUrl} ${outputPath} git clone --branch ${branch} --depth 1 ${enableSubmodules ? "--recurse-submodules" : ""} ${cloneUrl} ${outputPath}
`; `;
await execAsyncRemote(serverId, command); await execAsyncRemote(serverId, command);
} catch (error) { } catch (error) {

View File

@@ -96,7 +96,7 @@ export const cloneGitlabRepository = async (
gitlabId, gitlabId,
gitlab, gitlab,
gitlabPathNamespace, gitlabPathNamespace,
recurseSubmodules = true, enableSubmodules,
} = entity; } = entity;
if (!gitlabId) { if (!gitlabId) {
@@ -139,13 +139,12 @@ export const cloneGitlabRepository = async (
gitlabBranch!, gitlabBranch!,
"--depth", "--depth",
"1", "1",
...(enableSubmodules ? ["--recurse-submodules"] : []),
cloneUrl, cloneUrl,
outputPath, outputPath,
"--progress", "--progress",
]; ];
if (recurseSubmodules) {
cloneArgs.splice(4, 0, "--recurse-submodules");
}
await spawnAsync("git", cloneArgs, (data) => { await spawnAsync("git", cloneArgs, (data) => {
if (writeStream.writable) { if (writeStream.writable) {
writeStream.write(data); writeStream.write(data);
@@ -172,7 +171,7 @@ export const getGitlabCloneCommand = async (
gitlabId, gitlabId,
serverId, serverId,
gitlab, gitlab,
recurseSubmodules = true, enableSubmodules,
} = entity; } = entity;
if (!serverId) { if (!serverId) {
@@ -228,7 +227,7 @@ export const getGitlabCloneCommand = async (
const cloneCommand = ` const cloneCommand = `
rm -rf ${outputPath}; rm -rf ${outputPath};
mkdir -p ${outputPath}; mkdir -p ${outputPath};
if ! git clone --branch ${gitlabBranch} --depth 1 ${recurseSubmodules ? "--recurse-submodules" : ""} --progress ${cloneUrl} ${outputPath} >> ${logPath} 2>&1; then if ! git clone --branch ${gitlabBranch} --depth 1 ${enableSubmodules ? "--recurse-submodules" : ""} --progress ${cloneUrl} ${outputPath} >> ${logPath} 2>&1; then
echo "❌ [ERROR] Fail to clone the repository ${repoclone}" >> ${logPath}; echo "❌ [ERROR] Fail to clone the repository ${repoclone}" >> ${logPath};
exit 1; exit 1;
fi fi
@@ -341,7 +340,7 @@ export const cloneRawGitlabRepository = async (entity: Compose) => {
gitlabBranch, gitlabBranch,
gitlabId, gitlabId,
gitlabPathNamespace, gitlabPathNamespace,
recurseSubmodules = true, enableSubmodules,
} = entity; } = entity;
if (!gitlabId) { if (!gitlabId) {
@@ -369,13 +368,11 @@ export const cloneRawGitlabRepository = async (entity: Compose) => {
gitlabBranch!, gitlabBranch!,
"--depth", "--depth",
"1", "1",
...(enableSubmodules ? ["--recurse-submodules"] : []),
cloneUrl, cloneUrl,
outputPath, outputPath,
"--progress", "--progress",
]; ];
if (recurseSubmodules) {
cloneArgs.splice(4, 0, "--recurse-submodules");
}
await spawnAsync("git", cloneArgs); await spawnAsync("git", cloneArgs);
} catch (error) { } catch (error) {
throw error; throw error;
@@ -389,7 +386,7 @@ export const cloneRawGitlabRepositoryRemote = async (compose: Compose) => {
branch, branch,
gitlabId, gitlabId,
serverId, serverId,
recurseSubmodules = true, enableSubmodules,
} = compose; } = compose;
if (!serverId) { if (!serverId) {
@@ -414,7 +411,7 @@ export const cloneRawGitlabRepositoryRemote = async (compose: Compose) => {
try { try {
const command = ` const command = `
rm -rf ${outputPath}; rm -rf ${outputPath};
git clone --branch ${branch} --depth 1 ${recurseSubmodules ? "--recurse-submodules" : ""} ${cloneUrl} ${outputPath} git clone --branch ${branch} --depth 1 ${enableSubmodules ? "--recurse-submodules" : ""} ${cloneUrl} ${outputPath}
`; `;
await execAsyncRemote(serverId, command); await execAsyncRemote(serverId, command);
} catch (error) { } catch (error) {