Skip to content

An open-source, self-hostable PaaS alternative to Vercel, Heroku & Netlify that lets you easily deploy static sites, databases, full-stack applications and 360+ one-click services on your own servers.

feature: add default to latest commit and support for gitlab

ThallesPe038865693ea
diff --git a/apps/api/src/lib/importers/github.ts b/apps/api/src/lib/importers/github.ts
index 8e62f442c0..f310c47049 100644
--- a/apps/api/src/lib/importers/github.ts
+++ b/apps/api/src/lib/importers/github.ts
@@ -38,7 +38,7 @@ export default async function ({
applicationId
});
await asyncExecShell(
- `git clone -q -b ${branch} https://${url}/${repository}.git ${workdir}/ && cd ${workdir} && git checkout ${gitCommitHash} && git submodule update --init --recursive && git lfs pull && cd .. `
+ `git clone -q -b ${branch} https://${url}/${repository}.git ${workdir}/ && cd ${workdir} && git checkout ${gitCommitHash || "-"} && git submodule update --init --recursive && git lfs pull && cd .. `
);
} else {
@@ -69,7 +69,7 @@ export default async function ({
applicationId
});
await asyncExecShell(
- `git clone -q -b ${branch} https://x-access-token:${token}@${url}/${repository}.git --config core.sshCommand="ssh -p ${customPort}" ${workdir}/ && cd ${workdir} && git submodule update --init --recursive && git lfs pull && cd .. `
+ `git clone -q -b ${branch} https://x-access-token:${token}@${url}/${repository}.git --config core.sshCommand="ssh -p ${customPort}" ${workdir}/ && cd ${workdir} && git checkout ${gitCommitHash || "-"} && git submodule update --init --recursive && git lfs pull && cd .. `
);
}
const { stdout: commit } = await asyncExecShell(`cd ${workdir}/ && git rev-parse HEAD`);
diff --git a/apps/api/src/lib/importers/gitlab.ts b/apps/api/src/lib/importers/gitlab.ts
index 35fa3d8ce6..051e2a9d75 100644
--- a/apps/api/src/lib/importers/gitlab.ts
+++ b/apps/api/src/lib/importers/gitlab.ts
@@ -6,6 +6,7 @@ export default async function ({
workdir,
repodir,
htmlUrl,
+ gitCommitHash,
repository,
branch,
buildId,
@@ -20,6 +21,7 @@ export default async function ({
branch: string;
buildId: string;
repodir: string;
+ gitCommitHash: string;
privateSshKey: string;
customPort: number;
forPublic: boolean;
@@ -40,11 +42,11 @@ export default async function ({
if (forPublic) {
await asyncExecShell(
- `git clone -q -b ${branch} https://${url}/${repository}.git ${workdir}/ && cd ${workdir}/ && git submodule update --init --recursive && git lfs pull && cd .. `
+ `git clone -q -b ${branch} https://${url}/${repository}.git ${workdir}/ && cd ${workdir}/ && git checkout ${gitCommitHash || "-"} && git submodule update --init --recursive && git lfs pull && cd .. `
);
} else {
await asyncExecShell(
- `git clone -q -b ${branch} git@${url}:${repository}.git --config core.sshCommand="ssh -p ${customPort} -q -i ${repodir}id.rsa -o StrictHostKeyChecking=no" ${workdir}/ && cd ${workdir}/ && git submodule update --init --recursive && git lfs pull && cd .. `
+ `git clone -q -b ${branch} git@${url}:${repository}.git --config core.sshCommand="ssh -p ${customPort} -q -i ${repodir}id.rsa -o StrictHostKeyChecking=no" ${workdir}/ && cd ${workdir}/ && git checkout ${gitCommitHash || "-"} && git submodule update --init --recursive && git lfs pull && cd .. `
);
}