Files
chart/library/ix-dev/community/immich/upgrade_strategy
Stavros Kois edde8c3839 NAS-122507 / 23.10 / Add immich to community train (#1271)
* initial commit

* add some todo

* extend config

* remove typesense url

* add microservices

* add proxy and typesense

* ML

* fix configmap

* fixup config

* change range

* one more

* add some inits

* ts dont need to wait for server

* wait web

* add redis

* fix redis

* wrong space

* type

* add redis service

* conditional services

* fix redis...

* add caps

* fix capabilities

* fix service

* add tests

* fix conditional pods

* fix upgrade_strategy

* fix config

* lint

* whops

* update strategy

* make robust

* cleaner

* fix regex

* Take a copy of the resources before we start doing modifications

* regen commontgz

* bump versions

* add pullPolicy

* regen common

* bump version

* bump

* bump helm

* regen common

* Update library/ix-dev/community/immich/values.yaml

* bump

* update resources validation
2023-07-05 18:42:37 +03:00

59 lines
1.5 KiB
Python
Executable File

#!/usr/bin/python3
import json
import re
import sys
from catalog_update.upgrade_strategy import semantic_versioning
RE_STABLE_VERSION_BASE = r'\d+\.\d+\.\d+'
ENUMS = {
'typesenseImage': {
'RE_STABLE_VERSION': re.compile(RE_STABLE_VERSION_BASE),
'STRIP_TEXT': ''
},
'default': {
'RE_STABLE_VERSION': re.compile(rf'v{RE_STABLE_VERSION_BASE}'),
'STRIP_TEXT': 'v'
}
}
def newer_mapping(image_tags):
output = {
"tags": {},
"app_version": ""
}
for key in image_tags.keys():
STRIP_TEXT = ENUMS[key].get('STRIP_TEXT', None) \
if key in ENUMS else ENUMS.get('default', None).get('STRIP_TEXT', None)
RE_STABLE_VERSION = ENUMS[key].get('RE_STABLE_VERSION') \
if key in ENUMS else ENUMS.get('default', None).get('RE_STABLE_VERSION', None)
if (STRIP_TEXT is None) or (RE_STABLE_VERSION is None):
continue
tags = {t.strip(STRIP_TEXT): t for t in image_tags[key] if RE_STABLE_VERSION.fullmatch(t)}
version = semantic_versioning(list(tags))
if not version:
continue
if key == 'image':
output['app_version'] = version
output['tags'][key] = tags[version]
return output
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)))