You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by po...@apache.org on 2021/08/02 13:44:01 UTC

[airflow] 06/22: Stop attempting to pull base python image when pulling commit hash (#17231)

This is an automated email from the ASF dual-hosted git repository.

potiuk pushed a commit to branch v2-1-test
in repository https://gitbox.apache.org/repos/asf/airflow.git

commit fedce030f331aee85f4d356862715f245882dbb7
Author: Jarek Potiuk <ja...@potiuk.com>
AuthorDate: Wed Jul 28 17:00:38 2021 +0200

    Stop attempting to pull base python image when pulling commit hash (#17231)
    
    When we publish latest images, we also publish Python base images
    for them, so that we know where the base images are taken from.
    This is not happening when we build "per-build" images - we only
    publish the resulting images rather than base python images because
    we do not need the base python images. This change was implemented
    after ghcr.io move and it was not reflected in --github-id
    switch handling, so ./breeze command with --github-id specified,
    failed trying to pull base python image with the same ID.
    
    This PR makes sure that we only pull base python image when we
    build/pull latest images, not the per-build ones.
    
    (cherry picked from commit 430a0f9229e32cadc9e02b48e2130e3cef5ba352)
---
 scripts/ci/libraries/_push_pull_remove_images.sh | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/scripts/ci/libraries/_push_pull_remove_images.sh b/scripts/ci/libraries/_push_pull_remove_images.sh
index 630b5cc..0e99b10 100644
--- a/scripts/ci/libraries/_push_pull_remove_images.sh
+++ b/scripts/ci/libraries/_push_pull_remove_images.sh
@@ -145,7 +145,10 @@ function push_pull_remove_images::pull_ci_images_if_needed() {
     python_image_hash=$(docker images -q "${AIRFLOW_PYTHON_BASE_IMAGE}" 2> /dev/null || true)
     if [[ -z "${python_image_hash=}" || "${FORCE_PULL_IMAGES}" == "true" || \
             ${CHECK_IF_BASE_PYTHON_IMAGE_UPDATED} == "true" ]]; then
-        push_pull_remove_images::pull_base_python_image
+        if [[ ${GITHUB_REGISTRY_PULL_IMAGE_TAG} == "latest" ]]; then
+            # Pull base python image when building latest image
+            push_pull_remove_images::pull_base_python_image
+        fi
     fi
     if [[ "${DOCKER_CACHE}" == "pulled" ]]; then
         push_pull_remove_images::pull_image_if_not_present_or_forced \
@@ -160,7 +163,10 @@ function push_pull_remove_images::pull_prod_images_if_needed() {
     python_image_hash=$(docker images -q "${AIRFLOW_PYTHON_BASE_IMAGE}" 2> /dev/null || true)
     if [[ -z "${python_image_hash=}" || "${FORCE_PULL_IMAGES}" == "true"  || \
             ${CHECK_IF_BASE_PYTHON_IMAGE_UPDATED} == "true" ]]; then
-        push_pull_remove_images::pull_base_python_image
+        if [[ ${GITHUB_REGISTRY_PULL_IMAGE_TAG} == "latest" ]]; then
+            # Pull base python image when building latest image
+            push_pull_remove_images::pull_base_python_image
+        fi
     fi
     if [[ "${DOCKER_CACHE}" == "pulled" ]]; then
         # "Build" segment of production image