techdocs-backend: update Gitlab clone auth

This commit is contained in:
Chongyang Adrian, Ke
2020-11-19 10:46:02 +08:00
parent 74b9561a2b
commit ae95c7ff3e
2 changed files with 17 additions and 2 deletions
+5
View File
@@ -0,0 +1,5 @@
---
'@backstage/plugin-techdocs-backend': patch
---
Update URL auth format for Gitlab clone
+12 -2
View File
@@ -146,8 +146,18 @@ export const checkoutGitRepository = async (
if (token) {
const type = getGitRepoType(repoUrl);
const auth = type === 'github' ? `${token}:x-oauth-basic` : `:${token}`;
parsedGitLocation.token = auth;
switch (type) {
case 'gitlab':
// Personal Access Token
parsedGitLocation.token = `dummyUsername:${token}`;
parsedGitLocation.git_suffix = true;
break;
case 'github':
parsedGitLocation.token = `${token}:x-oauth-basic`;
break;
default:
parsedGitLocation.token = `:${token}`;
}
}
const repositoryCheckoutUrl = parsedGitLocation.toString('https');