Skip to content
Snippets Groups Projects
Unverified Commit 158fa38a authored by Manuel Blechschmidt's avatar Manuel Blechschmidt Committed by GitHub
Browse files

fix(datasource/go): don't strip `api/` from `packageName` on gitlab (#27635)

parent 88860db2
No related branches found
No related tags found
No related merge requests found
<html>
<head>
<meta name="go-import"
content="my.custom.domain/group/subgroup-api/myrepo git https://my.custom.domain/group/subgroup-api/myrepo.git" />
<meta name="go-source"
content="my.custom.domain/group/subgroup-api/myrepo https://my.custom.domain/group/subgroup-api/myrepo https://my.custom.domain/group/subgroup-api/myrepo/-/tree/master{/dir} https://my.custom.domain/group/subgroup-api/myrepo/-/blob/master{/dir}/{file}#L{line}" />
</head>
<body>go get https://my.custom.domain/group/subgroup-api/myrepo</body>
</html>
......@@ -240,6 +240,29 @@ describe('modules/datasource/go/base', () => {
});
});
it('supports GitLab EE deps in private subgroup with api/ as part of packageName and api/v4 as part of endpoint', async () => {
GlobalConfig.set({ endpoint: 'https://my.custom.domain/api/v4' });
hostRules.hostType.mockReturnValue('gitlab');
httpMock
.scope('https://my.custom.domain')
.get('/group/subgroup-api/myrepo?go-get=1')
.reply(
200,
Fixtures.get('go-get-gitlab-ee-private-subgroup-api.html'),
);
const res = await BaseGoDatasource.getDatasource(
'my.custom.domain/group/subgroup-api/myrepo',
);
expect(res).toEqual({
datasource: GitlabTagsDatasource.id,
packageName: 'group/subgroup-api/myrepo',
registryUrl: 'https://my.custom.domain/',
});
});
it('supports GitLab EE deps in subgroup with version', async () => {
hostRules.hostType.mockReturnValue('gitlab');
httpMock
......
......@@ -184,7 +184,7 @@ export class BaseGoDatasource {
endpoint,
);
if (endpointPrefix) {
if (endpointPrefix && endpointPrefix[1] !== 'api/') {
packageName = packageName.replace(endpointPrefix[1], '');
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment