Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add version_renamed and previous_name in config sections #28324

Merged
merged 3 commits into from
Dec 14, 2022
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
3 changes: 3 additions & 0 deletions airflow/config_templates/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2368,6 +2368,9 @@
default: "True"
- name: kubernetes_executor
description: ~
renamed:
previous_name: kubernetes
version: 2.5.0
options:
- name: pod_template_file
description: |
Expand Down
14 changes: 14 additions & 0 deletions dev/validate_version_added_fields_in_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,9 @@
("logging", "extra_logger_names", "2.2.0")
}

# Renamed sections: (new_section, old_section, version_before_renaming)
RENAMED_SECTIONS = [("kubernetes_executor", "kubernetes", "2.4.3")]


def fetch_pypi_versions() -> list[str]:
r = requests.get("https://pypi.org/pypi/apache-airflow/json")
Expand Down Expand Up @@ -71,6 +74,14 @@ def read_local_config_options() -> set[tuple[str, str, str]]:
return config_options


computed_option_new_section = set()
for new_section, old_section, version_before_renaming in RENAMED_SECTIONS:
options = fetch_config_options_for_version(version_before_renaming)
options = {
(new_section, option_name) for section_name, option_name in options if section_name == old_section
}
computed_option_new_section.update(options)

# 1. Prepare versions to checks
airflow_version = fetch_pypi_versions()
airflow_version = sorted(airflow_version, key=semver.VersionInfo.parse)
Expand All @@ -83,6 +94,9 @@ def read_local_config_options() -> set[tuple[str, str, str]]:
options_1 = fetch_config_options_for_version(prev_version)
options_2 = fetch_config_options_for_version(curr_version)
new_options = options_2 - options_1
# Remove existing options in new section
new_options -= computed_option_new_section
# Update expected options with version added field
expected_computed_options.update(
{(section_name, option_name, curr_version) for section_name, option_name in new_options}
)
Expand Down
4 changes: 4 additions & 0 deletions docs/apache-airflow/configurations-ref.rst
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,10 @@ that you run airflow components on is synchronized (for example using ntpd) othe
[{{ section["name"] }}]
{{ "=" * (section["name"]|length + 2) }}

{% if 'renamed' in section %}
*Renamed in version {{ section['renamed']['version'] }}, previous name was {{ section['renamed']['previous_name'] }}*
{% endif %}

{% if section["description"] %}
{{ section["description"] }}
{% endif %}
Expand Down