fix(versionCompatibility): support digest updates (#25518)

This commit is contained in:
Rhys Arkins 2023-10-31 09:55:24 -04:00 committed by GitHub
parent bece5a1c50
commit 4850110f36
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 18 additions and 3 deletions

View file

@ -1747,20 +1747,36 @@ describe('workers/repository/process/lookup/index', () => {
it('applies versionCompatibility for 18.10.0', async () => { it('applies versionCompatibility for 18.10.0', async () => {
config.currentValue = '18.10.0-alpine'; config.currentValue = '18.10.0-alpine';
config.currentDigest = 'aaa111';
config.packageName = 'node'; config.packageName = 'node';
config.versioning = nodeVersioningId; config.versioning = nodeVersioningId;
config.versionCompatibility = '^(?<version>[^-]+)(?<compatibility>-.*)?$'; config.versionCompatibility = '^(?<version>[^-]+)(?<compatibility>-.*)?$';
config.datasource = DockerDatasource.id; config.datasource = DockerDatasource.id;
getDockerReleases.mockResolvedValueOnce({ getDockerReleases.mockResolvedValueOnce({
releases: [ releases: [
{ version: '18.10.0' },
{ version: '18.18.0' }, { version: '18.18.0' },
{ version: '18.19.0-alpine' }, { version: '18.19.0-alpine' },
{ version: '18.20.0' }, { version: '18.20.0' },
], ],
}); });
getDockerDigest.mockResolvedValueOnce('bbb222');
getDockerDigest.mockResolvedValueOnce('ccc333');
const res = await lookup.lookupUpdates(config); const res = await lookup.lookupUpdates(config);
expect(res.updates).toHaveLength(2);
expect(res).toMatchObject({ expect(res).toMatchObject({
updates: [{ newValue: '18.19.0-alpine', updateType: 'minor' }], updates: [
{
newValue: '18.19.0-alpine',
newDigest: 'bbb222',
updateType: 'minor',
},
{
newValue: '18.10.0-alpine',
newDigest: 'ccc333',
updateType: 'digest',
},
],
}); });
}); });

View file

@ -419,8 +419,7 @@ export async function lookupUpdates(
// digest update // digest update
res.updates.push({ res.updates.push({
updateType: 'digest', updateType: 'digest',
// TODO #22198 newValue: compareValue,
newValue: config.currentValue!,
}); });
} }
} else if (config.pinDigests) { } else if (config.pinDigests) {