[skip e2e] Add new func on utils file (#14058)

Signed-off-by: wangting0128 <ting.wang@zilliz.com>
This commit is contained in:
wt 2021-12-23 14:43:45 +08:00 committed by GitHub
parent e47a651be4
commit f4374d616f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -310,3 +310,23 @@ def get_master_tags(tags_list):
if tag_name in tag and tag != tag_name + "-latest":
_list.append(tag)
return _list
def get_config_digest(url, token):
headers = {'Content-type': "application/json",
"charset": "UTF-8",
"Accept": "application/vnd.docker.distribution.manifest.v2+json",
"Authorization": "Bearer %s" % token}
try:
rep = requests.get(url, headers=headers)
data = json.loads(rep.text)
digest = ''
if 'config' in data and 'digest' in data["config"]:
digest = data["config"]["digest"]
else:
print("Can not get the digest")
return digest
except:
print("Can not get the digest")
return ""