integration: GitLab API should be added for default and should have a protocol
This commit is contained in:
@@ -0,0 +1,5 @@
|
||||
---
|
||||
'@backstage/integration': patch
|
||||
---
|
||||
|
||||
Fix GitLab API base URL and add it by default to the gitlab.com host
|
||||
@@ -43,7 +43,18 @@ describe('readGitLabIntegrationConfig', () => {
|
||||
const output = readGitLabIntegrationConfig(buildConfig({}));
|
||||
expect(output).toEqual({
|
||||
host: 'gitlab.com',
|
||||
apiBaseUrl: 'gitlab.com/api/v4',
|
||||
apiBaseUrl: 'https://gitlab.com/api/v4',
|
||||
});
|
||||
});
|
||||
|
||||
it('injects the correct GitLab API base URL when missing', () => {
|
||||
const output = readGitLabIntegrationConfig(
|
||||
buildConfig({ host: 'gitlab.com' }),
|
||||
);
|
||||
|
||||
expect(output).toEqual({
|
||||
host: 'gitlab.com',
|
||||
apiBaseUrl: 'https://gitlab.com/api/v4',
|
||||
});
|
||||
});
|
||||
|
||||
@@ -86,6 +97,7 @@ describe('readGitLabIntegrationConfigs', () => {
|
||||
expect(output).toEqual([
|
||||
{
|
||||
host: 'gitlab.com',
|
||||
apiBaseUrl: 'https://gitlab.com/api/v4',
|
||||
},
|
||||
]);
|
||||
});
|
||||
|
||||
@@ -18,7 +18,7 @@ import { Config } from '@backstage/config';
|
||||
import { isValidHost } from '../helpers';
|
||||
|
||||
const GITLAB_HOST = 'gitlab.com';
|
||||
const GITLAB_API_BASE_URL = 'gitlab.com/api/v4';
|
||||
const GITLAB_API_BASE_URL = 'https://gitlab.com/api/v4';
|
||||
|
||||
/**
|
||||
* The configuration parameters for a single GitLab integration.
|
||||
@@ -89,7 +89,7 @@ export function readGitLabIntegrationConfigs(
|
||||
// As a convenience we always make sure there's at least an unauthenticated
|
||||
// reader for public gitlab repos.
|
||||
if (!result.some(c => c.host === GITLAB_HOST)) {
|
||||
result.push({ host: GITLAB_HOST });
|
||||
result.push({ host: GITLAB_HOST, apiBaseUrl: GITLAB_API_BASE_URL });
|
||||
}
|
||||
|
||||
return result;
|
||||
|
||||
Reference in New Issue
Block a user