Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix PROD image package installation in CI #39035

Merged
merged 1 commit into from
Apr 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
6 changes: 6 additions & 0 deletions docker_tests/test_prod_image.py
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,12 @@ def test_pip_dependencies_conflict(self, default_docker_image):
def test_check_dependencies_imports(self, package_name, import_names, default_docker_image):
run_python_in_docker(f"import {','.join(import_names)}", image=default_docker_image)

def test_there_is_no_opt_airflow_airflow_folder(self, default_docker_image):
output = run_bash_in_docker(
"find /opt/airflow/airflow/ 2>/dev/null | wc -l", image=default_docker_image
)
assert output == "0"


class TestExecuteAsRoot:
def test_execute_airflow_as_root(self, default_docker_image):
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