From ae95c7ff3e617be3b0322a4fba09e74fd9dfd7fe Mon Sep 17 00:00:00 2001 From: "Chongyang Adrian, Ke" Date: Thu, 19 Nov 2020 10:46:02 +0800 Subject: [PATCH] techdocs-backend: update Gitlab clone auth --- .changeset/famous-items-travel.md | 5 +++++ plugins/techdocs-backend/src/helpers.ts | 14 ++++++++++++-- 2 files changed, 17 insertions(+), 2 deletions(-) create mode 100644 .changeset/famous-items-travel.md diff --git a/.changeset/famous-items-travel.md b/.changeset/famous-items-travel.md new file mode 100644 index 0000000000..a0aa02732d --- /dev/null +++ b/.changeset/famous-items-travel.md @@ -0,0 +1,5 @@ +--- +'@backstage/plugin-techdocs-backend': patch +--- + +Update URL auth format for Gitlab clone diff --git a/plugins/techdocs-backend/src/helpers.ts b/plugins/techdocs-backend/src/helpers.ts index 901aea533a..fcf5a4f194 100644 --- a/plugins/techdocs-backend/src/helpers.ts +++ b/plugins/techdocs-backend/src/helpers.ts @@ -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');