From f669d974d3436509cc90bc208e4f6808ee3dde35 Mon Sep 17 00:00:00 2001 From: Jarek Potiuk Date: Wed, 22 Jul 2020 15:04:45 +0200 Subject: [PATCH] Python base image version is retrieved in the right place 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. --- 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 54807a91a9a19..edb122f26a724 100755 --- a/breeze +++ b/breeze @@ -526,6 +526,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 a1a8d91b56628..a4d4306f05fac 100644 --- a/scripts/ci/libraries/_build_images.sh +++ b/scripts/ci/libraries/_build_images.sh @@ -312,11 +312,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 @@ -588,6 +594,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 3fd809702b7ee..49afef0f624fd 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=()