Skip to content

Commit

Permalink
fix(datasource/maven): make cache key extractedVersion specific (#32658)
Browse files Browse the repository at this point in the history
  • Loading branch information
Shegox authored Nov 21, 2024
1 parent 3660a50 commit 6e36262
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
15 changes: 15 additions & 0 deletions lib/modules/datasource/maven/index.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
2 changes: 1 addition & 1 deletion lib/modules/datasource/maven/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,7 @@ export class MavenDatasource extends Datasource {
{ registryUrl, packageName }: PostprocessReleaseConfig,
{ version, versionOrig }: Release,
) =>
`postprocessRelease:${registryUrl}:${packageName}:${versionOrig ?? version}`,
`postprocessRelease:${registryUrl}:${packageName}:${versionOrig ? `${versionOrig}:${version}` : `${version}`}`,
ttlMinutes: 24 * 60,
})
override async postprocessRelease(
Expand Down

0 comments on commit 6e36262

Please sign in to comment.