From 2790895642017f5fc7e07a16d4d3835a02d79aa8 Mon Sep 17 00:00:00 2001 From: Mauricio Siu <47042324+Siumauricio@users.noreply.github.com> Date: Sat, 2 Aug 2025 21:20:50 -0600 Subject: [PATCH 1/2] refactor(gitea, gitlab): remove unused parameters and fetch entities by ID --- packages/server/src/utils/providers/gitea.ts | 4 ++-- packages/server/src/utils/providers/gitlab.ts | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/packages/server/src/utils/providers/gitea.ts b/packages/server/src/utils/providers/gitea.ts index bbd8ed1b4..21265bf37 100644 --- a/packages/server/src/utils/providers/gitea.ts +++ b/packages/server/src/utils/providers/gitea.ts @@ -3,8 +3,8 @@ import { join } from "node:path"; import { paths } from "@dokploy/server/constants"; import type { Compose } from "@dokploy/server/services/compose"; import { - type Gitea, findGiteaById, + type Gitea, updateGitea, } from "@dokploy/server/services/gitea"; import type { InferResultType } from "@dokploy/server/types/with"; @@ -118,7 +118,6 @@ export const getGiteaCloneCommand = async ( giteaOwner, giteaRepository, serverId, - gitea, enableSubmodules, } = entity; @@ -145,6 +144,7 @@ export const getGiteaCloneCommand = async ( // Use paths(true) for remote operations const { COMPOSE_PATH, APPLICATIONS_PATH } = paths(true); await refreshGiteaToken(giteaId); + const gitea = await findGiteaById(giteaId); const basePath = isCompose ? COMPOSE_PATH : APPLICATIONS_PATH; const outputPath = join(basePath, appName, "code"); diff --git a/packages/server/src/utils/providers/gitlab.ts b/packages/server/src/utils/providers/gitlab.ts index 774cd818f..65a09d248 100644 --- a/packages/server/src/utils/providers/gitlab.ts +++ b/packages/server/src/utils/providers/gitlab.ts @@ -112,7 +112,6 @@ export const cloneGitlabRepository = async ( appName, gitlabBranch, gitlabId, - gitlab, gitlabPathNamespace, enableSubmodules, } = entity; @@ -125,6 +124,7 @@ export const cloneGitlabRepository = async ( } await refreshGitlabToken(gitlabId); + const gitlab = await findGitlabById(gitlabId); const requirements = getErrorCloneRequirements(entity); @@ -187,7 +187,6 @@ export const getGitlabCloneCommand = async ( gitlabBranch, gitlabId, serverId, - gitlab, enableSubmodules, } = entity; @@ -235,6 +234,7 @@ export const getGitlabCloneCommand = async ( const { COMPOSE_PATH, APPLICATIONS_PATH } = paths(true); await refreshGitlabToken(gitlabId); + const gitlab = await findGitlabById(gitlabId); const basePath = isCompose ? COMPOSE_PATH : APPLICATIONS_PATH; const outputPath = join(basePath, appName, "code"); await recreateDirectory(outputPath); From b9f18cddf7d3262d0b6f9bd8838ceac793125f01 Mon Sep 17 00:00:00 2001 From: Mauricio Siu <47042324+Siumauricio@users.noreply.github.com> Date: Sat, 2 Aug 2025 21:24:33 -0600 Subject: [PATCH 2/2] refactor(gitlab): reorder token refresh and provider fetching for improved clarity --- packages/server/src/utils/providers/gitlab.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/server/src/utils/providers/gitlab.ts b/packages/server/src/utils/providers/gitlab.ts index 65a09d248..f68bd3be7 100644 --- a/packages/server/src/utils/providers/gitlab.ts +++ b/packages/server/src/utils/providers/gitlab.ts @@ -371,9 +371,9 @@ export const cloneRawGitlabRepository = async (entity: Compose) => { }); } - const gitlabProvider = await findGitlabById(gitlabId); const { COMPOSE_PATH } = paths(); await refreshGitlabToken(gitlabId); + const gitlabProvider = await findGitlabById(gitlabId); const basePath = COMPOSE_PATH; const outputPath = join(basePath, appName, "code"); await recreateDirectory(outputPath); @@ -419,9 +419,9 @@ export const cloneRawGitlabRepositoryRemote = async (compose: Compose) => { message: "Gitlab Provider not found", }); } - const gitlabProvider = await findGitlabById(gitlabId); const { COMPOSE_PATH } = paths(true); await refreshGitlabToken(gitlabId); + const gitlabProvider = await findGitlabById(gitlabId); const basePath = COMPOSE_PATH; const outputPath = join(basePath, appName, "code"); const repoClone = getGitlabRepoClone(gitlabProvider, gitlabPathNamespace);