Skip to content
Merged
Show file tree
Hide file tree
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
9 changes: 9 additions & 0 deletions airflow-core/src/airflow/config_templates/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
7 changes: 7 additions & 0 deletions airflow-core/src/airflow/dag_processing/bundles/manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,13 @@ def parse_config(self) -> None:
_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_,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,20 @@
{"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(),
Expand Down
1 change: 1 addition & 0 deletions airflow-core/tests/unit/dag_processing/test_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -1169,6 +1169,7 @@ def test_bundle_names_to_parse(self, bundle_names, expected, configure_dag_bundl
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"
Expand Down