This is an automated email from the ASF dual-hosted git repository.
ephraimanierobi 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 9e5879576d Add `renamed` and `previous_name` in config sections
(#28324)
9e5879576d is described below
commit 9e5879576d7427517dc33d2891f58d791db6c7bf
Author: Ephraim Anierobi <[email protected]>
AuthorDate: Wed Dec 14 08:51:26 2022 +0100
Add `renamed` and `previous_name` in config sections (#28324)
This helps us retain the version-added value of config options when
the config section is renamed.
This information of rename is also made available in the config
documentation
---
airflow/config_templates/config.yml | 3 +++
dev/validate_version_added_fields_in_config.py | 14 ++++++++++++++
docs/apache-airflow/configurations-ref.rst | 4 ++++
3 files changed, 21 insertions(+)
diff --git a/airflow/config_templates/config.yml
b/airflow/config_templates/config.yml
index 2759eef2ff..962de33d9d 100644
--- a/airflow/config_templates/config.yml
+++ b/airflow/config_templates/config.yml
@@ -2368,6 +2368,9 @@
default: "True"
- name: kubernetes_executor
description: ~
+ renamed:
+ previous_name: kubernetes
+ version: 2.5.0
options:
- name: pod_template_file
description: |
diff --git a/dev/validate_version_added_fields_in_config.py
b/dev/validate_version_added_fields_in_config.py
index a43e149175..e7920620d6 100755
--- a/dev/validate_version_added_fields_in_config.py
+++ b/dev/validate_version_added_fields_in_config.py
@@ -34,6 +34,9 @@ KNOWN_FALSE_DETECTIONS = {
("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")
@@ -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)
@@ -83,6 +94,9 @@ for prev_version, curr_version in zip(to_check_versions[:-1],
to_check_versions[
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}
)
diff --git a/docs/apache-airflow/configurations-ref.rst
b/docs/apache-airflow/configurations-ref.rst
index c77a33cd22..ab0ccd5f64 100644
--- a/docs/apache-airflow/configurations-ref.rst
+++ b/docs/apache-airflow/configurations-ref.rst
@@ -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 %}