mirror of
https://gitee.com/milvus-io/milvus.git
synced 2026-01-07 19:31:51 +08:00
[skip e2e]Refine the script of getting image tag (#26919)
Signed-off-by: zhuwenxing <wenxing.zhu@zilliz.com>
This commit is contained in:
parent
e2528030bb
commit
3fd315f2b5
@ -3,16 +3,23 @@ import argparse
|
||||
|
||||
def get_image_tag_by_short_name(repository, tag):
|
||||
|
||||
# Send API request to get all tags
|
||||
url = f"https://hub.docker.com/v2/repositories/{repository}/tags"
|
||||
# Send API request to get all tags start with prefix
|
||||
# ${branch}-latest means the tag is a dev build
|
||||
# master-latest -> master-$date-$commit
|
||||
# 2.3.0-latest -> 2.3.0-$date-$commit
|
||||
# latest means the tag is a release build
|
||||
# latest -> v$version
|
||||
splits = tag.split("-")
|
||||
prefix = splits[0] if len(splits) > 1 else "v"
|
||||
url = f"https://hub.docker.com/v2/repositories/{repository}/tags?name={prefix}&ordering=last_updated"
|
||||
response = requests.get(url)
|
||||
data = response.json()
|
||||
# Get the DIGEST of the "master-latest" tag
|
||||
# Get the DIGEST of the short tag
|
||||
digest = ""
|
||||
for tag_info in data["results"]:
|
||||
if tag_info["name"] == tag:
|
||||
digest = tag_info["images"][0]["digest"]
|
||||
break
|
||||
url = f"https://hub.docker.com/v2/repositories/{repository}/tags/{tag}"
|
||||
response = requests.get(url)
|
||||
cur_tag_info = response.json()
|
||||
digest = cur_tag_info["images"][0]["digest"]
|
||||
res = []
|
||||
# Iterate through all tags and find the ones with the same DIGEST
|
||||
for tag_info in data["results"]:
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user