You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by ka...@apache.org on 2020/08/11 22:34:43 UTC

[airflow] 02/32: Python base image version is retrieved in the right place (#9931)

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

kaxilnaik pushed a commit to branch v1-10-test
in repository https://gitbox.apache.org/repos/asf/airflow.git

commit e2e68538962a8b894314d4522056f8f39840a474
Author: Jarek Potiuk <ja...@polidea.com>
AuthorDate: Wed Jul 22 15:58:39 2020 +0200

    Python base image version is retrieved in the right place (#9931)
    
    When quick-fixing Python 3.8.4 error #9820 PYTHON_BASE_IMAGE_VERSION
    variable was added but it was initialized too early in Breeze and
    it took the default version of Python rather than the one chosen
    by --python switch. This caused the generated requirements
    (locally by Breeze only) to generate wrong set of requirements
    and images built locally for different python versions were
    based on default Python version, not the one chosen by --python
    switch.
    
    (cherry picked from commit 7b9e8e0950f4b963b5cb13ed069d6132080fcd27)
---
 breeze                                  | 1 +
 scripts/ci/libraries/_build_images.sh   | 7 +++++++
 scripts/ci/libraries/_initialization.sh | 4 ----
 3 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/breeze b/breeze
index 534bec3..a10ba9c 100755
--- a/breeze
+++ b/breeze
@@ -508,6 +508,7 @@ function prepare_command_files() {
     export COMPOSE_CI_FILE
     export COMPOSE_PROD_FILE
 
+    get_base_image_version
     # Base python image for the build
     export PYTHON_BASE_IMAGE=python:${PYTHON_BASE_IMAGE_VERSION}-slim-buster
     export AIRFLOW_CI_IMAGE="${DOCKERHUB_USER}/${DOCKERHUB_REPO}:${BRANCH_NAME}-python${PYTHON_MAJOR_MINOR_VERSION}-ci"
diff --git a/scripts/ci/libraries/_build_images.sh b/scripts/ci/libraries/_build_images.sh
index ed894a1..352975b 100644
--- a/scripts/ci/libraries/_build_images.sh
+++ b/scripts/ci/libraries/_build_images.sh
@@ -311,11 +311,17 @@ function print_build_info() {
     print_info
 }
 
+function get_base_image_version() {
+    # python image version to use
+    PYTHON_BASE_IMAGE_VERSION=${PYTHON_BASE_IMAGE_VERSION:=${PYTHON_MAJOR_MINOR_VERSION}}
+}
+
 
 
 # Prepares all variables needed by the CI build. Depending on the configuration used (python version
 # DockerHub user etc. the variables are set so that other functions can use those variables.
 function prepare_ci_build() {
+    get_base_image_version
     # We use pulled docker image cache by default for CI images to  speed up the builds
     export DOCKER_CACHE=${DOCKER_CACHE:="pulled"}
     echo
@@ -591,6 +597,7 @@ Docker building ${AIRFLOW_CI_IMAGE}.
 # Prepares all variables needed by the CI build. Depending on the configuration used (python version
 # DockerHub user etc. the variables are set so that other functions can use those variables.
 function prepare_prod_build() {
+    get_base_image_version
     # We use local docker image cache by default for Production images
     export DOCKER_CACHE=${DOCKER_CACHE:="local"}
     echo
diff --git a/scripts/ci/libraries/_initialization.sh b/scripts/ci/libraries/_initialization.sh
index c41dff9..5f2a742 100644
--- a/scripts/ci/libraries/_initialization.sh
+++ b/scripts/ci/libraries/_initialization.sh
@@ -21,10 +21,6 @@ function initialize_common_environment {
     # default python Major/Minor version
     PYTHON_MAJOR_MINOR_VERSION=${PYTHON_MAJOR_MINOR_VERSION:="3.6"}
 
-    # python image version to use
-    # shellcheck disable=SC2034
-    PYTHON_BASE_IMAGE_VERSION=${PYTHON_MAJOR_MINOR_VERSION}
-
     # extra flags passed to docker run for CI image
     # shellcheck disable=SC2034
     EXTRA_DOCKER_FLAGS=()