This is an automated email from the ASF dual-hosted git repository. potiuk pushed a commit to branch fix-prod-image-ci-preparation in repository https://gitbox.apache.org/repos/asf/airflow.git
commit 34da29f58a1043875602fe07dee25b27ba26c9e0 Author: Jarek Potiuk <ja...@potiuk.com> AuthorDate: Mon Apr 15 16:08:48 2024 +0200 Fix PROD image package installation in CI When PROD image packages are installed in in CI, the local sources should not be present in the image, also constraints from sources shoudl replace the one downloaded from main. --- Dockerfile | 4 ++++ dev/breeze/src/airflow_breeze/params/build_prod_params.py | 13 +++++++++++++ scripts/docker/install_from_docker_context_files.sh | 4 ++++ 3 files changed, 21 insertions(+) diff --git a/Dockerfile b/Dockerfile index 94798fbdb7..9ae60c52bd 100644 --- a/Dockerfile +++ b/Dockerfile @@ -780,6 +780,10 @@ function install_airflow_and_providers_from_docker_context_files(){ ${ADDITIONAL_PIP_INSTALL_FLAGS} --constraint "${local_constraints_file}" \ "${install_airflow_package[@]}" "${installing_providers_packages[@]}" set +x + echo + echo "${COLOR_BLUE}Copying ${local_constraints_file} to ${HOME}/constraints.txt${COLOR_RESET}" + echo + cp "${local_constraints_file}" "${HOME}/constraints.txt" else echo echo "${COLOR_BLUE}Installing docker-context-files packages with constraints from GitHub${COLOR_RESET}" diff --git a/dev/breeze/src/airflow_breeze/params/build_prod_params.py b/dev/breeze/src/airflow_breeze/params/build_prod_params.py index d3a3dbfdbc..d6193963ce 100644 --- a/dev/breeze/src/airflow_breeze/params/build_prod_params.py +++ b/dev/breeze/src/airflow_breeze/params/build_prod_params.py @@ -143,6 +143,19 @@ class BuildProdParams(CommonBuildParams): ) self.airflow_constraints_location = constraints_location extra_build_flags.extend(self.args_for_remote_install) + elif self.install_packages_from_context: + extra_build_flags.extend( + [ + "--build-arg", + "AIRFLOW_SOURCES_FROM=/empty", + "--build-arg", + "AIRFLOW_SOURCES_TO=/empty", + "--build-arg", + f"AIRFLOW_INSTALLATION_METHOD={self.installation_method}", + "--build-arg", + f"AIRFLOW_CONSTRAINTS_REFERENCE={self.airflow_constraints_reference}", + ], + ) else: extra_build_flags.extend( [ diff --git a/scripts/docker/install_from_docker_context_files.sh b/scripts/docker/install_from_docker_context_files.sh index d6fab1e827..edcb50c82e 100644 --- a/scripts/docker/install_from_docker_context_files.sh +++ b/scripts/docker/install_from_docker_context_files.sh @@ -86,6 +86,10 @@ function install_airflow_and_providers_from_docker_context_files(){ ${ADDITIONAL_PIP_INSTALL_FLAGS} --constraint "${local_constraints_file}" \ "${install_airflow_package[@]}" "${installing_providers_packages[@]}" set +x + echo + echo "${COLOR_BLUE}Copying ${local_constraints_file} to ${HOME}/constraints.txt${COLOR_RESET}" + echo + cp "${local_constraints_file}" "${HOME}/constraints.txt" else echo echo "${COLOR_BLUE}Installing docker-context-files packages with constraints from GitHub${COLOR_RESET}"