ClickHouse/tests/ci/docker_images_helper.py
János Benjamin Antal 5862c4ec93
Use not the absolute latest docker image tag (#54369)
* Add params for select queries in clickhouse_helper.py

* Find the latest image tags from master

* Get full git history

* Do not checkout submodules

* Automatic style fix

* Fix style errors

* Make logging pretty

* Revert accidentally committed changes

* Eliminate pformat

* Update all workflows

* Remove flag with default value

* Improve exception handling

* Utilizing the loop condition in while loop

* Make the logic robust over temporary errors

* Prettify logs

* Automatic style fix

* Add accidentally removed line

* Revert "Make the logic robust over temporary errors"

This reverts commit 91e6b5d7ba.

* Do not fail in case the tag cannot be queried from ClickHouse

* Support partial finding of tags

---------

Co-authored-by: robot-clickhouse <robot-clickhouse@users.noreply.github.com>
2023-09-08 08:42:56 +02:00

31 lines
900 B
Python

#!/usr/bin/env python3
import json
import logging
import os
from typing import Dict, List
IMAGES_FILE_PATH = "docker/images.json"
ImagesDict = Dict[str, dict]
def get_images_dict(repo_path: str, images_file_path: str) -> ImagesDict:
"""Return images suppose to build on the current architecture host"""
images_dict = {}
path_to_images_file = os.path.join(repo_path, images_file_path)
if os.path.exists(path_to_images_file):
with open(path_to_images_file, "rb") as dict_file:
images_dict = json.load(dict_file)
else:
logging.info(
"Image file %s doesn't exist in repo %s", images_file_path, repo_path
)
return images_dict
def get_image_names(repo_path: str, images_file_path: str) -> List[str]:
images_dict = get_images_dict(repo_path, images_file_path)
return [info["name"] for (_, info) in images_dict.items()]