Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: renovatebot/renovate
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 37.425.0
Choose a base ref
...
head repository: renovatebot/renovate
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 37.425.1
Choose a head ref
  • 1 commit
  • 2 files changed
  • 1 contributor

Commits on Jul 7, 2024

  1. fix: Use versioning comparison for release lookup filtering (#30059)

    zharinov authored Jul 7, 2024
    Copy the full SHA
    5eacc5e View commit details
Showing with 37 additions and 1 deletion.
  1. +29 −0 lib/workers/repository/process/lookup/filter.spec.ts
  2. +8 −1 lib/workers/repository/process/lookup/filter.ts
29 changes: 29 additions & 0 deletions lib/workers/repository/process/lookup/filter.spec.ts
Original file line number Diff line number Diff line change
@@ -81,5 +81,34 @@ describe('workers/repository/process/lookup/filter', () => {

expect(filteredVersions).toEqual([{ version: '1.2.3-beta' }]);
});

it('ignores version insufficient prefixes', () => {
const releases = [
{ version: '1.0.1' },
{ version: '1.2.0' },
{ version: '2.0.0', isDeprecated: true },
{ version: '2.1.0' },
] satisfies Release[];

const config = partial<FilterConfig>({
ignoreUnstable: true,
ignoreDeprecated: true,
});
const currentVersion = 'v1.0.1';
const latestVersion = 'v2.0.0';

const filteredVersions = filterVersions(
config,
currentVersion,
latestVersion,
releases,
versioning,
);

expect(filteredVersions).toEqual([
{ version: '1.2.0' },
{ version: '2.1.0' },
]);
});
});
});
9 changes: 8 additions & 1 deletion lib/workers/repository/process/lookup/filter.ts
Original file line number Diff line number Diff line change
@@ -43,7 +43,14 @@ export function filterVersions(
versioning.isGreaterThan(r.version, currentVersion),
);

const currentRelease = releases.find((r) => r.version === currentVersion);
const currentRelease = releases.find(
(r) =>
versioning.isValid(r.version) &&
versioning.isVersion(r.version) &&
versioning.isValid(currentVersion) &&
versioning.isVersion(currentVersion) &&
versioning.equals(r.version, currentVersion),
);

// Don't upgrade from non-deprecated to deprecated
if (ignoreDeprecated && currentRelease && !currentRelease.isDeprecated) {