diff --git a/lib/workers/repository/process/lookup/index.spec.ts b/lib/workers/repository/process/lookup/index.spec.ts index 0f01fada1a6d18fb1f717b55db98c4c5d58d2743..c4310a3444a4890fbae091b326ab20d1f82031e2 100644 --- a/lib/workers/repository/process/lookup/index.spec.ts +++ b/lib/workers/repository/process/lookup/index.spec.ts @@ -3489,6 +3489,27 @@ describe('workers/repository/process/lookup/index', () => { lookup.lookupUpdates(config), ).unwrapOrThrow(); + expect(getDockerDigest.mock.calls).toEqual([ + [ + { + currentDigest: 'aaa111', + currentValue: '18.10.0-alpine', + packageName: 'node', + registryUrl: 'https://index.docker.io', + }, + '18.19.0-alpine', + ], + [ + { + currentDigest: 'aaa111', + currentValue: '18.10.0-alpine', + packageName: 'node', + registryUrl: 'https://index.docker.io', + }, + '18.10.0-alpine', + ], + ]); + expect(res).toEqual({ currentVersion: '18.10.0', fixedVersion: '18.10.0', diff --git a/lib/workers/repository/process/lookup/index.ts b/lib/workers/repository/process/lookup/index.ts index 2499fed7dd632f33c47fa6e82eb1129b9f6cf8c8..b564a6eb0984ab065d0c8fc5d8b743bd86866894 100644 --- a/lib/workers/repository/process/lookup/index.ts +++ b/lib/workers/repository/process/lookup/index.ts @@ -442,6 +442,24 @@ export async function lookupUpdates( } else if (compareValue && versioning.isSingleVersion(compareValue)) { res.fixedVersion = compareValue.replace(regEx(/^=+/), ''); } + + // massage versionCompatibility + if ( + is.string(config.currentValue) && + is.string(compareValue) && + is.string(config.versionCompatibility) + ) { + for (const update of res.updates) { + logger.debug({ update }); + if (is.string(config.currentValue) && is.string(update.newValue)) { + update.newValue = config.currentValue.replace( + compareValue, + update.newValue, + ); + } + } + } + // Add digests if necessary if (supportsDigests(config.datasource)) { if (config.currentDigest) { @@ -449,7 +467,7 @@ export async function lookupUpdates( // digest update res.updates.push({ updateType: 'digest', - newValue: compareValue, + newValue: config.currentValue, }); } } else if (config.pinDigests) { @@ -459,7 +477,7 @@ export async function lookupUpdates( res.updates.push({ isPinDigest: true, updateType: 'pinDigest', - newValue: compareValue, + newValue: config.currentValue, }); } } @@ -520,23 +538,6 @@ export async function lookupUpdates( } } - // massage versionCompatibility - if ( - is.string(config.currentValue) && - is.string(compareValue) && - is.string(config.versionCompatibility) - ) { - for (const update of res.updates) { - logger.debug({ update }); - if (is.string(config.currentValue) && is.string(update.newValue)) { - update.newValue = config.currentValue.replace( - compareValue, - update.newValue, - ); - } - } - } - if (res.updates.length) { delete res.skipReason; }