mirror of
https://github.com/renovatebot/renovate.git
synced 2025-01-11 22:46:27 +00:00
parent
adf707feea
commit
696f3ec26f
3 changed files with 59 additions and 3 deletions
|
@ -48,9 +48,18 @@ export async function extractPackageFile(
|
||||||
currentValue: dep.version,
|
currentValue: dep.version,
|
||||||
registryUrls: [dep.repository],
|
registryUrls: [dep.repository],
|
||||||
};
|
};
|
||||||
const url = new URL(dep.repository);
|
if (dep.repository.startsWith('@')) {
|
||||||
if (url.protocol === 'file:') {
|
res.skipReason = 'placeholder-url';
|
||||||
res.skipReason = 'local-dependency';
|
} else {
|
||||||
|
try {
|
||||||
|
const url = new URL(dep.repository);
|
||||||
|
if (url.protocol === 'file:') {
|
||||||
|
res.skipReason = 'local-dependency';
|
||||||
|
}
|
||||||
|
} catch (err) {
|
||||||
|
logger.debug({ err }, 'Error parsing url');
|
||||||
|
res.skipReason = 'invalid-url';
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return res;
|
return res;
|
||||||
});
|
});
|
||||||
|
|
|
@ -22,6 +22,30 @@ Object {
|
||||||
}
|
}
|
||||||
`;
|
`;
|
||||||
|
|
||||||
|
exports[`lib/manager/helm/extract extractPackageFile() skips invalid registry urls 1`] = `
|
||||||
|
Object {
|
||||||
|
"datasource": "helm",
|
||||||
|
"deps": Array [
|
||||||
|
Object {
|
||||||
|
"currentValue": "0.9.0",
|
||||||
|
"depName": "redis",
|
||||||
|
"registryUrls": Array [
|
||||||
|
"@placeholder",
|
||||||
|
],
|
||||||
|
"skipReason": "placeholder-url",
|
||||||
|
},
|
||||||
|
Object {
|
||||||
|
"currentValue": "0.8.1",
|
||||||
|
"depName": "postgresql",
|
||||||
|
"registryUrls": Array [
|
||||||
|
"nope",
|
||||||
|
],
|
||||||
|
"skipReason": "invalid-url",
|
||||||
|
},
|
||||||
|
],
|
||||||
|
}
|
||||||
|
`;
|
||||||
|
|
||||||
exports[`lib/manager/helm/extract extractPackageFile() skips local dependencies 1`] = `
|
exports[`lib/manager/helm/extract extractPackageFile() skips local dependencies 1`] = `
|
||||||
Object {
|
Object {
|
||||||
"datasource": "helm",
|
"datasource": "helm",
|
||||||
|
|
|
@ -8,6 +8,29 @@ describe('lib/manager/helm/extract', () => {
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
jest.resetAllMocks();
|
jest.resetAllMocks();
|
||||||
});
|
});
|
||||||
|
it('skips invalid registry urls', async () => {
|
||||||
|
platform.getFile.mockReturnValueOnce(`
|
||||||
|
apiVersion: v1
|
||||||
|
appVersion: "1.0"
|
||||||
|
description: A Helm chart for Kubernetes
|
||||||
|
name: example
|
||||||
|
version: 0.1.0
|
||||||
|
`);
|
||||||
|
const content = `
|
||||||
|
dependencies:
|
||||||
|
- name: redis
|
||||||
|
version: 0.9.0
|
||||||
|
repository: '@placeholder'
|
||||||
|
- name: postgresql
|
||||||
|
version: 0.8.1
|
||||||
|
repository: nope
|
||||||
|
`;
|
||||||
|
const fileName = 'requirements.yaml';
|
||||||
|
const result = await extractPackageFile(content, fileName);
|
||||||
|
expect(result).not.toBeNull();
|
||||||
|
expect(result).toMatchSnapshot();
|
||||||
|
expect(result.deps.every(dep => dep.skipReason));
|
||||||
|
});
|
||||||
it('parses simple requirements.yaml correctly', async () => {
|
it('parses simple requirements.yaml correctly', async () => {
|
||||||
platform.getFile.mockReturnValueOnce(`
|
platform.getFile.mockReturnValueOnce(`
|
||||||
apiVersion: v1
|
apiVersion: v1
|
||||||
|
|
Loading…
Reference in a new issue