mirror of
https://github.com/truenas/charts.git
synced 2026-04-24 02:20:15 +08:00
* Add `searxng` to `community` train * add tempaltes * add UI and metadata * update readme * remove non-existent option * bump
32 lines
744 B
Python
Executable File
32 lines
744 B
Python
Executable File
#!/usr/bin/python3
|
|
import json
|
|
import re
|
|
import sys
|
|
|
|
from catalog_update.upgrade_strategy import datetime_versioning
|
|
|
|
|
|
RE_STABLE_VERSION = re.compile(r'\d{4}.\d{1,2}.\d{1,2}-.+')
|
|
|
|
|
|
def newer_mapping(image_tags):
|
|
key = list(image_tags.keys())[0]
|
|
tags = {t.split('-')[0]: t for t in image_tags[key] if RE_STABLE_VERSION.fullmatch(t)}
|
|
version = datetime_versioning(list(tags), '%Y.%m.%d')
|
|
if not version:
|
|
return {}
|
|
|
|
return {
|
|
'tags': {key: tags[version]},
|
|
'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)))
|