You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by po...@apache.org on 2020/06/09 09:04:38 UTC
[airflow] 25/36: Fixes a bug where `build-image` command did not
calculate md5 (#9130)
This is an automated email from the ASF dual-hosted git repository.
potiuk pushed a commit to branch v1-10-test
in repository https://gitbox.apache.org/repos/asf/airflow.git
commit c34cd6de8b6cc9b925d593e7b51035a6a3126a79
Author: Jarek Potiuk <ja...@polidea.com>
AuthorDate: Thu Jun 4 10:00:14 2020 +0200
Fixes a bug where `build-image` command did not calculate md5 (#9130)
Even if image was rebuilt, the md5 files were not updated
(cherry picked from commit d6b954d4728de97e9bbd2ba01dd4f5c19c8441bb)
---
breeze | 1 +
scripts/ci/_utils.sh | 35 +++++++++++++++++++----------------
2 files changed, 20 insertions(+), 16 deletions(-)
diff --git a/breeze b/breeze
index 7fa6e28..18a06fd 100755
--- a/breeze
+++ b/breeze
@@ -1922,6 +1922,7 @@ function run_build_command {
build_prod_image
else
prepare_ci_build
+ calculate_md5sum_for_all_files
build_ci_image
update_all_md5_files
build_ci_image_manifest
diff --git a/scripts/ci/_utils.sh b/scripts/ci/_utils.sh
index 2167229..c782ab6 100644
--- a/scripts/ci/_utils.sh
+++ b/scripts/ci/_utils.sh
@@ -347,7 +347,7 @@ function remove_cache_directory() {
# The md5sum files are stored in .build directory - you can delete this directory
# If you want to rebuild everything from the scratch
#
-function check_file_md5sum {
+function calculate_file_md5sum {
local FILE="${1}"
local MD5SUM
local MD5SUM_CACHE_DIR="${BUILD_CACHE_DIR}/${DEFAULT_BRANCH}/${PYTHON_MAJOR_MINOR_VERSION}/${THE_IMAGE_TYPE}"
@@ -408,6 +408,19 @@ function update_all_md5_files() {
touch "${BUILT_IMAGE_FLAG_FILE}"
}
+
+function calculate_md5sum_for_all_files() {
+ FILES_MODIFIED="false"
+ set +e
+ for FILE in "${FILES_FOR_REBUILD_CHECK[@]}"
+ do
+ if ! calculate_file_md5sum "${AIRFLOW_SOURCES}/${FILE}"; then
+ FILES_MODIFIED="true"
+ fi
+ done
+ set +e
+}
+
#
# Checks md5sum of all important files in order to optimise speed of running various operations
# That mount sources of Airflow to container and require docker image built with latest dependencies.
@@ -433,23 +446,13 @@ function check_if_docker_build_is_needed() {
print_info
if [[ ${FORCE_BUILD_IMAGES:=""} == "true" ]]; then
echo "Docker image build is forced for ${THE_IMAGE_TYPE} image"
- set +e
- for FILE in "${FILES_FOR_REBUILD_CHECK[@]}"
- do
- # Just store md5sum for all files in md5sum.new - do not check if it is different
- check_file_md5sum "${AIRFLOW_SOURCES}/${FILE}"
- done
- set -e
+ calculate_md5sum_for_all_files
export NEEDS_DOCKER_BUILD="true"
else
- set +e
- for FILE in "${FILES_FOR_REBUILD_CHECK[@]}"
- do
- if ! check_file_md5sum "${AIRFLOW_SOURCES}/${FILE}"; then
- export NEEDS_DOCKER_BUILD="true"
- fi
- done
- set -e
+ calculate_md5sum_for_all_files
+ if [[ ${FILES_MODIFIED} == "true" ]]; then
+ export NEEDS_DOCKER_BUILD="true"
+ fi
if [[ ${NEEDS_DOCKER_BUILD} == "true" ]]; then
echo "Docker image build is needed for ${THE_IMAGE_TYPE} image!"
else