mirror of
https://github.com/renovatebot/renovate.git
synced 2025-01-13 15:36:25 +00:00
Support git over https without username for pip_requirements (#15231)
This commit is contained in:
parent
d288f1409e
commit
3fe66407f1
3 changed files with 25 additions and 10 deletions
|
@ -2,3 +2,4 @@ git+ssh://git@github.com/rwxd/python-pip-setup-test.git@v1.1.0
|
||||||
git+ssh://git@github.com/rwxd/test_package@1.0.0
|
git+ssh://git@github.com/rwxd/test_package@1.0.0
|
||||||
git+ssh://git@gitlab.company.com/rwxd/python-package.git@abcde
|
git+ssh://git@gitlab.company.com/rwxd/python-package.git@abcde
|
||||||
git+https://peter@github.com/rwxd/python-pip-setup-test.git@v0.9.0
|
git+https://peter@github.com/rwxd/python-pip-setup-test.git@v0.9.0
|
||||||
|
git+https://github.com/rwxd/python-pip-setup-test.git@v0.9.0
|
||||||
|
|
|
@ -181,7 +181,7 @@ describe('modules/manager/pip_requirements/extract', () => {
|
||||||
'unused_file_name',
|
'unused_file_name',
|
||||||
{}
|
{}
|
||||||
);
|
);
|
||||||
expect(res.deps).toHaveLength(4);
|
expect(res.deps).toHaveLength(5);
|
||||||
expect(res).toEqual({
|
expect(res).toEqual({
|
||||||
deps: [
|
deps: [
|
||||||
{
|
{
|
||||||
|
@ -209,7 +209,15 @@ describe('modules/manager/pip_requirements/extract', () => {
|
||||||
depName: 'python-pip-setup-test',
|
depName: 'python-pip-setup-test',
|
||||||
currentValue: 'v0.9.0',
|
currentValue: 'v0.9.0',
|
||||||
currentVersion: 'v0.9.0',
|
currentVersion: 'v0.9.0',
|
||||||
packageName: 'peter@github.com:rwxd/python-pip-setup-test.git',
|
packageName:
|
||||||
|
'https://peter@github.com/rwxd/python-pip-setup-test.git',
|
||||||
|
datasource: 'git-tags',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
depName: 'python-pip-setup-test',
|
||||||
|
currentValue: 'v0.9.0',
|
||||||
|
currentVersion: 'v0.9.0',
|
||||||
|
packageName: 'https://github.com/rwxd/python-pip-setup-test.git',
|
||||||
datasource: 'git-tags',
|
datasource: 'git-tags',
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
|
|
|
@ -13,7 +13,7 @@ export const packagePattern =
|
||||||
'[a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9._-]*[a-zA-Z0-9]';
|
'[a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9._-]*[a-zA-Z0-9]';
|
||||||
const extrasPattern = '(?:\\s*\\[[^\\]]+\\])?';
|
const extrasPattern = '(?:\\s*\\[[^\\]]+\\])?';
|
||||||
const packageGitRegex = regEx(
|
const packageGitRegex = regEx(
|
||||||
/(?<source>(?:git\+)(git|ssh|https):\/\/(?<gitUrl>(?<user>.*)@(?<hostname>[\w.-]+)(?<delimiter>\/)(?<scmPath>.*\/(?<depName>[\w/-]+))(\.git)?(?:@(?<version>.*))))/
|
/(?<source>(?:git\+)(?<protocol>git|ssh|https):\/\/(?<gitUrl>(?:(?<user>[^@]+)@)?(?<hostname>[\w.-]+)(?<delimiter>\/)(?<scmPath>.*\/(?<depName>[\w/-]+))(\.git)?(?:@(?<version>.*))))/
|
||||||
);
|
);
|
||||||
|
|
||||||
const rangePattern: string = RANGE_PATTERN;
|
const rangePattern: string = RANGE_PATTERN;
|
||||||
|
@ -78,13 +78,19 @@ export function extractPackageFile(
|
||||||
if (gitPackageMatches?.groups) {
|
if (gitPackageMatches?.groups) {
|
||||||
const currentVersion = gitPackageMatches.groups.version;
|
const currentVersion = gitPackageMatches.groups.version;
|
||||||
const depName = gitPackageMatches.groups.depName;
|
const depName = gitPackageMatches.groups.depName;
|
||||||
|
let packageName: string;
|
||||||
// we need to replace the / with a :
|
if (gitPackageMatches.groups.protocol === 'https') {
|
||||||
const scmPath = gitPackageMatches.groups.scmPath;
|
packageName = 'https://'
|
||||||
const delimiter = gitPackageMatches.groups.delimiter;
|
.concat(gitPackageMatches.groups.gitUrl)
|
||||||
const packageName = gitPackageMatches.groups.gitUrl
|
.replace(`@${currentVersion}`, '');
|
||||||
.replace(`${delimiter}${scmPath}`, `:${scmPath}`)
|
} else {
|
||||||
.replace(`@${currentVersion}`, '');
|
// we need to replace the / with a :
|
||||||
|
const scmPath = gitPackageMatches.groups.scmPath;
|
||||||
|
const delimiter = gitPackageMatches.groups.delimiter;
|
||||||
|
packageName = gitPackageMatches.groups.gitUrl
|
||||||
|
.replace(`${delimiter}${scmPath}`, `:${scmPath}`)
|
||||||
|
.replace(`@${currentVersion}`, '');
|
||||||
|
}
|
||||||
dep = {
|
dep = {
|
||||||
...dep,
|
...dep,
|
||||||
depName,
|
depName,
|
||||||
|
|
Loading…
Reference in a new issue