From 2fc5a4b179e656e10e7172dc9bf6549a14a0fd6d Mon Sep 17 00:00:00 2001 From: Tobias Gabriel Date: Thu, 21 Nov 2024 16:28:53 +0100 Subject: [PATCH 1/3] fix(datasource/maven): make cache key extractedVersion specific --- lib/modules/datasource/maven/index.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/modules/datasource/maven/index.ts b/lib/modules/datasource/maven/index.ts index 8fd08b788131ab..4b7951b14f06eb 100644 --- a/lib/modules/datasource/maven/index.ts +++ b/lib/modules/datasource/maven/index.ts @@ -254,7 +254,7 @@ export class MavenDatasource extends Datasource { { registryUrl, packageName }: PostprocessReleaseConfig, { version, versionOrig }: Release, ) => - `postprocessRelease:${registryUrl}:${packageName}:${versionOrig ?? version}`, + `postprocessRelease:${registryUrl}:${packageName}:${versionOrig ?? version}${versionOrig ? `:${version}` : ''}`, ttlMinutes: 24 * 60, }) override async postprocessRelease( From e200afec8162846960003c9d15bc92ad2849cec4 Mon Sep 17 00:00:00 2001 From: Tobias Gabriel Date: Thu, 21 Nov 2024 16:46:53 +0100 Subject: [PATCH 2/3] simplify expression --- lib/modules/datasource/maven/index.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/modules/datasource/maven/index.ts b/lib/modules/datasource/maven/index.ts index 4b7951b14f06eb..aae05ab640bf48 100644 --- a/lib/modules/datasource/maven/index.ts +++ b/lib/modules/datasource/maven/index.ts @@ -254,7 +254,7 @@ export class MavenDatasource extends Datasource { { registryUrl, packageName }: PostprocessReleaseConfig, { version, versionOrig }: Release, ) => - `postprocessRelease:${registryUrl}:${packageName}:${versionOrig ?? version}${versionOrig ? `:${version}` : ''}`, + `postprocessRelease:${registryUrl}:${packageName}:${versionOrig ? `${versionOrig}:${version}` : `${version}`}`, ttlMinutes: 24 * 60, }) override async postprocessRelease( From c605077daaa467f8121b7cc801b8731597be4690 Mon Sep 17 00:00:00 2001 From: Tobias Gabriel Date: Thu, 21 Nov 2024 17:17:53 +0100 Subject: [PATCH 3/3] add test --- lib/modules/datasource/maven/index.spec.ts | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/lib/modules/datasource/maven/index.spec.ts b/lib/modules/datasource/maven/index.spec.ts index eec203b2520c78..757e328764afa2 100644 --- a/lib/modules/datasource/maven/index.spec.ts +++ b/lib/modules/datasource/maven/index.spec.ts @@ -711,6 +711,21 @@ describe('modules/datasource/maven/index', () => { expect(res).toBe(releaseOrig); }); + it('returns original value for 200 response with versionOrig', async () => { + httpMock + .scope(MAVEN_REPO) + .head('/foo/bar/1.2.3/bar-1.2.3.pom') + .reply(200); + const releaseOrig: Release = { version: '1.2', versionOrig: '1.2.3' }; + + const res = await postprocessRelease( + { datasource, packageName: 'foo:bar', registryUrl: MAVEN_REPO }, + releaseOrig, + ); + + expect(res).toBe(releaseOrig); + }); + it('returns original value for invalid configs', async () => { const releaseOrig: Release = { version: '1.2.3' }; expect(