Add support for custom SSH user for GitLab self-hosted

This commit is contained in:
Titouan Mathis
2022-12-21 14:55:13 +01:00
parent f38114f5a5
commit 2391850218
8 changed files with 63 additions and 10 deletions

View File

@@ -12,7 +12,8 @@ export default async function ({
buildId,
privateSshKey,
customPort,
forPublic
forPublic,
customUser,
}: {
applicationId: string;
workdir: string;
@@ -25,6 +26,7 @@ export default async function ({
privateSshKey: string;
customPort: number;
forPublic: boolean;
customUser: string;
}): Promise<string> {
const url = htmlUrl.replace('https://', '').replace('http://', '').replace(/\/$/, '');
if (!forPublic) {
@@ -53,7 +55,7 @@ export default async function ({
} else {
await executeCommand({
command:
`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 .. `, shell: true
`git clone -q -b ${branch} ${customUser}@${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 .. `, shell: true
}
);
}