Skip to content

Commit

Permalink
Fix PROD image package installation in CI
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
potiuk committed Apr 15, 2024
1 parent ae320ca commit 3dbbe4a
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 0 deletions.
4 changes: 4 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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}"
Expand Down
13 changes: 13 additions & 0 deletions dev/breeze/src/airflow_breeze/params/build_prod_params.py
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,19 @@ def _extra_prod_docker_build_flags(self) -> list[str]:
)
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(
[
Expand Down
4 changes: 4 additions & 0 deletions scripts/docker/install_from_docker_context_files.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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}"
Expand Down

0 comments on commit 3dbbe4a

Please sign in to comment.