Skip to content

Commit

Permalink
fix(versionCompatibility): fix compatibility suffix (#24954)
Browse files Browse the repository at this point in the history
  • Loading branch information
rarkins committed Oct 2, 2023
1 parent 1b70c42 commit e6fdecd
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/workers/repository/process/lookup/generate.ts
Expand Up @@ -10,6 +10,7 @@ import { getUpdateType } from './update-type';

export async function generateUpdate(
config: LookupUpdateConfig,
currentValue: string | undefined,
versioning: VersioningApi,
rangeStrategy: RangeStrategy,
currentVersion: string,
Expand Down Expand Up @@ -49,7 +50,6 @@ export async function generateUpdate(
update.registryUrl = release.registryUrl;
}

const { currentValue } = config;
if (currentValue) {
try {
update.newValue = versioning.getNewValue({
Expand Down
21 changes: 21 additions & 0 deletions lib/workers/repository/process/lookup/index.spec.ts
Expand Up @@ -11,6 +11,7 @@ import { GithubTagsDatasource } from '../../../../modules/datasource/github-tags
import { NpmDatasource } from '../../../../modules/datasource/npm';
import { PackagistDatasource } from '../../../../modules/datasource/packagist';
import { PypiDatasource } from '../../../../modules/datasource/pypi';
import { id as debianVersioningId } from '../../../../modules/versioning/debian';
import { id as dockerVersioningId } from '../../../../modules/versioning/docker';
import { id as gitVersioningId } from '../../../../modules/versioning/git';
import { id as nodeVersioningId } from '../../../../modules/versioning/node';
Expand Down Expand Up @@ -1782,6 +1783,26 @@ describe('workers/repository/process/lookup/index', () => {
});
});

it('applies versionCompatibility for debian codenames with suffix', async () => {
config.currentValue = 'bullseye-slim';
config.packageName = 'debian';
config.versioning = debianVersioningId;
config.versionCompatibility = '^(?<version>[^-]+)(?<compatibility>-.*)?$';
config.datasource = DockerDatasource.id;
getDockerReleases.mockResolvedValueOnce({
releases: [
{ version: 'bullseye' },
{ version: 'bullseye-slim' },
{ version: 'bookworm' },
{ version: 'bookworm-slim' },
],
});
const res = await lookup.lookupUpdates(config);
expect(res).toMatchObject({
updates: [{ newValue: 'bookworm-slim', updateType: 'major' }],
});
});

it('handles digest pin for up to date version', async () => {
config.currentValue = '8.1.0';
config.packageName = 'node';
Expand Down
1 change: 1 addition & 0 deletions lib/workers/repository/process/lookup/index.ts
Expand Up @@ -346,6 +346,7 @@ export async function lookupUpdates(
const newVersion = release.version;
const update = await generateUpdate(
config,
compareValue,
versioning,
// TODO #22198

Expand Down

0 comments on commit e6fdecd

Please sign in to comment.