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 2021/09/29 17:58:15 UTC
[airflow] branch main updated: Check docker-compose version in
breeze (#18536)
This is an automated email from the ASF dual-hosted git repository.
potiuk pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/airflow.git
The following commit(s) were added to refs/heads/main by this push:
new d2bdf05 Check docker-compose version in breeze (#18536)
d2bdf05 is described below
commit d2bdf05cf04414ec2c973cdec0f970bf96c3a0e2
Author: Jarek Potiuk <ja...@potiuk.com>
AuthorDate: Wed Sep 29 19:57:53 2021 +0200
Check docker-compose version in breeze (#18536)
We started to use some newer features in docker-compose of breeze.
They are new enough (May 2020) that older versions of
docker-compose do not work with them.
This PR checks if the docker-compose is >= 1.29
---
breeze | 36 ++++++++++++++++++++---------------
confirm | 2 +-
scripts/ci/libraries/_build_images.sh | 2 +-
3 files changed, 23 insertions(+), 17 deletions(-)
diff --git a/breeze b/breeze
index 9a818de..f3a44f4 100755
--- a/breeze
+++ b/breeze
@@ -592,20 +592,27 @@ function breeze::prepare_command_file() {
local compose_file="${3}"
cat <<EOF >"${file}"
#!/usr/bin/env bash
-docker_compose_version=\$(docker-compose --version)
-if [[ \${docker_compose_version} =~ .*version\ v2.* ]]; then
- echo
- echo "${COLOR_RED}Docker Compose Beta version v2 has a bug that prevents breeze from running.${COLOR_RESET}"
- echo "${COLOR_RED}You have: \${docker_compose_version}.${COLOR_RESET}"
- echo
- echo "${COLOR_YELLOW}Please switch to stable version via Docker Desktop -> Experimental or by running:${COLOR_RESET}"
- echo
- echo "${COLOR_CYAN}docker-compose disable-v2${COLOR_RESET}"
- echo
- echo "${COLOR_YELLOW}Also please upvote https://github.com/docker/compose-cli/issues/1917${COLOR_RESET}"
- echo
- echo "${COLOR_RED}Exiting until you disable v2 version.${COLOR_RESET}"
- exit 1
+docker_compose_version=\$(docker-compose --version || true)
+if [[ \${docker_compose_version} =~ .*([0-9]+)\.([0-9]+)\.([0-9]+).+ ]]; then
+ major=\${BASH_REMATCH[1]}
+ minor=\${BASH_REMATCH[2]}
+ patch=\${BASH_REMATCH[3]}
+ if [[ \${major} == "1" ]]; then
+ if (( minor < 29 )); then
+ echo
+ echo "${COLOR_RED}You have too old version of docker-compose: \${major}.\${minor}.\${patch}! At least 1.29 is needed! Please upgrade!${COLOR_RESET}"
+ echo "${COLOR_RED}See https://docs.docker.com/compose/install/ for instructions. Make sure docker-compose you install is first on the PATH variable of yours.${COLOR_RESET}"
+ echo
+ exit 1
+ fi
+ fi
+ echo
+ echo "${COLOR_GREEN}Good version of docker-compose: \${major}.\${minor}.\${patch}${COLOR_RESET}"
+ echo
+else
+ echo
+ echo "${COLOR_YELLOW}Unknown docker-compose version. At least 1.29 is needed! If Breeze fails - upgrade to latest available docker-compose version${COLOR_RESET}"
+ echo
fi
if [[ \${VERBOSE} == "true" ]]; then
@@ -3580,7 +3587,6 @@ function breeze::determine_python_version_to_use_in_breeze() {
export PYTHON_MAJOR_MINOR_VERSION
}
-
breeze::setup_default_breeze_constants
initialization::create_directories
diff --git a/confirm b/confirm
index 42316da..c5cfe16 100755
--- a/confirm
+++ b/confirm
@@ -35,7 +35,7 @@ else
read -t 4 -r RESPONSE
fi
-case "${RESPONSE}" in
+case "${RESPONSE="N"}" in
[yY][eE][sS]|[yY])
echo "The answer is 'yes'. ${1}. This can take some time!"
exit 0
diff --git a/scripts/ci/libraries/_build_images.sh b/scripts/ci/libraries/_build_images.sh
index 6291519..b2273a8 100644
--- a/scripts/ci/libraries/_build_images.sh
+++ b/scripts/ci/libraries/_build_images.sh
@@ -282,7 +282,7 @@ function build_images::get_local_build_cache_hash() {
return
fi
- docker_v create --name "local-airflow-ci-container" "${AIRFLOW_CI_IMAGE}" 2>/dev/null
+ docker_v create --name "local-airflow-ci-container" "${AIRFLOW_CI_IMAGE}" 2>/dev/null >/dev/null
docker_v cp "local-airflow-ci-container:/build-cache-hash" \
"${local_image_build_cache_file}" 2>/dev/null ||
touch "${local_image_build_cache_file}"