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

vincbeck 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 65691943e1a Create multi-team config flag (#56013)
65691943e1a is described below

commit 65691943e1aecfe5225a13c3fbaf7e8048836022
Author: Vincent <[email protected]>
AuthorDate: Thu Sep 25 10:03:11 2025 -0400

    Create multi-team config flag (#56013)
---
 airflow-core/src/airflow/config_templates/config.yml       |  9 +++++++++
 airflow-core/src/airflow/dag_processing/bundles/manager.py |  7 +++++++
 .../unit/dag_processing/bundles/test_dag_bundle_manager.py | 14 ++++++++++++++
 airflow-core/tests/unit/dag_processing/test_manager.py     |  1 +
 4 files changed, 31 insertions(+)

diff --git a/airflow-core/src/airflow/config_templates/config.yml 
b/airflow-core/src/airflow/config_templates/config.yml
index d9ab15799f6..0a8d29eb41b 100644
--- a/airflow-core/src/airflow/config_templates/config.yml
+++ b/airflow-core/src/airflow/config_templates/config.yml
@@ -509,6 +509,15 @@ core:
       type: string
       example: ~
       default: ~
+    multi_team:
+      description: |
+        Whether to run the Airflow environment in multi-team mode.
+        In this mode, different teams can have scoped access to their own 
resources while still sharing the
+        same underlying deployment.
+      version_added: 3.2.0
+      type: boolean
+      example: ~
+      default: "False"
 database:
   description: ~
   options:
diff --git a/airflow-core/src/airflow/dag_processing/bundles/manager.py 
b/airflow-core/src/airflow/dag_processing/bundles/manager.py
index f13ea962077..e58b36b272e 100644
--- a/airflow-core/src/airflow/dag_processing/bundles/manager.py
+++ b/airflow-core/src/airflow/dag_processing/bundles/manager.py
@@ -193,6 +193,13 @@ class DagBundlesManager(LoggingMixin):
             _add_example_dag_bundle(bundle_config_list)
 
         for bundle_config in bundle_config_list:
+            if bundle_config.team_name and not conf.getboolean("core", 
"multi_team"):
+                raise AirflowConfigException(
+                    "Section `dag_processor` key `dag_bundle_config_list` "
+                    "cannot have a team name when multi-team mode is disabled."
+                    "To enable multi-team, you need to update section `core` 
key `multi_team` in your config."
+                )
+
             class_ = import_string(bundle_config.classpath)
             self._bundle_config[bundle_config.name] = _InternalBundleConfig(
                 bundle_class=class_,
diff --git 
a/airflow-core/tests/unit/dag_processing/bundles/test_dag_bundle_manager.py 
b/airflow-core/tests/unit/dag_processing/bundles/test_dag_bundle_manager.py
index b1e8b4f8b65..f911027ef7a 100644
--- a/airflow-core/tests/unit/dag_processing/bundles/test_dag_bundle_manager.py
+++ b/airflow-core/tests/unit/dag_processing/bundles/test_dag_bundle_manager.py
@@ -57,6 +57,20 @@ from tests_common.test_utils.db import clear_db_dag_bundles
             {"my-bundle"},
             id="remove_dags_folder_default_add_bundle",
         ),
+        pytest.param(
+            json.dumps(
+                [
+                    {
+                        "name": "my-bundle",
+                        "classpath": 
"airflow.dag_processing.bundles.local.LocalDagBundle",
+                        "kwargs": {"path": "/tmp/hihi", "refresh_interval": 1},
+                        "team_name": "test",
+                    }
+                ]
+            ),
+            "cannot have a team name when multi-team mode is disabled.",
+            id="add_bundle_with_team",
+        ),
         pytest.param(
             "[]",
             set(),
diff --git a/airflow-core/tests/unit/dag_processing/test_manager.py 
b/airflow-core/tests/unit/dag_processing/test_manager.py
index 1b023381bf5..e3ff30ae070 100644
--- a/airflow-core/tests/unit/dag_processing/test_manager.py
+++ b/airflow-core/tests/unit/dag_processing/test_manager.py
@@ -1169,6 +1169,7 @@ class TestDagFileProcessorManager:
         bundle_names_being_parsed = {b.name for b in manager._dag_bundles}
         assert bundle_names_being_parsed == expected
 
+    @conf_vars({("core", "multi_team"): "true"})
     def test_bundles_with_team(self, session):
         team1_name = "test_team1"
         team2_name = "test_team2"

Reply via email to