From 1ec83a323685ee81c2488648cf1df1c39b08a0fe Mon Sep 17 00:00:00 2001 From: Mauricio Siu <47042324+Siumauricio@users.noreply.github.com> Date: Mon, 21 Oct 2024 21:14:40 -0600 Subject: [PATCH] feat(dokploy): add recurse submodules to providers #331 --- packages/server/src/utils/providers/bitbucket.ts | 6 ++++-- packages/server/src/utils/providers/git.ts | 5 +++-- packages/server/src/utils/providers/github.ts | 4 +++- packages/server/src/utils/providers/gitlab.ts | 6 ++++-- 4 files changed, 14 insertions(+), 7 deletions(-) diff --git a/packages/server/src/utils/providers/bitbucket.ts b/packages/server/src/utils/providers/bitbucket.ts index 8bf421c7..bcf6ca6d 100644 --- a/packages/server/src/utils/providers/bitbucket.ts +++ b/packages/server/src/utils/providers/bitbucket.ts @@ -61,6 +61,7 @@ export const cloneBitbucketRepository = async ( bitbucketBranch!, "--depth", "1", + "--recurse-submodules", cloneUrl, outputPath, "--progress", @@ -111,6 +112,7 @@ export const cloneRawBitbucketRepository = async (entity: Compose) => { bitbucketBranch!, "--depth", "1", + "--recurse-submodules", cloneUrl, outputPath, "--progress", @@ -153,7 +155,7 @@ export const cloneRawBitbucketRepositoryRemote = async (compose: Compose) => { try { const command = ` rm -rf ${outputPath}; - git clone --branch ${bitbucketBranch} --depth 1 ${cloneUrl} ${outputPath} + git clone --branch ${bitbucketBranch} --depth 1 --recurse-submodules ${cloneUrl} ${outputPath} `; await execAsyncRemote(serverId, command); } catch (error) { @@ -206,7 +208,7 @@ export const getBitbucketCloneCommand = async ( const cloneCommand = ` rm -rf ${outputPath}; mkdir -p ${outputPath}; -if ! git clone --branch ${bitbucketBranch} --depth 1 --progress ${cloneUrl} ${outputPath} >> ${logPath} 2>&1; then +if ! git clone --branch ${bitbucketBranch} --depth 1 --recurse-submodules --progress ${cloneUrl} ${outputPath} >> ${logPath} 2>&1; then echo "❌ [ERROR] Fail to clone the repository ${repoclone}" >> ${logPath}; exit 1; fi diff --git a/packages/server/src/utils/providers/git.ts b/packages/server/src/utils/providers/git.ts index 4553ffe6..8622879f 100644 --- a/packages/server/src/utils/providers/git.ts +++ b/packages/server/src/utils/providers/git.ts @@ -178,7 +178,7 @@ export const getCustomGitCloneCommand = async ( } command.push( - `if ! git clone --branch ${customGitBranch} --depth 1 --progress ${customGitUrl} ${outputPath} >> ${logPath} 2>&1; then + `if ! git clone --branch ${customGitBranch} --depth 1 --recurse-submodules --progress ${customGitUrl} ${outputPath} >> ${logPath} 2>&1; then echo "❌ [ERROR] Fail to clone the repository ${customGitUrl}" >> ${logPath}; exit 1; fi @@ -312,6 +312,7 @@ export const cloneGitRawRepository = async (entity: { customGitBranch, "--depth", "1", + "--recurse-submodules", customGitUrl, outputPath, "--progress", @@ -391,7 +392,7 @@ export const cloneRawGitRepositoryRemote = async (compose: Compose) => { } command.push( - `if ! git clone --branch ${customGitBranch} --depth 1 --progress ${customGitUrl} ${outputPath} ; then + `if ! git clone --branch ${customGitBranch} --depth 1 --recurse-submodules --progress ${customGitUrl} ${outputPath} ; then echo "[ERROR] Fail to clone the repository "; exit 1; fi diff --git a/packages/server/src/utils/providers/github.ts b/packages/server/src/utils/providers/github.ts index abd704d8..9062df85 100644 --- a/packages/server/src/utils/providers/github.ts +++ b/packages/server/src/utils/providers/github.ts @@ -125,6 +125,7 @@ export const cloneGithubRepository = async ( branch!, "--depth", "1", + "--recurse-submodules", cloneUrl, outputPath, "--progress", @@ -204,7 +205,7 @@ export const getGithubCloneCommand = async ( const cloneCommand = ` rm -rf ${outputPath}; mkdir -p ${outputPath}; -if ! git clone --branch ${branch} --depth 1 --progress ${cloneUrl} ${outputPath} >> ${logPath} 2>&1; then +if ! git clone --branch ${branch} --depth 1 --recurse-submodules --progress ${cloneUrl} ${outputPath} >> ${logPath} 2>&1; then echo "❌ [ERROR] Fallo al clonar el repositorio ${repoclone}" >> ${logPath}; exit 1; fi @@ -239,6 +240,7 @@ export const cloneRawGithubRepository = async (entity: Compose) => { branch!, "--depth", "1", + "--recurse-submodules", cloneUrl, outputPath, "--progress", diff --git a/packages/server/src/utils/providers/gitlab.ts b/packages/server/src/utils/providers/gitlab.ts index 4164ee19..34036167 100644 --- a/packages/server/src/utils/providers/gitlab.ts +++ b/packages/server/src/utils/providers/gitlab.ts @@ -137,6 +137,7 @@ export const cloneGitlabRepository = async ( gitlabBranch!, "--depth", "1", + "--recurse-submodules", cloneUrl, outputPath, "--progress", @@ -225,7 +226,7 @@ export const getGitlabCloneCommand = async ( const cloneCommand = ` rm -rf ${outputPath}; mkdir -p ${outputPath}; -if ! git clone --branch ${gitlabBranch} --depth 1 --progress ${cloneUrl} ${outputPath} >> ${logPath} 2>&1; then +if ! git clone --branch ${gitlabBranch} --depth 1 --recurse-submodules --progress ${cloneUrl} ${outputPath} >> ${logPath} 2>&1; then echo "❌ [ERROR] Fail to clone the repository ${repoclone}" >> ${logPath}; exit 1; fi @@ -361,6 +362,7 @@ export const cloneRawGitlabRepository = async (entity: Compose) => { gitlabBranch!, "--depth", "1", + "--recurse-submodules", cloneUrl, outputPath, "--progress", @@ -395,7 +397,7 @@ export const cloneRawGitlabRepositoryRemote = async (compose: Compose) => { try { const command = ` rm -rf ${outputPath}; - git clone --branch ${branch} --depth 1 ${cloneUrl} ${outputPath} + git clone --branch ${branch} --depth 1 --recurse-submodules ${cloneUrl} ${outputPath} `; await execAsyncRemote(serverId, command); } catch (error) {