1919
2020#  Stackable notes:
2121#  Source of this file is the upstream Apache Airflow project
22- #  https://github.com/apache/airflow/blob/main /scripts/docker/entrypoint_prod.sh
23- #  It was last synced from the upstream repo on 2023-07-31  and is up-to-date as of commit 86193f5 
24- 
22+ #  https://github.com/apache/airflow/blob/dc271d0c604ca1836ee4f943726b2d436547700f /scripts/docker/entrypoint_prod.sh
23+ #  It was last synced from the upstream repo on 2025-06-01  and is up-to-date as of commit dc271d0c604ca1836ee4f943726b2d436547700f 
24+ #  Changes we made are denoted with a comment "STACKABLE PATCH BEGIN" and # STACKABLE PATCH END 
2525
2626AIRFLOW_COMMAND=" ${1:- } " 
2727
@@ -34,9 +34,12 @@ set -euo pipefail
3434#  The side effect of this is slightly (in the range of 100s of milliseconds) slower load for any
3535#  binary started and a little memory used for Heap allocated by initialization of libstdc++
3636#  This overhead is not happening for binaries that already link dynamically libstdc++
37+ 
38+ #  STACKABLE PATCH BEGIN
39+ #  The path to this file is different on UBI
3740#  LD_PRELOAD="/usr/lib/$(uname -m)-linux-gnu/libstdc++.so.6"
38- #  Stackable: The path to this file is different on UBI
3941LD_PRELOAD=/usr/lib64/libstdc++.so.6
42+ #  STACKABLE PATCH END
4043export  LD_PRELOAD
4144
4245function  run_check_with_retries  {
@@ -161,13 +164,17 @@ function create_www_user() {
161164        exit  1
162165    fi 
163166
164-     airflow users create \
165-        --username " ${_AIRFLOW_WWW_USER_USERNAME=" admin"  } "   \
166-        --firstname " ${_AIRFLOW_WWW_USER_FIRSTNAME=" Airflow"  } "   \
167-        --lastname " ${_AIRFLOW_WWW_USER_LASTNAME=" Admin"  } "   \
168-        --email 
" ${_AIRFLOW_WWW_USER_EMAIL=" [email protected] "  } "  \
169-        --role " ${_AIRFLOW_WWW_USER_ROLE=" Admin"  } "   \
170-        --password " ${local_password} "   ||  true 
167+     if  airflow config get-value core auth_manager |  grep -q " FabAuthManager" ;  then 
168+         airflow users create \
169+            --username " ${_AIRFLOW_WWW_USER_USERNAME=" admin"  } "   \
170+            --firstname " ${_AIRFLOW_WWW_USER_FIRSTNAME=" Airflow"  } "   \
171+            --lastname " ${_AIRFLOW_WWW_USER_LASTNAME=" Admin"  } "   \
172+            --email 
" ${_AIRFLOW_WWW_USER_EMAIL=" [email protected] "  } "  \
173+            --role " ${_AIRFLOW_WWW_USER_ROLE=" Admin"  } "   \
174+            --password " ${local_password} "   ||  true 
175+     else 
176+         echo  " Skipping user creation as auth manager different from Fab is used" 
177+     fi 
171178}
172179
173180function  create_system_user_if_missing()  {
@@ -193,7 +200,7 @@ function set_pythonpath_for_root_user() {
193200    #  Now also adds applications installed as local user "airflow".
194201    if  [[ $UID  ==  " 0"   ]];  then 
195202        local  python_major_minor
196-         python_major_minor=" $( python --version  |  cut -d  "   "  -f 2  |  cut -d  " . "  -f 1-2 ) " 
203+         python_major_minor=$( python -c  ' import sys; print(f"{sys.version_info.major}.{sys.version_info.minor}") ' ) 
197204        export  PYTHONPATH=" ${AIRFLOW_USER_HOME_DIR} /.local/lib/python${python_major_minor} /site-packages:${PYTHONPATH:- } " 
198205        >&2  echo  " The container is run as root user. For security, consider using a regular user account." 
199206    fi 
@@ -204,9 +211,9 @@ function wait_for_airflow_db() {
204211    run_check_with_retries " airflow db check" 
205212}
206213
207- function  upgrade_db ()  {
208-     #  Runs airflow db upgrade 
209-     airflow db upgrade  ||  true 
214+ function  migrate_db ()  {
215+     #  Runs airflow db migrate 
216+     airflow db migrate  ||  true 
210217}
211218
212219function  wait_for_celery_broker()  {
@@ -272,7 +279,10 @@ function check_uid_gid() {
272279#  not set when PIP is run by Airflow later on
273280unset  PIP_USER
274281
275- check_uid_gid
282+ #  STACKABLE PATCH BEGIN
283+ #  Disable check for uid & gid (https://github.com/stackabletech/issues/issues/645)
284+ #  check_uid_gid
285+ #  STACKABLE PATCH END
276286
277287#  Set umask to 0002 to make all the directories created by the current user group-writeable
278288#  This allows the same directories to be writeable for any arbitrary user the image will be
@@ -292,8 +302,12 @@ if [[ "${CONNECTION_CHECK_MAX_COUNT}" -gt "0" ]]; then
292302    wait_for_airflow_db
293303fi 
294304
305+ if  [[ -n  " ${_AIRFLOW_DB_UPGRADE=} "   ]] ||  [[ -n  " ${_AIRFLOW_DB_MIGRATE=} "   ]] ;  then 
306+     migrate_db
307+ fi 
308+ 
295309if  [[ -n  " ${_AIRFLOW_DB_UPGRADE=} "   ]] ;  then 
296-     upgrade_db 
310+     >&2   echo   " WARNING: Environment variable '_AIRFLOW_DB_UPGRADE' is deprecated please use '_AIRFLOW_DB_MIGRATE' instead " 
297311fi 
298312
299313if  [[ -n  " ${_AIRFLOW_WWW_USER_CREATE=} "   ]] ;  then 
@@ -310,10 +324,13 @@ if [[ -n "${_PIP_ADDITIONAL_REQUIREMENTS=}" ]] ; then
310324    >&2  echo  "          https://airflow.apache.org/docs/docker-stack/build.html" 
311325    >&2  echo 
312326    >&2  echo  "          Adding requirements at container startup is fragile and is done every time" 
313-     >&2  echo  "          the container starts, so it is onlny  useful for testing and trying out" 
327+     >&2  echo  "          the container starts, so it is only  useful for testing and trying out" 
314328    >&2  echo  "          of adding dependencies." 
315329    >&2  echo 
316-     pip install --root-user-action ignore --no-cache-dir " ${_PIP_ADDITIONAL_REQUIREMENTS} " 
330+     #  STACKABLE PATCH BEGIN
331+     #  Add double quotes to silence Shellcheck warning SC2086
332+     pip install --root-user-action ignore " ${_PIP_ADDITIONAL_REQUIREMENTS} " 
333+     #  STACKABLE PATCH END
317334fi 
318335
319336
0 commit comments