Merge pull request #804 from titouanmathis/feat/git-source-custom-user

feat(git-source): Add support for custom SSH user for GitLab self-hosted
This commit is contained in:
Andras Bacsai
2023-01-10 11:17:01 +01:00
committed by GitHub
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
}
);
}