You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by ka...@apache.org on 2021/02/08 22:16:47 UTC
[airflow] branch v1-10-stable updated: Add Version command for
Upgrade Check (#12929)
This is an automated email from the ASF dual-hosted git repository.
kaxilnaik pushed a commit to branch v1-10-stable
in repository https://gitbox.apache.org/repos/asf/airflow.git
The following commit(s) were added to refs/heads/v1-10-stable by this push:
new 616a698 Add Version command for Upgrade Check (#12929)
616a698 is described below
commit 616a698a206f085412a648eabcce66e94a22367f
Author: Kaxil Naik <ka...@gmail.com>
AuthorDate: Mon Feb 8 22:16:27 2021 +0000
Add Version command for Upgrade Check (#12929)
```
❯ airflow upgrade_check --version
1.1.0
```
Help command:
```
❯ airflow upgrade_check --help
usage: airflow upgrade_check [-h] [-s SAVE] [-i IGNORE] [-c CONFIG] [-l] [-V]
optional arguments:
-h, --help show this help message and exit
-s SAVE, --save SAVE Saves the result to the indicated file. The file
format is determined by the file extension.
-i IGNORE, --ignore IGNORE
Ignore a rule. Can be used multiple times.
-c CONFIG, --config CONFIG
Path to upgrade check config yaml file.
-l, --list List the upgrade checks and their class names
-V, --version Show the version of upgrade_check
```
---
airflow/upgrade/checker.py | 10 ++++++++++
airflow/upgrade/setup.cfg | 2 +-
airflow/upgrade/version.py | 18 ++++++++++++++++++
3 files changed, 29 insertions(+), 1 deletion(-)
diff --git a/airflow/upgrade/checker.py b/airflow/upgrade/checker.py
index fead361..7bd24ba 100644
--- a/airflow/upgrade/checker.py
+++ b/airflow/upgrade/checker.py
@@ -71,6 +71,11 @@ def register_arguments(subparser):
help="List the upgrade checks and their class names",
action="store_true",
)
+ subparser.add_argument(
+ "-V", "--version",
+ help="Show the version of upgrade_check",
+ action="store_true",
+ )
subparser.set_defaults(func=run)
@@ -78,6 +83,11 @@ def run(args):
from airflow.upgrade.formatters import ConsoleFormatter, JSONFormatter
from airflow.upgrade.config import UpgradeConfig
+ if args.version:
+ from airflow.upgrade.version import version
+ print(version)
+ return
+
if args.list:
list_checks()
return
diff --git a/airflow/upgrade/setup.cfg b/airflow/upgrade/setup.cfg
index 8cdf9dd..fdfaff4 100644
--- a/airflow/upgrade/setup.cfg
+++ b/airflow/upgrade/setup.cfg
@@ -16,7 +16,7 @@
# under the License.
[metadata]
-version=1.1.0
+version=attr: airflow.upgrade.version.version
name = apache-airflow-upgrade-check
description = Check for compatibility between Airflow versions
long_description = file: airflow/upgrade/README.md
diff --git a/airflow/upgrade/version.py b/airflow/upgrade/version.py
new file mode 100644
index 0000000..59cec85
--- /dev/null
+++ b/airflow/upgrade/version.py
@@ -0,0 +1,18 @@
+# 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.
+
+version = "1.1.0"