From c8467b69f4c4da7fb095d100eec857203d321c97 Mon Sep 17 00:00:00 2001 From: Jarek Potiuk Date: Thu, 7 Sep 2023 19:38:55 +0200 Subject: [PATCH] Only tag :latest image when default python version is used We should only tag :latest image when default image is used because this step always tags `apache/airflow:X.Y.Z` (defaulti Python) to become the `apache/airflow:latest`. This step was previously run for all Python versions which could have two effects: * if non-default image completed before the default such tagging would fail as the `apache/airflow:X.Y.Z` was not ready yet to be used as target of `apache/airflow:latesti` tag * if non-default image completed later, it would be no-op because the `apache/airflow:latest` already pointed to `apache/airflow:X.Y.Z` --- .../commands/release_management_commands.py | 23 +++++++++++-------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/dev/breeze/src/airflow_breeze/commands/release_management_commands.py b/dev/breeze/src/airflow_breeze/commands/release_management_commands.py index 1c3098e5f3433..5558e78b01c2e 100644 --- a/dev/breeze/src/airflow_breeze/commands/release_management_commands.py +++ b/dev/breeze/src/airflow_breeze/commands/release_management_commands.py @@ -1087,16 +1087,19 @@ def release_prod_images( f"{dockerhub_repo}:{airflow_version}-python{python}", f"{dockerhub_repo}:latest-python{python}", ) - if slim_images: - alias_image( - f"{dockerhub_repo}:slim-{airflow_version}", - f"{dockerhub_repo}:slim-latest", - ) - else: - alias_image( - f"{dockerhub_repo}:{airflow_version}", - f"{dockerhub_repo}:latest", - ) + if python == DEFAULT_PYTHON_MAJOR_MINOR_VERSION: + # only tag latest "default" image when we build default python version + # otherwise if the non-default images complete before the default one, their jobs will fail + if slim_images: + alias_image( + f"{dockerhub_repo}:slim-{airflow_version}", + f"{dockerhub_repo}:slim-latest", + ) + else: + alias_image( + f"{dockerhub_repo}:{airflow_version}", + f"{dockerhub_repo}:latest", + ) def is_package_in_dist(dist_files: list[str], package: str) -> bool: