Skip to content

Commit

Permalink
fix(gomod): explicitly match Gitlab ID for gitlab enterprise servers
Browse files Browse the repository at this point in the history
  • Loading branch information
bastianccm committed Sep 4, 2022
1 parent 5dc1eb3 commit e1d2a5c
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 10 deletions.
11 changes: 6 additions & 5 deletions lib/modules/datasource/go/base.spec.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { Fixtures } from '../../../../test/fixtures';
import * as httpMock from '../../../../test/http-mock';
import { mocked } from '../../../../test/util';
import { PlatformId } from '../../../constants';
import * as _hostRules from '../../../util/host-rules';
import { GithubTagsDatasource } from '../github-tags';
import { GitlabTagsDatasource } from '../gitlab-tags';
Expand Down Expand Up @@ -202,7 +203,7 @@ describe('modules/datasource/go/base', () => {
});

it('supports GitLab EE deps', async () => {
hostRules.find.mockReturnValue({ token: 'some-token' });
hostRules.hostType.mockReturnValue(PlatformId.Gitlab);
httpMock
.scope('https://my.custom.domain')
.get('/golang/myrepo?go-get=1')
Expand All @@ -220,7 +221,7 @@ describe('modules/datasource/go/base', () => {
});

it('supports GitLab EE deps in subgroup', async () => {
hostRules.find.mockReturnValue({ token: 'some-token' });
hostRules.hostType.mockReturnValue(PlatformId.Gitlab);
httpMock
.scope('https://my.custom.domain')
.get('/golang/subgroup/myrepo?go-get=1')
Expand All @@ -238,7 +239,7 @@ describe('modules/datasource/go/base', () => {
});

it('supports GitLab EE deps in subgroup with version', async () => {
hostRules.find.mockReturnValue({ token: 'some-token' });
hostRules.hostType.mockReturnValue(PlatformId.Gitlab);
httpMock
.scope('https://my.custom.domain')
.get('/golang/subgroup/myrepo/v2?go-get=1')
Expand All @@ -256,7 +257,7 @@ describe('modules/datasource/go/base', () => {
});

it('supports GitLab EE deps in private subgroup with vcs indicator', async () => {
hostRules.find.mockReturnValue({ token: 'some-token' });
hostRules.hostType.mockReturnValue(PlatformId.Gitlab);
httpMock
.scope('https://my.custom.domain')
.get('/golang/subgroup/myrepo.git/v2?go-get=1')
Expand All @@ -274,7 +275,7 @@ describe('modules/datasource/go/base', () => {
});

it('supports GitLab EE monorepo deps in subgroup', async () => {
hostRules.find.mockReturnValue({ token: 'some-token' });
hostRules.hostType.mockReturnValue(PlatformId.Gitlab);
httpMock
.scope('https://my.custom.domain')
.get('/golang/subgroup/myrepo/monorepo?go-get=1')
Expand Down
6 changes: 1 addition & 5 deletions lib/modules/datasource/go/base.ts
Original file line number Diff line number Diff line change
Expand Up @@ -137,11 +137,7 @@ export class BaseGoDatasource {
};
}

const opts = hostRules.find({
hostType: PlatformId.Gitlab,
url: goSourceUrl,
});
if (opts.token) {
if (hostRules.hostType({ url: goSourceUrl }) === PlatformId.Gitlab) {
// get server base url from import url
const parsedUrl = URL.parse(goSourceUrl);

Expand Down

0 comments on commit e1d2a5c

Please sign in to comment.