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 5acb266
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
7 changes: 7 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -759,6 +759,9 @@ function install_airflow_and_providers_from_docker_context_files(){
install_airflow_package=("apache-airflow[${AIRFLOW_EXTRAS}]==${AIRFLOW_VERSION}")
fi

# Delete sources for airflow and providers so that the they are not used accidentally
rm -rf "/opt/airflow/*"

# Find Provider packages in docker-context files
readarray -t installing_providers_packages< <(python /scripts/docker/get_package_specs.py /docker-context-files/apache?airflow?providers*.{whl,tar.gz} 2>/dev/null || true)
echo
Expand All @@ -780,6 +783,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
7 changes: 7 additions & 0 deletions scripts/docker/install_from_docker_context_files.sh
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,9 @@ function install_airflow_and_providers_from_docker_context_files(){
install_airflow_package=("apache-airflow[${AIRFLOW_EXTRAS}]==${AIRFLOW_VERSION}")
fi

# Delete sources for airflow and providers so that the they are not used accidentally
rm -rf "/opt/airflow/*"

# Find Provider packages in docker-context files
readarray -t installing_providers_packages< <(python /scripts/docker/get_package_specs.py /docker-context-files/apache?airflow?providers*.{whl,tar.gz} 2>/dev/null || true)
echo
Expand All @@ -86,6 +89,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 5acb266

Please sign in to comment.