mirror of
https://github.com/truenas/charts.git
synced 2026-06-28 00:06:45 +08:00
37 lines
807 B
Python
Executable File
37 lines
807 B
Python
Executable File
#!/usr/bin/python3
|
|
import json
|
|
import sys
|
|
import re
|
|
|
|
from catalog_update.upgrade_strategy import datetime_versioning
|
|
|
|
|
|
VERSION_REG = r'2[2-9][0-1][0-9][0-3][0-9]-bullseye'
|
|
|
|
|
|
def newer_mapping(image_tags):
|
|
key = list(image_tags.keys())[0]
|
|
tags = []
|
|
for tag in image_tags[key]:
|
|
match = re.fullmatch(VERSION_REG, tag)
|
|
if match:
|
|
tags.append(tag.split('-')[0])
|
|
|
|
version = datetime_versioning(list(tags), '%y%m%d')
|
|
if not version:
|
|
return {}
|
|
|
|
return {
|
|
'tags': {key: f'{version}-bullseye'},
|
|
'app_version': version,
|
|
}
|
|
|
|
|
|
if __name__ == '__main__':
|
|
try:
|
|
versions_json = json.loads(sys.stdin.read())
|
|
except ValueError:
|
|
raise ValueError('Invalid json specified')
|
|
|
|
print(json.dumps(newer_mapping(versions_json)))
|