Skip to content

Commit

Permalink
Merge pull request #55822 from ClickHouse/cherrypick/23.9/170925cb3cb…
Browse files Browse the repository at this point in the history
…0058dabdb8f72774c52f40be049da

Cherry pick #55793 to 23.9: Improve enrich image
  • Loading branch information
robot-ch-test-poll committed Oct 19, 2023
2 parents dff7db1 + 170925c commit 93cb13d
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions tests/ci/docker_manifests_merge.py
Original file line number Diff line number Diff line change
Expand Up @@ -197,8 +197,8 @@ def enrich_images(changed_images: Dict[str, str]) -> None:
WITH {commit_shas:Array(String)} AS commit_shas,
{images:Array(String)} AS images
SELECT
substring(test_name, 1, position(test_name, ':') -1) AS image_name,
argMax(commit_sha, check_start_time) AS commit_sha
splitByChar(':', test_name)[1] AS image_name,
argMax(splitByChar(':', test_name)[2], check_start_time) AS tag
FROM checks
WHERE
check_name == 'Push multi-arch images to Dockerhub'
Expand All @@ -209,7 +209,10 @@ def enrich_images(changed_images: Dict[str, str]) -> None:
"""

batch_count = 0
ch_helper = ClickHouseHelper()
# We use always publicly available DB here intentionally
ch_helper = ClickHouseHelper(
"https://play.clickhouse.com", {"X-ClickHouse-User": "play"}
)

while (
batch_count <= MAX_COMMIT_BATCHES_TO_CHECK and len(images_to_find_tags_for) != 0
Expand All @@ -229,15 +232,12 @@ def enrich_images(changed_images: Dict[str, str]) -> None:
"Found images for commits %s..%s:\n %s",
commit_shas[0],
commit_shas[-1],
"\n ".join(f"{im['image_name']}:{im['commit_sha']}" for im in result),
"\n ".join(f"{im['image_name']}:{im['tag']}" for im in result),
)

for row in result:
image_name = row["image_name"]
commit_sha = row["commit_sha"]
# As we only get the SHAs of merge commits from master, the PR number will be always 0
tag = f"0-{commit_sha}"
changed_images[image_name] = tag
changed_images[image_name] = row["tag"]
images_to_find_tags_for.remove(image_name)

batch_count += 1
Expand Down

0 comments on commit 93cb13d

Please sign in to comment.