Refactor Bitbucket repository cloning logic: remove unused parameter and enhance error handling by retrieving Bitbucket provider directly within the function.

This commit is contained in:
Mauricio Siu
2025-11-09 03:18:07 -06:00
parent 5ac32f9f24
commit f96114ad80

View File

@@ -87,7 +87,6 @@ interface CloneBitbucketRepository {
bitbucketOwner: string | null;
bitbucketBranch: string | null;
bitbucketId: string | null;
bitbucket: Bitbucket | null;
enableSubmodules: boolean;
serverId: string | null;
type?: "application" | "compose";
@@ -104,7 +103,6 @@ export const cloneBitbucketRepository = async ({
bitbucketOwner,
bitbucketBranch,
bitbucketId,
bitbucket,
enableSubmodules,
serverId,
} = entity;
@@ -114,7 +112,12 @@ export const cloneBitbucketRepository = async ({
command += `echo "Error: ❌ Bitbucket Provider not found"; exit 1;`;
return command;
}
const bitbucket = await findBitbucketById(bitbucketId);
if (!bitbucket) {
command += `echo "Error: ❌ Bitbucket Provider not found"; exit 1;`;
return command;
}
const basePath = type === "compose" ? COMPOSE_PATH : APPLICATIONS_PATH;
const outputPath = join(basePath, appName, "code");
command += `rm -rf ${outputPath};`;