From 0efe94fd0885cf238e58f6344aedd03518a35028 Mon Sep 17 00:00:00 2001 From: Jarek Potiuk Date: Wed, 14 Jul 2021 10:30:00 +0200 Subject: [PATCH] Errors out instead of trying to workaround buggy docker-compose v2 Docker-Compose v2 Beta has an error in processing environment variable file which prevents Breeze from running. Until it is fixed, we are going to print an error, explain how to disable it and exit - because the workaround introduces more problems than it solves (passing environment variables to container is broken partially) Also see https://github.com/docker/compose-cli/issues/1917 --- breeze | 16 +++++ scripts/ci/docker-compose/_docker_compose.env | 70 ------------------- scripts/ci/docker-compose/base.yml | 2 +- 3 files changed, 17 insertions(+), 71 deletions(-) delete mode 100644 scripts/ci/docker-compose/_docker_compose.env diff --git a/breeze b/breeze index b026ebb305477..0d209af78974e 100755 --- a/breeze +++ b/breeze @@ -590,6 +590,22 @@ function breeze::prepare_command_file() { local compose_file="${3}" cat <"${file}" #!/usr/bin/env bash +docker_compose_version=\$(docker-compose --version) +if [[ \${docker_compose_version} =~ .*version\ 2.* ]]; then + echo + echo "${COLOR_RED}Docker Compose Beta version 2has 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 +fi + if [[ \${VERBOSE} == "true" ]]; then echo echo "Executing script:" diff --git a/scripts/ci/docker-compose/_docker_compose.env b/scripts/ci/docker-compose/_docker_compose.env deleted file mode 100644 index b842270fee372..0000000000000 --- a/scripts/ci/docker-compose/_docker_compose.env +++ /dev/null @@ -1,70 +0,0 @@ -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance -# with the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. -# -# Until https://github.com/docker/compose-cli/issues/1917 is resolved -# we need to keep this docker_compose.env separately to accoun for different -# behaviour of Docker-Compose V2 Beta (which became default for MacOS users updating -# their Docker Desktop to a newer version -# -AIRFLOW_CI_IMAGE= -AIRFLOW_EXTRAS= -BACKEND= -BREEZE= -CI= -CI_BUILD_ID= -CI_JOB_ID= -CI_EVENT_TYPE= -CI_TARGET_REPO= -CI_TARGET_BRANCH= -COMMIT_SHA= -DB_RESET= -DEFAULT_CONSTRAINTS_BRANCH= -ENABLED_INTEGRATIONS= -ENABLED_SYSTEMS= -GITHUB_ACTIONS= -GITHUB_REGISTRY_PULL_IMAGE_TAG= -HOST_USER_ID= -HOST_GROUP_ID= -HOST_OS= -HOST_HOME= -INIT_SCRIPT_FILE= -INSTALL_AIRFLOW_VERSION= -GENERATE_CONSTRAINTS_MODE= -INSTALL_PROVIDERS_FROM_SOURCES= -USE_AIRFLOW_VERSION= -USE_PACKAGES_FROM_DIST= -ISSUE_ID= -LOAD_DEFAULT_CONNECTIONS= -LOAD_EXAMPLES= -MYSQL_VERSION= -NUM_RUNS= -PACKAGE_FORMAT= -POSTGRES_VERSION= -PRINT_INFO_FROM_SCRIPTS= -PYTHONDONTWRITEBYTECODE= -PYTHON_MAJOR_MINOR_VERSION= -RUN_TESTS= -RUN_INTEGRATION_TESTS= -RUN_SYSTEM_TESTS= -START_AIRFLOW= -TEST_TYPE= -UPGRADE_TO_NEWER_DEPENDENCIES= -VERBOSE= -VERBOSE_COMMANDS= -VERSION_SUFFIX_FOR_PYPI= -VERSION_SUFFIX_FOR_SVN= -WHEEL_VERSION= diff --git a/scripts/ci/docker-compose/base.yml b/scripts/ci/docker-compose/base.yml index 4e5c20354da49..255bb74f46531 100644 --- a/scripts/ci/docker-compose/base.yml +++ b/scripts/ci/docker-compose/base.yml @@ -26,7 +26,7 @@ services: - KUBECONFIG=/files/.kube/config - HOST_HOME=${HOME} env_file: - - _docker_compose.env + - _docker.env volumes: # Pass docker to inside of the container so that Kind and Moto tests can use it. - /var/run/docker.sock:/var/run/docker.sock