Skip to content

Commit 01edc7e

Browse files
committed
Workaround docker-compose-v2 env passing (#18887)
* Workaround docker-compose-v2 env passing Docker Compose v2 has environment parsing broken in many ways. Until this is fixed, we cannot use env files, instead we must set all the variables directly, because parsing variables without values or parsing variables which have empty values is broken in several ways. Some of the issues are closed but not released, and until this is fixed, some extra code duplication and explicitly setting all default variables to "" when needed should solve the problem for both Docker-Compose v1 and Docker-Compose v2 (cherry picked from commit ab5b2bf)
1 parent 97d90c1 commit 01edc7e

File tree

5 files changed

+90
-70
lines changed

5 files changed

+90
-70
lines changed

breeze

+11-18
Original file line numberDiff line numberDiff line change
@@ -567,24 +567,6 @@ EOF
567567
# Those are a convenience scripts that you might use to debug command execution although
568568
# In most cases they are used internally by Breeze.
569569
#
570-
# Used Globals:
571-
# BRANCH_NAME
572-
# PYTHON_MAJOR_MINOR_VERSION
573-
# BACKEND
574-
# AIRFLOW_VERSION
575-
# INSTALL_AIRFLOW_VERSION
576-
# SSH_PORT
577-
# WEBSERVER_HOST_PORT
578-
# POSTGRES_HOST_PORT
579-
# POSTGRES_VERSION
580-
# MYSQL_HOST_PORT
581-
# MYSQL_VERSION
582-
# AIRFLOW_SOURCES
583-
# AIRFLOW_CI_IMAGE
584-
# AIRFLOW_PROD_IMAGE
585-
# AIRFLOW_IMAGE_KUBERNETES
586-
# SQLITE_URL
587-
#
588570
# Arguments:
589571
#
590572
# file to prepare
@@ -657,6 +639,17 @@ export SQLITE_URL="${SQLITE_URL}"
657639
export USE_AIRFLOW_VERSION="${USE_AIRFLOW_VERSION}"
658640
export USE_PACKAGES_FROM_DIST="${USE_PACKAGES_FROM_DIST}"
659641
export EXECUTOR="${EXECUTOR}"
642+
export START_AIRFLOW="${START_AIRFLOW}"
643+
export ENABLED_INTEGRATIONS="${ENABLED_INTEGRATIONS}"
644+
export ENABLED_SYSTEMS="${ENABLED_SYSTEMS}"
645+
export GITHUB_ACTIONS="${GITHUB_ACTIONS}"
646+
export ISSUE_ID="${ISSUE_ID}"
647+
export NUM_RUNS="${NUM_RUNS}"
648+
export RUN_TESTS="${RUN_TESTS}"
649+
export RUN_INTEGRATION_TESTS="${RUN_INTEGRATION_TESTS}"
650+
export RUN_SYSTEM_TESTS="${RUN_SYSTEM_TESTS}"
651+
export VERSION_SUFFIX_FOR_SVN="${VERSION_SUFFIX_FOR_SVN}"
652+
export VERSION_SUFFIX_FOR_PYPI="${VERSION_SUFFIX_FOR_PYPI}"
660653
docker-compose ${command}
661654
EOF
662655
chmod u+x "${file}"

scripts/ci/docker-compose/_docker_compose.env

-49
This file was deleted.

scripts/ci/docker-compose/base.yml

+50-2
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,56 @@ services:
2626
- CELERY_BROKER_URLS=amqp://guest:guest@rabbitmq:5672,redis://redis:6379/0
2727
- KUBECONFIG=/files/.kube/config
2828
- HOST_HOME=${HOME}
29-
env_file:
30-
- _docker_compose.env
29+
# We need all those env variables here because docker-compose-v2 does not really work well
30+
# With env files and there are many problems with it:
31+
- AIRFLOW_CI_IMAGE=${AIRFLOW_CI_IMAGE}
32+
- AIRFLOW_EXTRAS=${AIRFLOW_EXTRAS}
33+
- BACKEND=${BACKEND}
34+
- BREEZE=${BREEZE}
35+
- CI=${CI}
36+
- CI_BUILD_ID=${CI_BUILD_ID}
37+
- CI_JOB_ID=${CI_JOB_ID}
38+
- CI_EVENT_TYPE=${CI_EVENT_TYPE}
39+
- CI_TARGET_REPO=${CI_TARGET_REPO}
40+
- CI_TARGET_BRANCH=${CI_TARGET_BRANCH}
41+
- COMMIT_SHA=${COMMIT_SHA}
42+
- DB_RESET=${DB_RESET}
43+
- DEFAULT_BRANCH=${DEFAULT_BRANCH}
44+
- DEFAULT_CONSTRAINTS_BRANCH=${DEFAULT_CONSTRAINTS_BRANCH}
45+
- ENABLED_INTEGRATIONS=${ENABLED_INTEGRATIONS}
46+
- ENABLED_SYSTEMS=${ENABLED_SYSTEMS}
47+
- GITHUB_ACTIONS=${GITHUB_ACTIONS}
48+
- GITHUB_REGISTRY_PULL_IMAGE_TAG=${GITHUB_REGISTRY_PULL_IMAGE_TAG}
49+
- HOST_USER_ID=${HOST_USER_ID}
50+
- HOST_GROUP_ID=${HOST_GROUP_ID}
51+
- HOST_OS=${HOST_OS}
52+
- INIT_SCRIPT_FILE=${INIT_SCRIPT_FILE}
53+
- INSTALL_AIRFLOW_VERSION=${INSTALL_AIRFLOW_VERSION}
54+
- GENERATE_CONSTRAINTS_MODE=${GENERATE_CONSTRAINTS_MODE}
55+
- INSTALL_PROVIDERS_FROM_SOURCES=${INSTALL_PROVIDERS_FROM_SOURCES}
56+
- USE_AIRFLOW_VERSION=${USE_AIRFLOW_VERSION}
57+
- USE_PACKAGES_FROM_DIST=${USE_PACKAGES_FROM_DIST}
58+
- ISSUE_ID=${ISSUE_ID}
59+
- LOAD_DEFAULT_CONNECTIONS=${LOAD_DEFAULT_CONNECTIONS}
60+
- LOAD_EXAMPLES=${LOAD_EXAMPLES}
61+
- MYSQL_VERSION=${MYSQL_VERSION}
62+
- NUM_RUNS=${NUM_RUNS}
63+
- PACKAGE_FORMAT=${PACKAGE_FORMAT}
64+
- POSTGRES_VERSION=${POSTGRES_VERSION}
65+
- PRINT_INFO_FROM_SCRIPTS=${PRINT_INFO_FROM_SCRIPTS}
66+
- PYTHONDONTWRITEBYTECODE=${PYTHONDONTWRITEBYTECODE}
67+
- PYTHON_MAJOR_MINOR_VERSION=${PYTHON_MAJOR_MINOR_VERSION}
68+
- RUN_TESTS=${RUN_TESTS}
69+
- RUN_INTEGRATION_TESTS=${RUN_INTEGRATION_TESTS}
70+
- RUN_SYSTEM_TESTS=${RUN_SYSTEM_TESTS}
71+
- START_AIRFLOW=${START_AIRFLOW}
72+
- TEST_TYPE=${TEST_TYPE}
73+
- UPGRADE_TO_NEWER_DEPENDENCIES=${UPGRADE_TO_NEWER_DEPENDENCIES}
74+
- VERBOSE=${VERBOSE}
75+
- VERBOSE_COMMANDS=${VERBOSE_COMMANDS}
76+
- VERSION_SUFFIX_FOR_PYPI=${VERSION_SUFFIX_FOR_PYPI}
77+
- VERSION_SUFFIX_FOR_SVN=${VERSION_SUFFIX_FOR_SVN}
78+
- WHEEL_VERSION=${WHEEL_VERSION}
3179
volumes:
3280
# Pass docker to inside of the container so that Kind and Moto tests can use it.
3381
- /var/run/docker.sock:/var/run/docker.sock

scripts/ci/libraries/_initialization.sh

+27
Original file line numberDiff line numberDiff line change
@@ -311,6 +311,19 @@ function initialization::initialize_force_variables() {
311311

312312
# Can be set to true to skip if the image is newer in registry
313313
export SKIP_CHECK_REMOTE_IMAGE=${SKIP_CHECK_REMOTE_IMAGE:="false"}
314+
315+
# integrations are disabled by default
316+
export ENABLED_INTEGRATIONS=${ENABLED_INTEGRATIONS:=""}
317+
318+
# systems are disabled by default
319+
export ENABLED_SYSTEMS=${ENABLED_SYSTEMS:=""}
320+
321+
# no issue id by default (quarantined builds only)
322+
export ISSUE_ID=${ISSUE_ID:=""}
323+
324+
# no NUM_RUNS by default (quarantined builds only)
325+
export NUM_RUNS=${NUM_RUNS:=""}
326+
314327
}
315328

316329
# Determine information about the host
@@ -576,10 +589,24 @@ function initialization::initialize_test_variables() {
576589
# In case we want to force certain test type to run, this variable should be set to this type
577590
# Otherwise TEST_TYPEs to run will be derived from TEST_TYPES space-separated string
578591
export FORCE_TEST_TYPE=${FORCE_TEST_TYPE:=""}
592+
593+
# Do not run tests by default
594+
export RUN_TESTS=${RUN_TESTS:="false"}
595+
596+
# Do not run integration tests by default
597+
export RUN_INTEGRATION_TESTS=${RUN_INTEGRATION_TESTS:="false"}
598+
599+
# Do not run system tests by default
600+
export RUN_SYSTEM_TESTS=${RUN_SYSTEM_TESTS:="false"}
601+
579602
}
580603

581604
function initialization::initialize_package_variables() {
605+
# default package format
582606
export PACKAGE_FORMAT=${PACKAGE_FORMAT:="wheel"}
607+
# default version suffixes
608+
export VERSION_SUFFIX_FOR_PYPI=${VERSION_SUFFIX_FOR_PYPI:=""}
609+
export VERSION_SUFFIX_FOR_SVN=${VERSION_SUFFIX_FOR_SVN:=""}
583610
}
584611

585612

scripts/in_container/entrypoint_ci.sh

+2-1
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ else
5252
export RUN_AIRFLOW_1_10="false"
5353
fi
5454

55-
if [[ -z ${USE_AIRFLOW_VERSION=} ]]; then
55+
if [[ ${USE_AIRFLOW_VERSION} == "" ]]; then
5656
export PYTHONPATH=${AIRFLOW_SOURCES}
5757
echo
5858
echo "Using already installed airflow version"
@@ -184,6 +184,7 @@ ssh-keyscan -H localhost >> ~/.ssh/known_hosts 2>/dev/null
184184

185185
cd "${AIRFLOW_SOURCES}"
186186

187+
echo "START_AIRFLOW:=${START_AIRFLOW}"
187188
if [[ ${START_AIRFLOW:="false"} == "true" ]]; then
188189
export AIRFLOW__CORE__LOAD_DEFAULT_CONNECTIONS=${LOAD_DEFAULT_CONNECTIONS}
189190
export AIRFLOW__CORE__LOAD_EXAMPLES=${LOAD_EXAMPLES}

0 commit comments

Comments
 (0)