You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@superset.apache.org by jl...@apache.org on 2026/07/20 17:01:05 UTC

(superset) 01/01: fix(docker): isolate tagged images from host packages

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

sadpandajoe pushed a commit to branch fix/docker-compose-python-311-ci
in repository https://gitbox.apache.org/repos/asf/superset.git

commit 6b828a6f667ce0b58b3046f6546ddc0afec3a139
Author: Joe Li <jo...@preset.io>
AuthorDate: Mon Jul 20 10:00:13 2026 -0700

    fix(docker): isolate tagged images from host packages
---
 docker-compose-image-tag.yml                      |  8 +++-
 scripts/change_detector.py                        |  1 +
 tests/unit_tests/docker_compose_image_tag_test.py | 46 +++++++++++++++++++++++
 tests/unit_tests/scripts/change_detector_test.py  |  7 ++++
 4 files changed, 61 insertions(+), 1 deletion(-)

diff --git a/docker-compose-image-tag.yml b/docker-compose-image-tag.yml
index fd76e68abcd..265499e0cde 100644
--- a/docker-compose-image-tag.yml
+++ b/docker-compose-image-tag.yml
@@ -28,8 +28,10 @@ x-superset-image: &superset-image apachesuperset.docker.scarf.sh/apache/superset
 x-superset-volumes:
   &superset-volumes # /app/pythonpath_docker will be appended to the PYTHONPATH in the final container
   - ./docker:/app/docker
-  - ./superset-core:/app/superset-core
   - superset_home:/app/superset_home
+x-superset-environment: &superset-environment
+  # Tagged images must use their bundled packages rather than host bind mounts.
+  DEV_MODE: "false"
 
 services:
   redis:
@@ -58,6 +60,7 @@ services:
         required: true
       - path: docker/.env-local # optional override
         required: false
+    environment: *superset-environment
     image: *superset-image
     container_name: superset_app
     command: ["/app/docker/docker-bootstrap.sh", "app-gunicorn"]
@@ -79,6 +82,7 @@ services:
         required: true
       - path: docker/.env-local # optional override
         required: false
+    environment: *superset-environment
     depends_on:
       db:
         condition: service_started
@@ -98,6 +102,7 @@ services:
         required: true
       - path: docker/.env-local # optional override
         required: false
+    environment: *superset-environment
     restart: unless-stopped
     depends_on:
       superset-init:
@@ -120,6 +125,7 @@ services:
         required: true
       - path: docker/.env-local # optional override
         required: false
+    environment: *superset-environment
     restart: unless-stopped
     depends_on:
       superset-init:
diff --git a/scripts/change_detector.py b/scripts/change_detector.py
index 55548b270b0..fac6caa3ba4 100755
--- a/scripts/change_detector.py
+++ b/scripts/change_detector.py
@@ -39,6 +39,7 @@ RETRYABLE_STATUS_CODES: frozenset[int] = frozenset({403, 429})
 PATTERNS = {
     "python": [
         r"^\.github/workflows/.*python",
+        r"^docker-compose-image-tag\.yml$",
         r"^tests/",
         r"^superset/",
         r"^scripts/",
diff --git a/tests/unit_tests/docker_compose_image_tag_test.py b/tests/unit_tests/docker_compose_image_tag_test.py
new file mode 100644
index 00000000000..7f2d4003a13
--- /dev/null
+++ b/tests/unit_tests/docker_compose_image_tag_test.py
@@ -0,0 +1,46 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+from pathlib import Path
+
+import yaml
+
+
+def test_image_tag_services_use_bundled_packages() -> None:
+    repository_root = Path(__file__).resolve().parents[2]
+    compose = yaml.safe_load(
+        (repository_root / "docker-compose-image-tag.yml").read_text(),
+    )
+    image = compose["x-superset-image"]
+    image_services = [
+        service
+        for service in compose["services"].values()
+        if service.get("image") == image
+    ]
+
+    assert image_services
+    assert all(
+        service.get("environment", {}).get("DEV_MODE") == "false"
+        for service in image_services
+    )
+    assert all(
+        all(
+            not isinstance(volume, str) or ":/app/superset-core" not in volume
+            for volume in service.get("volumes", [])
+        )
+        for service in image_services
+    )
diff --git a/tests/unit_tests/scripts/change_detector_test.py b/tests/unit_tests/scripts/change_detector_test.py
index 69cf4dccce2..af60b1eb4a4 100644
--- a/tests/unit_tests/scripts/change_detector_test.py
+++ b/tests/unit_tests/scripts/change_detector_test.py
@@ -94,3 +94,10 @@ def test_fetch_gives_up_after_max_retries() -> None:
             change_detector.fetch_files_github_api("http://api")
 
     assert urlopen_mock.call_count == change_detector.MAX_RETRIES
+
+
+def test_image_tag_compose_changes_trigger_python_tests() -> None:
+    assert change_detector.detect_changes(
+        ["docker-compose-image-tag.yml"],
+        change_detector.PATTERNS["python"],
+    )