This is an automated email from the ASF dual-hosted git repository.

potiuk pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/airflow.git


The following commit(s) were added to refs/heads/main by this push:
     new 828b5454b6f fix: default AIRFLOW_UID to 50000 in airflow-init chown 
lines (#66481)
828b5454b6f is described below

commit 828b5454b6fa82970b879902b69833c28478f226
Author: 사재혁 <[email protected]>
AuthorDate: Sat May 9 06:19:47 2026 +0900

    fix: default AIRFLOW_UID to 50000 in airflow-init chown lines (#66481)
    
    Signed-off-by: JaehyuckSa <[email protected]>
---
 .../docs/howto/docker-compose/docker-compose.yaml  |  8 +++----
 .../test_docker_compose_quick_start.py             | 27 ++++++++++++++++++++++
 2 files changed, 31 insertions(+), 4 deletions(-)

diff --git a/airflow-core/docs/howto/docker-compose/docker-compose.yaml 
b/airflow-core/docs/howto/docker-compose/docker-compose.yaml
index 655ceda9375..8114f5ec8f4 100644
--- a/airflow-core/docs/howto/docker-compose/docker-compose.yaml
+++ b/airflow-core/docs/howto/docker-compose/docker-compose.yaml
@@ -274,13 +274,13 @@ services:
         echo
         ls -la /opt/airflow/{logs,dags,plugins,config}
         echo
-        echo "Change ownership of files in /opt/airflow to ${AIRFLOW_UID}:0"
+        echo "Change ownership of files in /opt/airflow to 
${AIRFLOW_UID:-50000}:0"
         echo
-        chown -R "${AIRFLOW_UID}:0" /opt/airflow/
+        chown -R "${AIRFLOW_UID:-50000}:0" /opt/airflow/
         echo
-        echo "Change ownership of files in shared volumes to ${AIRFLOW_UID}:0"
+        echo "Change ownership of files in shared volumes to 
${AIRFLOW_UID:-50000}:0"
         echo
-        chown -v -R "${AIRFLOW_UID}:0" /opt/airflow/{logs,dags,plugins,config}
+        chown -v -R "${AIRFLOW_UID:-50000}:0" 
/opt/airflow/{logs,dags,plugins,config}
         echo
         echo "Files in shared volumes:"
         echo
diff --git a/docker-tests/tests/docker_tests/test_docker_compose_quick_start.py 
b/docker-tests/tests/docker_tests/test_docker_compose_quick_start.py
index 3cd93078431..67b5aa81e93 100644
--- a/docker-tests/tests/docker_tests/test_docker_compose_quick_start.py
+++ b/docker-tests/tests/docker_tests/test_docker_compose_quick_start.py
@@ -154,6 +154,33 @@ def 
test_trigger_dag_and_wait_for_result(default_docker_image, tmp_path_factory,
             console.print(" ".join(quoted_command))
 
 
+def test_airflow_uid_default_in_chown(tmp_path_factory, monkeypatch):
+    tmp_dir = tmp_path_factory.mktemp("airflow-uid-default")
+    compose_file_path = (
+        AIRFLOW_ROOT_PATH / "airflow-core" / "docs" / "howto" / 
"docker-compose" / "docker-compose.yaml"
+    )
+    copyfile(compose_file_path, tmp_dir / "docker-compose.yaml")
+    (tmp_dir / ".env").touch()
+    monkeypatch.delenv("AIRFLOW_UID", raising=False)
+
+    try:
+        docker.compose.version()
+    except DockerException:
+        pytest.skip("`docker compose` not available. Make sure compose plugin 
is installed")
+
+    compose = DockerClient(compose_project_directory=tmp_dir).compose
+    rendered = compose.config(return_json=True)
+
+    init_cmd = rendered["services"]["airflow-init"]["command"]  # type: 
ignore[index]
+    if isinstance(init_cmd, list):
+        init_cmd = "\n".join(str(part) for part in init_cmd)
+
+    assert 'chown -R "50000:0" /opt/airflow/' in init_cmd, init_cmd
+    assert 'chown -v -R "50000:0" /opt/airflow/{logs,dags,plugins,config}' in 
init_cmd, init_cmd
+    assert 'chown -R ":0" /opt/airflow/' not in init_cmd, init_cmd
+    assert 'chown -v -R ":0" /opt/airflow/{logs,dags,plugins,config}' not in 
init_cmd, init_cmd
+
+
 def print_diagnostics(compose: DockerClient, compose_version: str, 
docker_version: str):
     console.print("HTTP: GET health")
     try:

Reply via email to