Merge pull request #9584 from ItzEdgar/gitlab-selfhosted-fix

Updated gitlab integration to include port
This commit is contained in:
Ben Lambert
2022-02-18 11:35:58 +01:00
committed by GitHub
3 changed files with 7 additions and 6 deletions
+5
View File
@@ -0,0 +1,5 @@
---
'@backstage/integration': patch
---
Fixed bug in integration package where Self Hosted GitLab instances with custom ports weren't supported (because of the lack of an option to add the port in the integration configs. Now users can add the port directly in the host)
+1 -5
View File
@@ -82,11 +82,7 @@ export function readGitLabIntegrationConfig(
baseUrl = `https://${host}`;
}
if (host.includes(':')) {
throw new Error(
`Invalid GitLab integration config, host '${host}' should just be the host name (e.g. "github.com"), not a URL`,
);
} else if (!isValidHost(host)) {
if (!isValidHost(host)) {
throw new Error(
`Invalid GitLab integration config, '${host}' is not a valid host`,
);
+1 -1
View File
@@ -138,7 +138,7 @@ export async function getProjectId(
// Convert
// to: https://gitlab.com/api/v4/projects/groupA%2Fteams%2FsubgroupA%2FteamA%2Frepo
const repoIDLookup = new URL(
`${url.protocol + url.hostname}/api/v4/projects/${encodeURIComponent(
`${url.origin}/api/v4/projects/${encodeURIComponent(
repo.replace(/^\//, ''),
)}`,
);