mirror of
https://github.com/andwati/dokploy.git
synced 2026-11-17 09:25:20 +00:00
Refactor repository cloning interfaces: standardize parameters for Bitbucket, Gitea, and GitLab repository cloning functions to improve consistency and maintainability across the codebase.
This commit is contained in:
@@ -29,7 +29,6 @@ import { cloneGitlabRepository } from "@dokploy/server/utils/providers/gitlab";
|
|||||||
import { createTraefikConfig } from "@dokploy/server/utils/traefik/application";
|
import { createTraefikConfig } from "@dokploy/server/utils/traefik/application";
|
||||||
import { TRPCError } from "@trpc/server";
|
import { TRPCError } from "@trpc/server";
|
||||||
import { eq } from "drizzle-orm";
|
import { eq } from "drizzle-orm";
|
||||||
import { cleanUpSystemPrune, encodeBase64 } from "../utils/docker/utils";
|
|
||||||
import { getDokployUrl } from "./admin";
|
import { getDokployUrl } from "./admin";
|
||||||
import {
|
import {
|
||||||
createDeployment,
|
createDeployment,
|
||||||
|
|||||||
@@ -81,10 +81,22 @@ type BitbucketClone = (ApplicationWithBitbucket | ComposeWithBitbucket) & {
|
|||||||
type?: "application" | "compose";
|
type?: "application" | "compose";
|
||||||
};
|
};
|
||||||
|
|
||||||
|
interface CloneBitbucketRepository {
|
||||||
|
appName: string;
|
||||||
|
bitbucketRepository: string | null;
|
||||||
|
bitbucketOwner: string | null;
|
||||||
|
bitbucketBranch: string | null;
|
||||||
|
bitbucketId: string | null;
|
||||||
|
bitbucket: Bitbucket | null;
|
||||||
|
enableSubmodules: boolean;
|
||||||
|
serverId: string | null;
|
||||||
|
type?: "application" | "compose";
|
||||||
|
}
|
||||||
|
|
||||||
export const cloneBitbucketRepository = async ({
|
export const cloneBitbucketRepository = async ({
|
||||||
type = "application",
|
type = "application",
|
||||||
...entity
|
...entity
|
||||||
}: BitbucketClone) => {
|
}: CloneBitbucketRepository) => {
|
||||||
let command = "set -e;";
|
let command = "set -e;";
|
||||||
const {
|
const {
|
||||||
appName,
|
appName,
|
||||||
|
|||||||
@@ -119,10 +119,21 @@ type GiteaClone = (ApplicationWithGitea | ComposeWithGitea) & {
|
|||||||
type?: "application" | "compose";
|
type?: "application" | "compose";
|
||||||
};
|
};
|
||||||
|
|
||||||
|
interface CloneGiteaRepository {
|
||||||
|
appName: string;
|
||||||
|
giteaBranch: string | null;
|
||||||
|
giteaId: string | null;
|
||||||
|
giteaOwner: string | null;
|
||||||
|
giteaRepository: string | null;
|
||||||
|
enableSubmodules: boolean;
|
||||||
|
serverId: string | null;
|
||||||
|
type?: "application" | "compose";
|
||||||
|
}
|
||||||
|
|
||||||
export const cloneGiteaRepository = async ({
|
export const cloneGiteaRepository = async ({
|
||||||
type = "application",
|
type = "application",
|
||||||
...entity
|
...entity
|
||||||
}: GiteaClone) => {
|
}: CloneGiteaRepository) => {
|
||||||
let command = "set -e;";
|
let command = "set -e;";
|
||||||
const {
|
const {
|
||||||
appName,
|
appName,
|
||||||
|
|||||||
@@ -97,15 +97,20 @@ const getGitlabCloneUrl = (gitlab: GitlabInfo, repoClone: string) => {
|
|||||||
return cloneUrl;
|
return cloneUrl;
|
||||||
};
|
};
|
||||||
|
|
||||||
type GitlabClone = (ApplicationWithGitlab | ComposeWithGitlab) & {
|
interface CloneGitlabRepository {
|
||||||
|
appName: string;
|
||||||
|
gitlabBranch: string | null;
|
||||||
|
gitlabId: string | null;
|
||||||
|
gitlabPathNamespace: string | null;
|
||||||
|
enableSubmodules: boolean;
|
||||||
serverId: string | null;
|
serverId: string | null;
|
||||||
type?: "application" | "compose";
|
type?: "application" | "compose";
|
||||||
};
|
}
|
||||||
|
|
||||||
export const cloneGitlabRepository = async ({
|
export const cloneGitlabRepository = async ({
|
||||||
type = "application",
|
type = "application",
|
||||||
...entity
|
...entity
|
||||||
}: GitlabClone) => {
|
}: CloneGitlabRepository) => {
|
||||||
let command = "set -e;";
|
let command = "set -e;";
|
||||||
const {
|
const {
|
||||||
appName,
|
appName,
|
||||||
|
|||||||
Reference in New Issue
Block a user