Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FIX Entrypoint and _CMD config variables (#8705) #8707

Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 21 additions & 9 deletions entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -90,16 +90,28 @@ function verify_db_connection {
fi
}

# if no DB configured - use sqlite db by default
AIRFLOW__CORE__SQL_ALCHEMY_CONN="${AIRFLOW__CORE__SQL_ALCHEMY_CONN:="sqlite:///${AIRFLOW_HOME}/airflow.db"}"

verify_db_connection "${AIRFLOW__CORE__SQL_ALCHEMY_CONN}"

AIRFLOW__CELERY__BROKER_URL=${AIRFLOW__CELERY__BROKER_URL:=}
# Warning: command environnement variables (*_CMD) have priority over usual configuration variables
# for configuration parameters that require sensitive information. This is the case for the SQL database
# and the broker backend in this entrypoint script.

if [[ -n "$AIRFLOW__CORE__SQL_ALCHEMY_CONN_CMD" ]]; then
verify_db_connection "$(eval "$AIRFLOW__CORE__SQL_ALCHEMY_CONN_CMD")"
else
# if no DB configured - use sqlite db by default
AIRFLOW__CORE__SQL_ALCHEMY_CONN="${AIRFLOW__CORE__SQL_ALCHEMY_CONN:="sqlite:///${AIRFLOW_HOME}/airflow.db"}"
verify_db_connection "${AIRFLOW__CORE__SQL_ALCHEMY_CONN}"
fi

if [[ -n ${AIRFLOW__CELERY__BROKER_URL} ]] && \
[[ ${AIRFLOW_COMMAND} =~ ^(scheduler|worker|flower)$ ]]; then
verify_db_connection "${AIRFLOW__CELERY__BROKER_URL}"
# Note: the broker backend configuration concerns only a subset of Airflow components
if [[ "${AIRFLOW_COMMAND}" =~ ^(scheduler|worker|flower)$ ]]; then
if [[ -n "$AIRFLOW__CELERY__BROKER_URL_CMD" ]]; then
verify_db_connection "$(eval "$AIRFLOW__CELERY__BROKER_URL_CMD")"
else
AIRFLOW__CELERY__BROKER_URL=${AIRFLOW__CELERY__BROKER_URL:=}
if [[ -n "${AIRFLOW__CELERY__BROKER_URL}" ]]; then
verify_db_connection "${AIRFLOW__CELERY__BROKER_URL}"
fi
fi
fi

if [[ ${AIRFLOW_COMMAND} == "" ]]; then
Expand Down