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,10 +48,19 @@ export async function extractPackageFile(
|
|||
currentValue: dep.version,
|
||||
registryUrls: [dep.repository],
|
||||
};
|
||||
if (dep.repository.startsWith('@')) {
|
||||
res.skipReason = 'placeholder-url';
|
||||
} 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;
|
||||
});
|
||||
const 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`] = `
|
||||
Object {
|
||||
"datasource": "helm",
|
||||
|
|
|
@ -8,6 +8,29 @@ describe('lib/manager/helm/extract', () => {
|
|||
beforeEach(() => {
|
||||
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 () => {
|
||||
platform.getFile.mockReturnValueOnce(`
|
||||
apiVersion: v1
|
||||
|
|
Loading…
Reference in a new issue