Skip to content
Snippets Groups Projects
Unverified Commit c8c0e1b4 authored by gone-for-coding's avatar gone-for-coding Committed by GitHub
Browse files

fix(pre-commit): Gitlab Custom RegistryUrl not honored (#25682)


Co-authored-by: default avatarRhys Arkins <rhys@arkins.net>
parent 53401eb3
No related branches found
No related tags found
No related merge requests found
......@@ -23,6 +23,16 @@ repos:
rev: 19.3b0
hooks:
- id: black
- repo: https://gitlab.mycompany.com/my/dep
# should also detect custom gitlab registry
rev: v42.0
hooks:
- id: custom-hook
- repo: https://gitlab.mycompany.com/my/dep
# should also detect http for custom gitlab registry
rev: v42.0
hooks:
- id: custom-hook
- repo: https://github.com/prettier/pre-commit
# should accept different order of keys
hooks:
......
......@@ -31,6 +31,26 @@ exports[`modules/manager/pre-commit/extract extractPackageFile() extracts from c
"depType": "repository",
"packageName": "psf/black",
},
{
"currentValue": "v42.0",
"datasource": "gitlab-tags",
"depName": "my/dep",
"depType": "repository",
"packageName": "my/dep",
"registryUrls": [
"https://gitlab.mycompany.com",
],
},
{
"currentValue": "v42.0",
"datasource": "gitlab-tags",
"depName": "my/dep",
"depType": "repository",
"packageName": "my/dep",
"registryUrls": [
"https://gitlab.mycompany.com",
],
},
{
"currentValue": "v2.1.2",
"datasource": "github-tags",
......
......@@ -84,6 +84,16 @@ describe('modules/manager/pre-commit/extract', () => {
{ depName: 'psf/black', currentValue: '19.3b0' },
{ depName: 'psf/black', currentValue: '19.3b0' },
{ depName: 'psf/black', currentValue: '19.3b0' },
{
depName: 'my/dep',
currentValue: 'v42.0',
registryUrls: ['https://gitlab.mycompany.com'],
},
{
depName: 'my/dep',
currentValue: 'v42.0',
registryUrls: ['https://gitlab.mycompany.com'],
},
{ depName: 'prettier/pre-commit', currentValue: 'v2.1.2' },
{ depName: 'prettier/pre-commit', currentValue: 'v2.1.2' },
{ skipReason: 'invalid-url' },
......
......@@ -32,10 +32,20 @@ function determineDatasource(
logger.debug({ repository, hostname }, 'Found github dependency');
return { datasource: GithubTagsDatasource.id };
}
if (hostname === 'gitlab.com' || detectPlatform(repository) === 'gitlab') {
if (hostname === 'gitlab.com') {
logger.debug({ repository, hostname }, 'Found gitlab dependency');
return { datasource: GitlabTagsDatasource.id };
}
if (detectPlatform(repository) === 'gitlab') {
logger.debug(
{ repository, hostname },
'Found gitlab dependency with custom registryUrl',
);
return {
datasource: GitlabTagsDatasource.id,
registryUrls: ['https://' + hostname],
};
}
const hostUrl = 'https://' + hostname;
const res = find({ url: hostUrl });
if (is.emptyObject(res)) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment