0
0
mirror of https://github.com/renovatebot/renovate.git synced 2024-12-22 21:48:32 +00:00
renovatebot_renovate/lib/modules/versioning/ubuntu/common.ts
Callum Loh 91fa40a4ca
feat: Add support for ubuntu dated container image tags (#25060)
Co-authored-by: Rhys Arkins <rhys@arkins.net>
2023-10-12 15:19:11 +00:00

29 lines
735 B
TypeScript

import { regEx } from '../../../util/regex';
function isDatedCodeName(input: string): boolean {
return regEx(/^(?<codename>\w+)-(?<date>\d{8})$/).test(input);
}
function getDatedContainerImageCodename(version: string): null | string {
const groups = regEx(/^(?<codename>\w+)-(?<date>\d{8})$/).exec(version);
if (!groups?.groups) {
return null;
}
return groups.groups.codename;
}
function getDatedContainerImageVersion(version: string): null | number {
const groups = regEx(/^(?<codename>\w+)-(?<date>\d{8})$/).exec(version);
if (!groups?.groups) {
return null;
}
return parseInt(groups.groups.date, 10);
}
export {
isDatedCodeName,
getDatedContainerImageCodename,
getDatedContainerImageVersion,
};