This is an automated email from the ASF dual-hosted git repository.
potiuk 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 18b2ca4 Generate version documentation from single source of truth
(#20594)
18b2ca4 is described below
commit 18b2ca4ecf52e8c4d0c39923aa55fe29ea2d6c07
Author: Jarek Potiuk <[email protected]>
AuthorDate: Thu Dec 30 22:13:10 2021 +0100
Generate version documentation from single source of truth (#20594)
We used to maintain supported versions separately in the docs
and it led to discrepancies. Now we have single source of truth which
is used to generate it automatically with pre-commits
---
.pre-commit-config.yaml | 7 +++
BREEZE.rst | 4 +-
README.md | 19 ++++---
STATIC_CODE_CHECKS.rst | 2 +
breeze-complete | 1 +
dev/README_RELEASE_AIRFLOW.md | 1 +
.../installation/supported-versions.rst | 28 +++++-----
scripts/ci/pre_commit/supported_versions.py | 63 ++++++++++++++++++++++
8 files changed, 103 insertions(+), 22 deletions(-)
diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml
index b33423f..4206f65 100644
--- a/.pre-commit-config.yaml
+++ b/.pre-commit-config.yaml
@@ -357,6 +357,13 @@ repos:
files: ^Dockerfile$
pass_filenames: false
additional_dependencies: ['rich']
+ - id: update-supported-versions
+ name: Updates supported versions in documentation
+ entry: ./scripts/ci/pre_commit/supported_versions.py
+ language: python
+ files:
^scripts/ci/pre_commit/supported_versions.py$|^README.md$|^docs/apache-airflow/supported-versions.rst$
+ pass_filenames: false
+ additional_dependencies: ['tabulate']
- id: update-version
name: Update version to the latest version in the documentation
entry: ./scripts/ci/pre_commit/pre_commit_update_versions.py
diff --git a/BREEZE.rst b/BREEZE.rst
index 03095e6..7659134 100644
--- a/BREEZE.rst
+++ b/BREEZE.rst
@@ -2209,8 +2209,8 @@ This is the current syntax for `./breeze <./breeze>`_:
pyupgrade restrict-start_date rst-backticks setup-order
setup-extra-packages
shellcheck sort-in-the-wild sort-spelling-wordlist stylelint
trailing-whitespace
ui-lint update-breeze-file update-extras
update-local-yml-file update-setup-cfg-file
- update-versions vendor-k8s-json-schema
verify-db-migrations-documented version-sync
- www-lint yamllint yesqa
+ update-supported-versions update-versions
vendor-k8s-json-schema
+ verify-db-migrations-documented version-sync www-lint
yamllint yesqa
You can pass extra arguments including options to the pre-commit
framework as
<EXTRA_ARGS> passed after --. For example:
diff --git a/README.md b/README.md
index 2379e92..bbc837d 100644
--- a/README.md
+++ b/README.md
@@ -261,13 +261,18 @@ packages:
Apache Airflow version life cycle:
-| Version | Current Patch/Minor | State | First Release | Limited Support
| EOL/Terminated |
-|---------|---------------------|-----------|---------------|-----------------|----------------|
-| 2 | 2.2.3 | Supported | Dec 17, 2020 | TBD
| TBD |
-| 1.10 | 1.10.15 | EOL | Aug 27, 2018 | Dec 17, 2020
| June 17, 2021 |
-| 1.9 | 1.9.0 | EOL | Jan 03, 2018 | Aug 27, 2018
| Aug 27, 2018 |
-| 1.8 | 1.8.2 | EOL | Mar 19, 2017 | Jan 03, 2018
| Jan 03, 2018 |
-| 1.7 | 1.7.1.2 | EOL | Mar 28, 2016 | Mar 19, 2017
| Mar 19, 2017 |
+<!-- This table is automatically updated by pre-commit
scripts/ci/pre-commit/supported_versions.py -->
+<!-- Beginning of auto-generated table -->
+
+| Version | Current Patch/Minor | State | First Release | Limited
Support | EOL/Terminated |
+|-----------|-----------------------|-----------|-----------------|-------------------|------------------|
+| 2 | 2.2.3 | Supported | Dec 17, 2020 | TBD
| TBD |
+| 1.10 | 1.10.15 | EOL | Aug 27, 2018 | Dec 17,
2020 | June 17, 2021 |
+| 1.9 | 1.9.0 | EOL | Jan 03, 2018 | Aug 27,
2018 | Aug 27, 2018 |
+| 1.8 | 1.8.2 | EOL | Mar 19, 2017 | Jan 03,
2018 | Jan 03, 2018 |
+| 1.7 | 1.7.1.2 | EOL | Mar 28, 2016 | Mar 19,
2017 | Mar 19, 2017 |
+
+<!-- End of auto-generated table -->
Limited support versions will be supported with security and critical bug fix
only.
EOL versions will not get any fixes nor support.
diff --git a/STATIC_CODE_CHECKS.rst b/STATIC_CODE_CHECKS.rst
index 54de617..73eb373 100644
--- a/STATIC_CODE_CHECKS.rst
+++ b/STATIC_CODE_CHECKS.rst
@@ -278,6 +278,8 @@ require Breeze Docker images to be installed locally.
------------------------------------
---------------------------------------------------------------- ------------
``update-setup-cfg-file`` Update setup.cfg file with all licenses
------------------------------------
---------------------------------------------------------------- ------------
+``update-supported-versions`` Updates supported versions in
documentation
+------------------------------------
---------------------------------------------------------------- ------------
``update-versions`` Updates latest versions in the
documentation
------------------------------------
---------------------------------------------------------------- ------------
``vendor-k8s-json-schema`` Vendor k8s schema definitions in the
helm chart schema file
diff --git a/breeze-complete b/breeze-complete
index 6ddfd85..121d8b9 100644
--- a/breeze-complete
+++ b/breeze-complete
@@ -151,6 +151,7 @@ update-breeze-file
update-extras
update-local-yml-file
update-setup-cfg-file
+update-supported-versions
update-versions
vendor-k8s-json-schema
verify-db-migrations-documented
diff --git a/dev/README_RELEASE_AIRFLOW.md b/dev/README_RELEASE_AIRFLOW.md
index 8c02a6a..aac2a86 100644
--- a/dev/README_RELEASE_AIRFLOW.md
+++ b/dev/README_RELEASE_AIRFLOW.md
@@ -957,6 +957,7 @@ EOF
This includes:
+- Modify `./scripts/ci/pre-commit/supported_versions.py` and let pre-commit do
the job
- Sync `CHANGELOG.txt`, `UPDATING.md` and `README.md` changes
- Updating issue templates in `.github/ISSUE_TEMPLATE/` with the new version
diff --git a/docs/apache-airflow/installation/supported-versions.rst
b/docs/apache-airflow/installation/supported-versions.rst
index c4a2a26..ccd81ab 100644
--- a/docs/apache-airflow/installation/supported-versions.rst
+++ b/docs/apache-airflow/installation/supported-versions.rst
@@ -23,19 +23,21 @@ Version Life Cycle
Apache Airflow version life cycle:
-+---------+-----------------+---------------+-----------------+----------------+
-| Version | State | First Release | Limited Support | EOL/Terminated
|
-+---------+-----------------+---------------+-----------------+----------------+
-| 2 | Supported | Dec 17, 2020 | TBD | TBD
|
-+---------+-----------------+---------------+-----------------+----------------+
-| 1.10 | EOL | Aug 27, 2018 | Dec 17, 2020 | June 2021
|
-+---------+-----------------+---------------+-----------------+----------------+
-| 1.9 | EOL | Jan 03, 2018 | Aug 27, 2018 | Aug 2018
|
-+---------+-----------------+---------------+-----------------+----------------+
-| 1.8 | EOL | Mar 19, 2017 | Jan 03, 2018 | Jan 2018
|
-+---------+-----------------+---------------+-----------------+----------------+
-| 1.7 | EOL | Mar 28, 2016 | Mar 19, 2017 | Mar 2017
|
-+---------+-----------------+---------------+-----------------+----------------+
+ .. This table is automatically updated by pre-commit
scripts/ci/pre-commit/supported_versions.py
+ .. Beginning of auto-generated table
+
+========= ===================== ========= ===============
================= ================
+Version Current Patch/Minor State First Release Limited Support
EOL/Terminated
+========= ===================== ========= ===============
================= ================
+2 2.2.3 Supported Dec 17, 2020 TBD
TBD
+1.10 1.10.15 EOL Aug 27, 2018 Dec 17, 2020
June 17, 2021
+1.9 1.9.0 EOL Jan 03, 2018 Aug 27, 2018
Aug 27, 2018
+1.8 1.8.2 EOL Mar 19, 2017 Jan 03, 2018
Jan 03, 2018
+1.7 1.7.1.2 EOL Mar 28, 2016 Mar 19, 2017
Mar 19, 2017
+========= ===================== ========= ===============
================= ================
+
+ .. End of auto-generated table
+
Limited support versions will be supported with security and critical bug fix
only.
EOL versions will not get any fixes nor support.
diff --git a/scripts/ci/pre_commit/supported_versions.py
b/scripts/ci/pre_commit/supported_versions.py
new file mode 100755
index 0000000..dd5d26a
--- /dev/null
+++ b/scripts/ci/pre_commit/supported_versions.py
@@ -0,0 +1,63 @@
+#!/usr/bin/env python3
+# 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
+
+from tabulate import tabulate
+
+AIRFLOW_SOURCES = Path(__file__).resolve().parent.parent.parent.parent
+
+
+HEADERS = ("Version", "Current Patch/Minor", "State", "First Release",
"Limited Support", "EOL/Terminated")
+
+SUPPORTED_VERSIONS = (
+ ("2", "2.2.3", "Supported", "Dec 17, 2020", "TBD", "TBD"),
+ ("1.10", "1.10.15", "EOL", "Aug 27, 2018", "Dec 17, 2020", "June 17,
2021"),
+ ("1.9", "1.9.0", "EOL", "Jan 03, 2018", "Aug 27, 2018", "Aug 27, 2018"),
+ ("1.8", "1.8.2", "EOL", "Mar 19, 2017", "Jan 03, 2018", "Jan 03, 2018"),
+ ("1.7", "1.7.1.2", "EOL", "Mar 28, 2016", "Mar 19, 2017", "Mar 19, 2017"),
+)
+
+
+def replace_text_between(file: Path, start: str, end: str, replacement_text:
str):
+ original_text = file.read_text()
+ leading_text = original_text.split(start)[0]
+ trailing_text = original_text.split(end)[1]
+ file.write_text(leading_text + start + replacement_text + end +
trailing_text)
+
+
+if __name__ == '__main__':
+ replace_text_between(
+ file=AIRFLOW_SOURCES / "README.md",
+ start="<!-- Beginning of auto-generated table -->\n",
+ end="<!-- End of auto-generated table -->\n",
+ replacement_text="\n"
+ + tabulate(
+ SUPPORTED_VERSIONS, tablefmt="github", headers=HEADERS,
stralign="left", disable_numparse=True
+ )
+ + "\n\n",
+ )
+ replace_text_between(
+ file=AIRFLOW_SOURCES / "docs" / "apache-airflow" / "installation" /
"supported-versions.rst",
+ start=" .. Beginning of auto-generated table\n",
+ end=" .. End of auto-generated table\n",
+ replacement_text="\n"
+ + tabulate(
+ SUPPORTED_VERSIONS, tablefmt="rst", headers=HEADERS,
stralign="left", disable_numparse=True
+ )
+ + "\n\n",
+ )