mirror of
https://gitee.com/milvus-io/milvus.git
synced 2024-12-03 20:39:36 +08:00
[skip e2e]add script to get chart version by app version (#24954)
Signed-off-by: zhuwenxing <wenxing.zhu@zilliz.com>
This commit is contained in:
parent
9250423288
commit
969517f910
29
tests/scripts/get_helm_chart_version_by_app_version.py
Normal file
29
tests/scripts/get_helm_chart_version_by_app_version.py
Normal file
@ -0,0 +1,29 @@
|
||||
import subprocess
|
||||
import json
|
||||
def get_chart_version(repo = "milvus/milvus", app_version="2.2.0"):
|
||||
"""
|
||||
Get helm chart version by app version
|
||||
"""
|
||||
cmd = f"helm search repo {repo} -l -o json"
|
||||
result = subprocess.check_output(cmd, shell=True)
|
||||
result = json.loads(result)
|
||||
all_chart_versions = []
|
||||
for item in result:
|
||||
if item["app_version"] == app_version:
|
||||
all_chart_versions.append(item["version"])
|
||||
if len(all_chart_versions) == 0:
|
||||
raise Exception(f"Cannot find helm chart version for app version {app_version}")
|
||||
all_chart_versions.sort()
|
||||
result = all_chart_versions[-1]
|
||||
return result
|
||||
|
||||
if __name__ == "__main__":
|
||||
import argparse
|
||||
parser = argparse.ArgumentParser(description="Get helm charts version by app version")
|
||||
parser.add_argument("--app-version", type=str, default="2.2.0", help="app version")
|
||||
parser.add_argument("--repo", type=str, default="milvus/milvus", help="helm repo")
|
||||
args = parser.parse_args()
|
||||
repo = args.repo
|
||||
app_version = args.app_version
|
||||
chart_version = get_chart_version(repo=repo, app_version=app_version)
|
||||
print(chart_version)
|
Loading…
Reference in New Issue
Block a user