mirror of
https://github.com/renovatebot/renovate.git
synced 2025-01-12 06:56:24 +00:00
feat: kustomize: support newName
in image
(#7356)
This commit is contained in:
parent
9fe6b99d9c
commit
27a280ff81
4 changed files with 16 additions and 17 deletions
|
@ -15,3 +15,6 @@ images:
|
|||
newTag: v0.0.2
|
||||
- name: gitlab.com/org/suborg/image
|
||||
newTag: v0.0.3
|
||||
- name: this-lives/on-docker-hub
|
||||
newName: but.this.lives.on.local/private-registry # and therefore we need to check the versions available here
|
||||
newTag: v0.0.4
|
||||
|
|
|
@ -79,25 +79,26 @@ Array [
|
|||
"currentValue": "v0.1.0",
|
||||
"datasource": "docker",
|
||||
"depName": "node",
|
||||
"lookupName": "node",
|
||||
},
|
||||
Object {
|
||||
"currentValue": "v0.0.1",
|
||||
"datasource": "docker",
|
||||
"depName": "group/instance",
|
||||
"lookupName": "group/instance",
|
||||
},
|
||||
Object {
|
||||
"currentValue": "v0.0.2",
|
||||
"datasource": "docker",
|
||||
"depName": "quay.io/test/repo",
|
||||
"lookupName": "quay.io/test/repo",
|
||||
},
|
||||
Object {
|
||||
"currentValue": "v0.0.3",
|
||||
"datasource": "docker",
|
||||
"depName": "gitlab.com/org/suborg/image",
|
||||
"lookupName": "gitlab.com/org/suborg/image",
|
||||
},
|
||||
Object {
|
||||
"currentValue": "v0.0.4",
|
||||
"datasource": "docker",
|
||||
"depName": "but.this.lives.on.local/private-registry",
|
||||
},
|
||||
]
|
||||
`;
|
||||
|
|
|
@ -130,10 +130,9 @@ describe('manager/kustomize/extract', () => {
|
|||
currentValue: 'v1.0.0',
|
||||
datasource: datasourceDocker.id,
|
||||
depName: 'node',
|
||||
lookupName: 'node',
|
||||
};
|
||||
const pkg = extractImage({
|
||||
name: sample.lookupName,
|
||||
name: sample.depName,
|
||||
newTag: sample.currentValue,
|
||||
});
|
||||
expect(pkg).toEqual(sample);
|
||||
|
@ -143,10 +142,9 @@ describe('manager/kustomize/extract', () => {
|
|||
currentValue: 'v1.0.0',
|
||||
datasource: datasourceDocker.id,
|
||||
depName: 'test/node',
|
||||
lookupName: 'test/node',
|
||||
};
|
||||
const pkg = extractImage({
|
||||
name: sample.lookupName,
|
||||
name: sample.depName,
|
||||
newTag: sample.currentValue,
|
||||
});
|
||||
expect(pkg).toEqual(sample);
|
||||
|
@ -156,10 +154,9 @@ describe('manager/kustomize/extract', () => {
|
|||
currentValue: 'v1.0.0',
|
||||
datasource: datasourceDocker.id,
|
||||
depName: 'quay.io/repo/image',
|
||||
lookupName: 'quay.io/repo/image',
|
||||
};
|
||||
const pkg = extractImage({
|
||||
name: sample.lookupName,
|
||||
name: sample.depName,
|
||||
newTag: sample.currentValue,
|
||||
});
|
||||
expect(pkg).toEqual(sample);
|
||||
|
@ -169,10 +166,9 @@ describe('manager/kustomize/extract', () => {
|
|||
currentValue: 'v1.0.0',
|
||||
datasource: datasourceDocker.id,
|
||||
depName: 'localhost:5000/repo/image',
|
||||
lookupName: 'localhost:5000/repo/image',
|
||||
};
|
||||
const pkg = extractImage({
|
||||
name: sample.lookupName,
|
||||
name: sample.depName,
|
||||
newTag: sample.currentValue,
|
||||
});
|
||||
expect(pkg).toEqual(sample);
|
||||
|
@ -182,10 +178,9 @@ describe('manager/kustomize/extract', () => {
|
|||
currentValue: 'v1.0.0',
|
||||
datasource: datasourceDocker.id,
|
||||
depName: 'localhost:5000/repo/image/service',
|
||||
lookupName: 'localhost:5000/repo/image/service',
|
||||
};
|
||||
const pkg = extractImage({
|
||||
name: sample.lookupName,
|
||||
name: sample.depName,
|
||||
newTag: sample.currentValue,
|
||||
});
|
||||
expect(pkg).toEqual(sample);
|
||||
|
@ -222,7 +217,7 @@ describe('manager/kustomize/extract', () => {
|
|||
it('should extract out image versions', () => {
|
||||
const res = extractPackageFile(gitImages);
|
||||
expect(res.deps).toMatchSnapshot();
|
||||
expect(res.deps).toHaveLength(4);
|
||||
expect(res.deps).toHaveLength(5);
|
||||
expect(res.deps[0].currentValue).toEqual('v0.1.0');
|
||||
expect(res.deps[1].currentValue).toEqual('v0.0.1');
|
||||
});
|
||||
|
|
|
@ -8,6 +8,7 @@ import { PackageDependency, PackageFile } from '../common';
|
|||
interface Image {
|
||||
name: string;
|
||||
newTag: string;
|
||||
newName?: string;
|
||||
}
|
||||
|
||||
interface Kustomize {
|
||||
|
@ -65,8 +66,7 @@ export function extractImage(image: Image): PackageDependency | null {
|
|||
if (image?.name && image.newTag) {
|
||||
return {
|
||||
datasource: datasourceDocker.id,
|
||||
depName: image.name,
|
||||
lookupName: image.name,
|
||||
depName: image.newName ?? image.name,
|
||||
currentValue: image.newTag,
|
||||
};
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue