From 0b79b3d541af43ee2e9350d21a9a36b6f96eb334 Mon Sep 17 00:00:00 2001 From: Rhys Arkins <rhys@arkins.net> Date: Wed, 29 Mar 2023 07:08:15 +0200 Subject: [PATCH] fix: merge config constraints over package file extracted constraints (#21207) --- .../repository/process/__snapshots__/fetch.spec.ts.snap | 3 ++- lib/workers/repository/process/fetch.spec.ts | 3 ++- lib/workers/repository/process/fetch.ts | 1 + 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/lib/workers/repository/process/__snapshots__/fetch.spec.ts.snap b/lib/workers/repository/process/__snapshots__/fetch.spec.ts.snap index 50e2e373af..b866c67a21 100644 --- a/lib/workers/repository/process/__snapshots__/fetch.spec.ts.snap +++ b/lib/workers/repository/process/__snapshots__/fetch.spec.ts.snap @@ -5,7 +5,8 @@ exports[`workers/repository/process/fetch fetchUpdates() fetches updates 1`] = ` "maven": [ { "constraints": { - "some": "constraint", + "other": "constraint", + "some": "different", }, "deps": [ { diff --git a/lib/workers/repository/process/fetch.spec.ts b/lib/workers/repository/process/fetch.spec.ts index 6b033fd1ba..101d80ee1e 100644 --- a/lib/workers/repository/process/fetch.spec.ts +++ b/lib/workers/repository/process/fetch.spec.ts @@ -58,11 +58,12 @@ describe('workers/repository/process/fetch', () => { it('fetches updates', async () => { config.rangeStrategy = 'auto'; + config.constraints = { some: 'different' }; const packageFiles: any = { maven: [ { packageFile: 'pom.xml', - extractedConstraints: { some: 'constraint' }, + extractedConstraints: { some: 'constraint', other: 'constraint' }, deps: [{ datasource: MavenDatasource.id, depName: 'bbb' }], }, ], diff --git a/lib/workers/repository/process/fetch.ts b/lib/workers/repository/process/fetch.ts index 38dc52b314..badf45d48b 100644 --- a/lib/workers/repository/process/fetch.ts +++ b/lib/workers/repository/process/fetch.ts @@ -98,6 +98,7 @@ async function fetchManagerPackagerFileUpdates( if (pFile.extractedConstraints) { pFile.constraints = { ...pFile.extractedConstraints, + ...config.constraints, ...pFile.constraints, }; delete pFile.extractedConstraints; -- GitLab