Skip to content

Commit

Permalink
Fix compatibility issues with docker-compose 2 (#18725)
Browse files Browse the repository at this point in the history
Docker-compose 2 on linux introduced a number of problems and
incompatibilities:

* version is printed in different format
* -f flag was failing after --log-level info was passed
* environment variables were not correctly passed with _docker.env
  with missing values

All those worked fine in 1.29.2 and even in MacOS version of
docker-compose 2 (after raising and fixing some bugs by us
docker-archive/compose-cli#1917

This PR:

* fixes version regexp
* removes --log-level info
* adds copy of _docker.env with var="${var} assignments specifically
  for docker-compose (duplicated variables but this works as a
  workaround)

GitOrigin-RevId: 2630341d0f5088215798719a5418a3e77abbc5c7
  • Loading branch information
potiuk authored and Cloud Composer Team committed Jul 10, 2022
1 parent 61186c3 commit b9d1192
Show file tree
Hide file tree
Showing 4 changed files with 52 additions and 3 deletions.
2 changes: 1 addition & 1 deletion breeze
Original file line number Diff line number Diff line change
Expand Up @@ -593,7 +593,7 @@ function breeze::prepare_command_file() {
cat <<EOF >"${file}"
#!/usr/bin/env bash
docker_compose_version=\$(docker-compose --version || true)
if [[ \${docker_compose_version} =~ .*([0-9]+)\.([0-9]+)\.([0-9]+).+ ]]; then
if [[ \${docker_compose_version} =~ .*([0-9]+)\.([0-9]+)\.([0-9]+).* ]]; then
major=\${BASH_REMATCH[1]}
minor=\${BASH_REMATCH[2]}
patch=\${BASH_REMATCH[3]}
Expand Down
49 changes: 49 additions & 0 deletions scripts/ci/docker-compose/_docker_compose.env
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
AIRFLOW_CI_IMAGE="${AIRFLOW_CI_IMAGE}"
AIRFLOW_EXTRAS="${AIRFLOW_EXTRAS}"
BACKEND="${BACKEND}"
BREEZE="${BREEZE}"
CI="${CI}"
CI_BUILD_ID="${CI_BUILD_ID}"
CI_JOB_ID="${CI_JOB_ID}"
CI_EVENT_TYPE="${CI_EVENT_TYPE}"
CI_TARGET_REPO="${CI_TARGET_REPO}"
CI_TARGET_BRANCH="${CI_TARGET_BRANCH}"
COMMIT_SHA="${COMMIT_SHA}"
DB_RESET="${DB_RESET}"
DEFAULT_BRANCH="${DEFAULT_BRANCH}"
DEFAULT_CONSTRAINTS_BRANCH="${DEFAULT_CONSTRAINTS_BRANCH}"
ENABLED_INTEGRATIONS="${ENABLED_INTEGRATIONS}"
ENABLED_SYSTEMS="${ENABLED_SYSTEMS}"
GITHUB_ACTIONS="${GITHUB_ACTIONS}"
GITHUB_REGISTRY_PULL_IMAGE_TAG="${GITHUB_REGISTRY_PULL_IMAGE_TAG}"
HOST_USER_ID="${HOST_USER_ID}"
HOST_GROUP_ID="${HOST_GROUP_ID}"
HOST_OS="${HOST_OS}"
HOST_HOME="${HOST_HOME}"
INIT_SCRIPT_FILE="${INIT_SCRIPT_FILE}"
INSTALL_AIRFLOW_VERSION="${INSTALL_AIRFLOW_VERSION}"
GENERATE_CONSTRAINTS_MODE="${GENERATE_CONSTRAINTS_MODE}"
INSTALL_PROVIDERS_FROM_SOURCES="${INSTALL_PROVIDERS_FROM_SOURCES}"
USE_AIRFLOW_VERSION="${USE_AIRFLOW_VERSION}"
USE_PACKAGES_FROM_DIST="${USE_PACKAGES_FROM_DIST}"
ISSUE_ID="${ISSUE_ID}"
LOAD_DEFAULT_CONNECTIONS="${LOAD_DEFAULT_CONNECTIONS}"
LOAD_EXAMPLES="${LOAD_EXAMPLES}"
MYSQL_VERSION="${MYSQL_VERSION}"
NUM_RUNS="${NUM_RUNS}"
PACKAGE_FORMAT="${PACKAGE_FORMAT}"
POSTGRES_VERSION="${POSTGRES_VERSION}"
PRINT_INFO_FROM_SCRIPTS="${PRINT_INFO_FROM_SCRIPTS}"
PYTHONDONTWRITEBYTECODE="${PYTHONDONTWRITEBYTECODE}"
PYTHON_MAJOR_MINOR_VERSION="${PYTHON_MAJOR_MINOR_VERSION}"
RUN_TESTS="${RUN_TESTS}"
RUN_INTEGRATION_TESTS="${RUN_INTEGRATION_TESTS}"
RUN_SYSTEM_TESTS="${RUN_SYSTEM_TESTS}"
START_AIRFLOW="${START_AIRFLOW}"
TEST_TYPE="${TEST_TYPE}"
UPGRADE_TO_NEWER_DEPENDENCIES="${UPGRADE_TO_NEWER_DEPENDENCIES}"
VERBOSE="${VERBOSE}"
VERBOSE_COMMANDS="${VERBOSE_COMMANDS}"
VERSION_SUFFIX_FOR_PYPI="${VERSION_SUFFIX_FOR_PYPI}"
VERSION_SUFFIX_FOR_SVN="${VERSION_SUFFIX_FOR_SVN}"
WHEEL_VERSION="${WHEEL_VERSION}"
2 changes: 1 addition & 1 deletion scripts/ci/docker-compose/base.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ services:
- KUBECONFIG=/files/.kube/config
- HOST_HOME=${HOME}
env_file:
- _docker.env
- _docker_compose.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
Expand Down
2 changes: 1 addition & 1 deletion scripts/ci/testing/ci_run_single_airflow_test_in_docker.sh
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ function run_airflow_testing_in_docker() {
fi
echo "Making sure docker-compose is down and remnants removed"
echo
docker-compose --log-level INFO -f "${SCRIPTS_CI_DIR}/docker-compose/base.yml" \
docker-compose -f "${SCRIPTS_CI_DIR}/docker-compose/base.yml" \
--project-name "airflow-${TEST_TYPE}-${BACKEND}" \
down --remove-orphans \
--volumes --timeout 10
Expand Down

0 comments on commit b9d1192

Please sign in to comment.