Files
chart/charts/nextcloud/upgrade_strategy
sonicaj 4ea3f015f6 Update nextcloud upgrade strategy
For nextcloud tags, 21.1 is greater then 21.1.0 so we reverse sort the tags list before doing semantic versioning as in semantic versioning both tags are equal and when we reverse sort it, 21.1 is prioritised over 21.1.0.
2021-09-06 15:31:50 +05:00

26 lines
593 B
Python
Executable File

#!/usr/bin/python3
import json
import sys
from catalog_update.upgrade_strategy import semantic_versioning
def newer_mapping(image_tags):
key = list(image_tags.keys())[0]
# 21.1 is greater then 21.1.0 so we reverse sort bfeore doing semantic versioning
version = semantic_versioning(sorted(image_tags[key], reverse=True))
if not version:
return {}
return {
'tags': {key: version},
'app_version': version,
}
if __name__ == '__main__':
if len(sys.argv) != 2:
exit(1)
print(json.dumps(newer_mapping(json.loads(sys.argv[1]))))