mirror of
https://github.com/truenas/charts.git
synced 2026-04-05 03:39:20 +08:00
Add upgrade logic for ipfs chart
This commit is contained in:
@@ -11,7 +11,7 @@ def newer_mapping(image_tags):
|
||||
if not image_tags[key]:
|
||||
return {}
|
||||
|
||||
versions = [v for v in map(parse_version, image_tags[key]) if isinstance(v, Version)]
|
||||
versions = [v for v in map(parse_version, image_tags[key]) if isinstance(v, Version) and not v.is_prerelease]
|
||||
if not versions:
|
||||
return {}
|
||||
|
||||
|
||||
1
charts/ipfs/upgrade_info.json
Normal file
1
charts/ipfs/upgrade_info.json
Normal file
@@ -0,0 +1 @@
|
||||
{"filename": "ix_values.yaml", "keys": ["image"]}
|
||||
30
charts/ipfs/upgrade_strategy
Executable file
30
charts/ipfs/upgrade_strategy
Executable file
@@ -0,0 +1,30 @@
|
||||
#!/usr/bin/python3
|
||||
import json
|
||||
import sys
|
||||
|
||||
from pkg_resources import parse_version
|
||||
from pkg_resources.extern.packaging.version import Version
|
||||
|
||||
|
||||
def newer_mapping(image_tags):
|
||||
key = list(image_tags.keys())[0]
|
||||
if not image_tags[key]:
|
||||
return {}
|
||||
|
||||
versions = [v for v in map(parse_version, image_tags[key]) if isinstance(v, Version) and not v.is_prerelease]
|
||||
if not versions:
|
||||
return {}
|
||||
|
||||
versions.sort()
|
||||
version = str(versions[-1])
|
||||
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]))))
|
||||
@@ -13,7 +13,7 @@ def newer_mapping(image_tags):
|
||||
|
||||
tags = {t.rsplit('-', 1)[0]: t for t in image_tags[key]}
|
||||
|
||||
versions = [v for v in map(parse_version, tags) if isinstance(v, Version)]
|
||||
versions = [v for v in map(parse_version, tags) if isinstance(v, Version) and not v.is_prerelease]
|
||||
if not versions:
|
||||
return {}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user