Skip to content

Commit

Permalink
fix: support more versions
Browse files Browse the repository at this point in the history
  • Loading branch information
viceice committed May 16, 2024
1 parent e206ee3 commit 9d8b421
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 2 deletions.
25 changes: 25 additions & 0 deletions lib/config/presets/internal/workarounds.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import { regEx } from '../../../util/regex';
import { presets } from './workarounds';

describe('config/presets/internal/workarounds', () => {
describe('bitnamiDockerImageVersioning', () => {
const versioning = presets.bitnamiDockerImageVersioning.packageRules![0]
.versioning as string;
const re = regEx(versioning.substring(6));

it.each`
input | expected
${'latest'} | ${false}
${'20'} | ${true}
${'20-debian'} | ${false}
${'20-debian-12'} | ${true}
${'1.24'} | ${true}
${'1.24-debian-12'} | ${true}
${'1.24.0'} | ${true}
${'1.24.0-debian-12'} | ${true}
${'1.24.0-debian-12-r24'} | ${true}
`('matches("$input") == "$expected"', ({ input, expected }) => {
expect(re.test(input)).toEqual(expected);
});
});
});
8 changes: 6 additions & 2 deletions lib/config/presets/internal/workarounds.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,13 @@ export const presets: Record<string, Preset> = {
packageRules: [
{
matchDatasources: ['docker'],
matchPackagePrefixes: ['gcr.io/bitnami-containers/', 'bitnami/'],
matchPackagePrefixes: [
'bitnami/',
'docker.io/bitnami/',
'gcr.io/bitnami-containers/',
],
versioning:
'regex:^(?<major>\\d+)\\.(?<minor>\\d+)\\.(?<patch>\\d+)(:?-(?<compatibility>.+)-(?<build>\\d+)(?:-r(?<revision>\\d+))?)?$',
'regex:^(?<major>\\d+)(?:\\.(?<minor>\\d+)(?:\\.(?<patch>\\d+))?)?(:?-(?<compatibility>.+)-(?<build>\\d+)(?:-r(?<revision>\\d+))?)?$',
},
],
},
Expand Down

0 comments on commit 9d8b421

Please sign in to comment.