This is an automated email from the ASF dual-hosted git repository.
bugraoz 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 9f207ec0e68 AIP-81 Transition of Version Command (#50919)
9f207ec0e68 is described below
commit 9f207ec0e685e60bb449875b1a73366c29cac362
Author: Pratiksha <[email protected]>
AuthorDate: Wed Jun 18 12:17:05 2025 +0530
AIP-81 Transition of Version Command (#50919)
* create version command using CLI side resolve conflict
* make the necessary chnages related ActionCommand and the version var
* Append actioncommand to commandlist and remove print statements - resolve
conflict
* remove mistakenly added code comment
* update version_command using operation response
* add test for version_command
* add airflowctl version and fix test_version_command
* fix tests
* fix static checks for docs/images files
* fix static checks for pools.svg and variables.svg
---
airflow-ctl/docs/images/command_hashes.txt | 4 +-
airflow-ctl/docs/images/output_config.svg | 28 +++---
airflow-ctl/docs/images/output_main.svg | 112 ++++++++++-----------
airflow-ctl/docs/images/output_version.svg | 56 ++++-------
airflow-ctl/src/airflowctl/ctl/cli_config.py | 13 ++-
.../src/airflowctl/ctl/commands/version_command.py | 31 ++++++
.../ctl/commands/test_version_command.py | 54 ++++++++++
7 files changed, 187 insertions(+), 111 deletions(-)
diff --git a/airflow-ctl/docs/images/command_hashes.txt
b/airflow-ctl/docs/images/command_hashes.txt
index c4909803662..91832965187 100644
--- a/airflow-ctl/docs/images/command_hashes.txt
+++ b/airflow-ctl/docs/images/command_hashes.txt
@@ -1,4 +1,4 @@
-main:3d89ac882e883c75b3bc51d71039f215
+main:649cfb54e45b91a69ad7ed19cb526e93
assets:bd74e73e54641bac100b88ca29641df2
auth:ef4122d3f5e4b2ac19cb0d3e12c8594b
backfills:e0cba4448d576d1b53ea79d6dcdbe035
@@ -10,5 +10,5 @@ jobs:806174e6c9511db669705279ed6a00b9
pools:2c17a4131b6481bd8fe9120982606db2
providers:d053e6f17ff271e1e08942378344d27b
variables:cd3970589b2cb1e3ebd9a0b7f2ffdf4d
-version:11da98f530c37754403a87151cbe2274
+version:19f901e228111d8ba2ef47d8722f9b87
auth login:348c25d49128b6007ac97dae2ef7563f
diff --git a/airflow-ctl/docs/images/output_config.svg
b/airflow-ctl/docs/images/output_config.svg
index e590ca6126c..152fd39a10f 100644
--- a/airflow-ctl/docs/images/output_config.svg
+++ b/airflow-ctl/docs/images/output_config.svg
@@ -84,22 +84,20 @@
<circle cx="44" cy="0" r="7" fill="#28c840"/>
</g>
- <g transform="translate(9, 41)"
clip-path="url(#terminal-2772488152-clip-terminal)">
+ <g transform="translate(9, 41)"
clip-path="url(#terminal-1599905258-clip-terminal)">
- <g class="terminal-2772488152-matrix">
- <text class="terminal-2772488152-r1" x="0" y="20" textLength="500.2"
clip-path="url(#terminal-2772488152-line-0)">Usage: airflowctl config [-h] COMMAND ...</text><text
class="terminal-2772488152-r1" x="976" y="20" textLength="12.2"
clip-path="url(#terminal-2772488152-line-0)">
-</text><text class="terminal-2772488152-r1" x="976" y="44.4" textLength="12.2"
clip-path="url(#terminal-2772488152-line-1)">
-</text><text class="terminal-2772488152-r1" x="0" y="68.8" textLength="305"
clip-path="url(#terminal-2772488152-line-2)">Perform Config operations</text><text
class="terminal-2772488152-r1" x="976" y="68.8" textLength="12.2"
clip-path="url(#terminal-2772488152-line-2)">
-</text><text class="terminal-2772488152-r1" x="976" y="93.2" textLength="12.2"
clip-path="url(#terminal-2772488152-line-3)">
-</text><text class="terminal-2772488152-r1" x="0" y="117.6" textLength="256.2"
clip-path="url(#terminal-2772488152-line-4)">Positional Arguments:</text><text
class="terminal-2772488152-r1" x="976" y="117.6" textLength="12.2"
clip-path="url(#terminal-2772488152-line-4)">
-</text><text class="terminal-2772488152-r1" x="0" y="142" textLength="109.8"
clip-path="url(#terminal-2772488152-line-5)">  COMMAND</text><text
class="terminal-2772488152-r1" x="976" y="142" textLength="12.2"
clip-path="url(#terminal-2772488152-line-5)">
-</text><text class="terminal-2772488152-r1" x="0" y="166.4" textLength="427"
clip-path="url(#terminal-2772488152-line-6)">    get       Perform get operation</text><text
class="terminal-2772488152-r1" x="976" y="166.4" textLength="12.2"
clip-path="url(#terminal-2772488152-line-6)">
-</text><text class="terminal-2772488152-r1" x="0" y="190.8" textLength="951.6"
clip-path="url(#terminal-2772488152-line-7)">    lint      Lint options for the configuration changes while migrating from </text><text
class="terminal-2772488152-r1" x="976" y="190.8" textLength="12.2"
clip-path="url(#terminal-2772488152-line-7)">
-</text><text class="terminal-2772488152-r1" x="0" y="215.2" textLength="268.4"
clip-path="url(#terminal-2772488152-line-8)">Airflow 2 to Airflow 3</text><text
class="terminal-2772488152-r1" x="976" y="215.2" textLength="12.2"
clip-path="url(#terminal-2772488152-line-8)">
-</text><text class="terminal-2772488152-r1" x="0" y="239.6" textLength="439.2"
clip-path="url(#terminal-2772488152-line-9)">    list      Perform list operation</text><text
class="terminal-2772488152-r1" x="976" y="239.6" textLength="12.2"
clip-path="url(#terminal-2772488152-line-9)">
-</text><text class="terminal-2772488152-r1" x="976" y="264" textLength="12.2"
clip-path="url(#terminal-2772488152-line-10)">
-</text><text class="terminal-2772488152-r1" x="0" y="288.4" textLength="231.8"
clip-path="url(#terminal-2772488152-line-11)">Optional Arguments:</text><text
class="terminal-2772488152-r1" x="976" y="288.4" textLength="12.2"
clip-path="url(#terminal-2772488152-line-11)">
-</text><text class="terminal-2772488152-r1" x="0" y="312.8" textLength="549"
clip-path="url(#terminal-2772488152-line-12)">  -h, --help  show this help message and exit</text><text
class="terminal-2772488152-r1" x="976" y="312.8" textLength="12.2"
clip-path="url(#terminal-2772488152-line-12)">
+ <g class="terminal-1599905258-matrix">
+ <text class="terminal-1599905258-r1" x="0" y="20" textLength="500.2"
clip-path="url(#terminal-1599905258-line-0)">Usage: airflowctl config [-h] COMMAND ...</text><text
class="terminal-1599905258-r1" x="976" y="20" textLength="12.2"
clip-path="url(#terminal-1599905258-line-0)">
+</text><text class="terminal-1599905258-r1" x="976" y="44.4" textLength="12.2"
clip-path="url(#terminal-1599905258-line-1)">
+</text><text class="terminal-1599905258-r1" x="0" y="68.8" textLength="305"
clip-path="url(#terminal-1599905258-line-2)">Perform Config operations</text><text
class="terminal-1599905258-r1" x="976" y="68.8" textLength="12.2"
clip-path="url(#terminal-1599905258-line-2)">
+</text><text class="terminal-1599905258-r1" x="976" y="93.2" textLength="12.2"
clip-path="url(#terminal-1599905258-line-3)">
+</text><text class="terminal-1599905258-r1" x="0" y="117.6" textLength="256.2"
clip-path="url(#terminal-1599905258-line-4)">Positional Arguments:</text><text
class="terminal-1599905258-r1" x="976" y="117.6" textLength="12.2"
clip-path="url(#terminal-1599905258-line-4)">
+</text><text class="terminal-1599905258-r1" x="0" y="142" textLength="109.8"
clip-path="url(#terminal-1599905258-line-5)">  COMMAND</text><text
class="terminal-1599905258-r1" x="976" y="142" textLength="12.2"
clip-path="url(#terminal-1599905258-line-5)">
+</text><text class="terminal-1599905258-r1" x="0" y="166.4" textLength="427"
clip-path="url(#terminal-1599905258-line-6)">    get       Perform get operation</text><text
class="terminal-1599905258-r1" x="976" y="166.4" textLength="12.2"
clip-path="url(#terminal-1599905258-line-6)">
+</text><text class="terminal-1599905258-r1" x="0" y="190.8" textLength="439.2"
clip-path="url(#terminal-1599905258-line-7)">    list      Perform list operation</text><text
class="terminal-1599905258-r1" x="976" y="190.8" textLength="12.2"
clip-path="url(#terminal-1599905258-line-7)">
+</text><text class="terminal-1599905258-r1" x="976" y="215.2"
textLength="12.2" clip-path="url(#terminal-1599905258-line-8)">
+</text><text class="terminal-1599905258-r1" x="0" y="239.6" textLength="231.8"
clip-path="url(#terminal-1599905258-line-9)">Optional Arguments:</text><text
class="terminal-1599905258-r1" x="976" y="239.6" textLength="12.2"
clip-path="url(#terminal-1599905258-line-9)">
+</text><text class="terminal-1599905258-r1" x="0" y="264" textLength="549"
clip-path="url(#terminal-1599905258-line-10)">  -h, --help  show this help message and exit</text><text
class="terminal-1599905258-r1" x="976" y="264" textLength="12.2"
clip-path="url(#terminal-1599905258-line-10)">
</text>
</g>
</g>
diff --git a/airflow-ctl/docs/images/output_main.svg
b/airflow-ctl/docs/images/output_main.svg
index c12ad6e5554..ec042419aaf 100644
--- a/airflow-ctl/docs/images/output_main.svg
+++ b/airflow-ctl/docs/images/output_main.svg
@@ -19,135 +19,135 @@
font-weight: 700;
}
- .terminal-1120912380-matrix {
+ .terminal-2627781444-matrix {
font-family: Fira Code, monospace;
font-size: 20px;
line-height: 24.4px;
font-variant-east-asian: full-width;
}
- .terminal-1120912380-title {
+ .terminal-2627781444-title {
font-size: 18px;
font-weight: bold;
font-family: arial;
}
- .terminal-1120912380-r1 { fill: #c5c8c6 }
+ .terminal-2627781444-r1 { fill: #c5c8c6 }
</style>
<defs>
- <clipPath id="terminal-1120912380-clip-terminal">
+ <clipPath id="terminal-2627781444-clip-terminal">
<rect x="0" y="0" width="975.0" height="609.0" />
</clipPath>
- <clipPath id="terminal-1120912380-line-0">
+ <clipPath id="terminal-2627781444-line-0">
<rect x="0" y="1.5" width="976" height="24.65"/>
</clipPath>
-<clipPath id="terminal-1120912380-line-1">
+<clipPath id="terminal-2627781444-line-1">
<rect x="0" y="25.9" width="976" height="24.65"/>
</clipPath>
-<clipPath id="terminal-1120912380-line-2">
+<clipPath id="terminal-2627781444-line-2">
<rect x="0" y="50.3" width="976" height="24.65"/>
</clipPath>
-<clipPath id="terminal-1120912380-line-3">
+<clipPath id="terminal-2627781444-line-3">
<rect x="0" y="74.7" width="976" height="24.65"/>
</clipPath>
-<clipPath id="terminal-1120912380-line-4">
+<clipPath id="terminal-2627781444-line-4">
<rect x="0" y="99.1" width="976" height="24.65"/>
</clipPath>
-<clipPath id="terminal-1120912380-line-5">
+<clipPath id="terminal-2627781444-line-5">
<rect x="0" y="123.5" width="976" height="24.65"/>
</clipPath>
-<clipPath id="terminal-1120912380-line-6">
+<clipPath id="terminal-2627781444-line-6">
<rect x="0" y="147.9" width="976" height="24.65"/>
</clipPath>
-<clipPath id="terminal-1120912380-line-7">
+<clipPath id="terminal-2627781444-line-7">
<rect x="0" y="172.3" width="976" height="24.65"/>
</clipPath>
-<clipPath id="terminal-1120912380-line-8">
+<clipPath id="terminal-2627781444-line-8">
<rect x="0" y="196.7" width="976" height="24.65"/>
</clipPath>
-<clipPath id="terminal-1120912380-line-9">
+<clipPath id="terminal-2627781444-line-9">
<rect x="0" y="221.1" width="976" height="24.65"/>
</clipPath>
-<clipPath id="terminal-1120912380-line-10">
+<clipPath id="terminal-2627781444-line-10">
<rect x="0" y="245.5" width="976" height="24.65"/>
</clipPath>
-<clipPath id="terminal-1120912380-line-11">
+<clipPath id="terminal-2627781444-line-11">
<rect x="0" y="269.9" width="976" height="24.65"/>
</clipPath>
-<clipPath id="terminal-1120912380-line-12">
+<clipPath id="terminal-2627781444-line-12">
<rect x="0" y="294.3" width="976" height="24.65"/>
</clipPath>
-<clipPath id="terminal-1120912380-line-13">
+<clipPath id="terminal-2627781444-line-13">
<rect x="0" y="318.7" width="976" height="24.65"/>
</clipPath>
-<clipPath id="terminal-1120912380-line-14">
+<clipPath id="terminal-2627781444-line-14">
<rect x="0" y="343.1" width="976" height="24.65"/>
</clipPath>
-<clipPath id="terminal-1120912380-line-15">
+<clipPath id="terminal-2627781444-line-15">
<rect x="0" y="367.5" width="976" height="24.65"/>
</clipPath>
-<clipPath id="terminal-1120912380-line-16">
+<clipPath id="terminal-2627781444-line-16">
<rect x="0" y="391.9" width="976" height="24.65"/>
</clipPath>
-<clipPath id="terminal-1120912380-line-17">
+<clipPath id="terminal-2627781444-line-17">
<rect x="0" y="416.3" width="976" height="24.65"/>
</clipPath>
-<clipPath id="terminal-1120912380-line-18">
+<clipPath id="terminal-2627781444-line-18">
<rect x="0" y="440.7" width="976" height="24.65"/>
</clipPath>
-<clipPath id="terminal-1120912380-line-19">
+<clipPath id="terminal-2627781444-line-19">
<rect x="0" y="465.1" width="976" height="24.65"/>
</clipPath>
-<clipPath id="terminal-1120912380-line-20">
+<clipPath id="terminal-2627781444-line-20">
<rect x="0" y="489.5" width="976" height="24.65"/>
</clipPath>
-<clipPath id="terminal-1120912380-line-21">
+<clipPath id="terminal-2627781444-line-21">
<rect x="0" y="513.9" width="976" height="24.65"/>
</clipPath>
-<clipPath id="terminal-1120912380-line-22">
+<clipPath id="terminal-2627781444-line-22">
<rect x="0" y="538.3" width="976" height="24.65"/>
</clipPath>
-<clipPath id="terminal-1120912380-line-23">
+<clipPath id="terminal-2627781444-line-23">
<rect x="0" y="562.7" width="976" height="24.65"/>
</clipPath>
</defs>
- <rect fill="#292929" stroke="rgba(255,255,255,0.35)" stroke-width="1"
x="1" y="1" width="992" height="658" rx="8"/><text
class="terminal-1120912380-title" fill="#c5c8c6" text-anchor="middle" x="496"
y="27">Command: main</text>
+ <rect fill="#292929" stroke="rgba(255,255,255,0.35)" stroke-width="1"
x="1" y="1" width="992" height="658" rx="8"/><text
class="terminal-2627781444-title" fill="#c5c8c6" text-anchor="middle" x="496"
y="27">Command: main</text>
<g transform="translate(26,22)">
<circle cx="0" cy="0" r="7" fill="#ff5f57"/>
<circle cx="22" cy="0" r="7" fill="#febc2e"/>
<circle cx="44" cy="0" r="7" fill="#28c840"/>
</g>
- <g transform="translate(9, 41)"
clip-path="url(#terminal-1120912380-clip-terminal)">
+ <g transform="translate(9, 41)"
clip-path="url(#terminal-2627781444-clip-terminal)">
- <g class="terminal-1120912380-matrix">
- <text class="terminal-1120912380-r1" x="0" y="20" textLength="524.6"
clip-path="url(#terminal-1120912380-line-0)">Usage: airflowctl [-h] GROUP_OR_COMMAND ...</text><text
class="terminal-1120912380-r1" x="976" y="20" textLength="12.2"
clip-path="url(#terminal-1120912380-line-0)">
-</text><text class="terminal-1120912380-r1" x="976" y="44.4" textLength="12.2"
clip-path="url(#terminal-1120912380-line-1)">
-</text><text class="terminal-1120912380-r1" x="0" y="68.8" textLength="256.2"
clip-path="url(#terminal-1120912380-line-2)">Positional Arguments:</text><text
class="terminal-1120912380-r1" x="976" y="68.8" textLength="12.2"
clip-path="url(#terminal-1120912380-line-2)">
-</text><text class="terminal-1120912380-r1" x="0" y="93.2" textLength="219.6"
clip-path="url(#terminal-1120912380-line-3)">  GROUP_OR_COMMAND</text><text
class="terminal-1120912380-r1" x="976" y="93.2" textLength="12.2"
clip-path="url(#terminal-1120912380-line-3)">
-</text><text class="terminal-1120912380-r1" x="976" y="117.6"
textLength="12.2" clip-path="url(#terminal-1120912380-line-4)">
-</text><text class="terminal-1120912380-r1" x="0" y="142" textLength="122"
clip-path="url(#terminal-1120912380-line-5)">    Groups</text><text
class="terminal-1120912380-r1" x="976" y="142" textLength="12.2"
clip-path="url(#terminal-1120912380-line-5)">
-</text><text class="terminal-1120912380-r1" x="0" y="166.4" textLength="549"
clip-path="url(#terminal-1120912380-line-6)">      assets        Perform Assets operations</text><text
class="terminal-1120912380-r1" x="976" y="166.4" textLength="12.2"
clip-path="url(#terminal-1120912380-line-6)">
-</text><text class="terminal-1120912380-r1" x="0" y="190.8" textLength="890.6"
clip-path="url(#terminal-1120912380-line-7)">      auth          Manage authentication for CLI. Either pass token from</text><text
class="terminal-1120912380-r1" x="976" y="190.8" textLength="12.2"
clip-path="url(#terminal-1120912380-line-7)">
-</text><text class="terminal-1120912380-r1" x="0" y="215.2" textLength="866.2"
clip-path="url(#terminal-1120912380-line-8)">                    environment variable/parameter or pass username and</text><text
class="terminal-1120912380-r1" x="976" y="215.2" textLength="12.2"
clip-path="url(#terminal-1120912380-line-8)">
-</text><text class="terminal-1120912380-r1" x="0" y="239.6" textLength="353.8"
clip-path="url(#terminal-1120912380-line-9)">                    password.</text><text
class="terminal-1120912380-r1" x="976" y="239.6" textLength="12.2"
clip-path="url(#terminal-1120912380-line-9)">
-</text><text class="terminal-1120912380-r1" x="0" y="264" textLength="585.6"
clip-path="url(#terminal-1120912380-line-10)">      backfills     Perform Backfills operations</text><text
class="terminal-1120912380-r1" x="976" y="264" textLength="12.2"
clip-path="url(#terminal-1120912380-line-10)">
-</text><text class="terminal-1120912380-r1" x="0" y="288.4" textLength="549"
clip-path="url(#terminal-1120912380-line-11)">      config        Perform Config operations</text><text
class="terminal-1120912380-r1" x="976" y="288.4" textLength="12.2"
clip-path="url(#terminal-1120912380-line-11)">
-</text><text class="terminal-1120912380-r1" x="0" y="312.8" textLength="610"
clip-path="url(#terminal-1120912380-line-12)">      connections   Perform Connections operations</text><text
class="terminal-1120912380-r1" x="976" y="312.8" textLength="12.2"
clip-path="url(#terminal-1120912380-line-12)">
-</text><text class="terminal-1120912380-r1" x="0" y="337.2" textLength="512.4"
clip-path="url(#terminal-1120912380-line-13)">      dag           Perform Dag operations</text><text
class="terminal-1120912380-r1" x="976" y="337.2" textLength="12.2"
clip-path="url(#terminal-1120912380-line-13)">
-</text><text class="terminal-1120912380-r1" x="0" y="361.6" textLength="549"
clip-path="url(#terminal-1120912380-line-14)">      dagrun        Perform DagRun operations</text><text
class="terminal-1120912380-r1" x="976" y="361.6" textLength="12.2"
clip-path="url(#terminal-1120912380-line-14)">
-</text><text class="terminal-1120912380-r1" x="0" y="386" textLength="524.6"
clip-path="url(#terminal-1120912380-line-15)">      jobs          Perform Jobs operations</text><text
class="terminal-1120912380-r1" x="976" y="386" textLength="12.2"
clip-path="url(#terminal-1120912380-line-15)">
-</text><text class="terminal-1120912380-r1" x="0" y="410.4" textLength="536.8"
clip-path="url(#terminal-1120912380-line-16)">      pools         Perform Pools operations</text><text
class="terminal-1120912380-r1" x="976" y="410.4" textLength="12.2"
clip-path="url(#terminal-1120912380-line-16)">
-</text><text class="terminal-1120912380-r1" x="0" y="434.8" textLength="585.6"
clip-path="url(#terminal-1120912380-line-17)">      providers     Perform Providers operations</text><text
class="terminal-1120912380-r1" x="976" y="434.8" textLength="12.2"
clip-path="url(#terminal-1120912380-line-17)">
-</text><text class="terminal-1120912380-r1" x="0" y="459.2" textLength="585.6"
clip-path="url(#terminal-1120912380-line-18)">      variables     Perform Variables operations</text><text
class="terminal-1120912380-r1" x="976" y="459.2" textLength="12.2"
clip-path="url(#terminal-1120912380-line-18)">
-</text><text class="terminal-1120912380-r1" x="0" y="483.6" textLength="561.2"
clip-path="url(#terminal-1120912380-line-19)">      version       Perform Version operations</text><text
class="terminal-1120912380-r1" x="976" y="483.6" textLength="12.2"
clip-path="url(#terminal-1120912380-line-19)">
-</text><text class="terminal-1120912380-r1" x="976" y="508" textLength="12.2"
clip-path="url(#terminal-1120912380-line-20)">
-</text><text class="terminal-1120912380-r1" x="0" y="532.4" textLength="158.6"
clip-path="url(#terminal-1120912380-line-21)">    Commands:</text><text
class="terminal-1120912380-r1" x="976" y="532.4" textLength="12.2"
clip-path="url(#terminal-1120912380-line-21)">
-</text><text class="terminal-1120912380-r1" x="976" y="556.8"
textLength="12.2" clip-path="url(#terminal-1120912380-line-22)">
-</text><text class="terminal-1120912380-r1" x="0" y="581.2" textLength="231.8"
clip-path="url(#terminal-1120912380-line-23)">Optional Arguments:</text><text
class="terminal-1120912380-r1" x="976" y="581.2" textLength="12.2"
clip-path="url(#terminal-1120912380-line-23)">
-</text><text class="terminal-1120912380-r1" x="0" y="605.6" textLength="622.2"
clip-path="url(#terminal-1120912380-line-24)">  -h, --help        show this help message and exit</text><text
class="terminal-1120912380-r1" x="976" y="605.6" textLength="12.2"
clip-path="url(#terminal-1120912380-line-24)">
+ <g class="terminal-2627781444-matrix">
+ <text class="terminal-2627781444-r1" x="0" y="20" textLength="524.6"
clip-path="url(#terminal-2627781444-line-0)">Usage: airflowctl [-h] GROUP_OR_COMMAND ...</text><text
class="terminal-2627781444-r1" x="976" y="20" textLength="12.2"
clip-path="url(#terminal-2627781444-line-0)">
+</text><text class="terminal-2627781444-r1" x="976" y="44.4" textLength="12.2"
clip-path="url(#terminal-2627781444-line-1)">
+</text><text class="terminal-2627781444-r1" x="0" y="68.8" textLength="256.2"
clip-path="url(#terminal-2627781444-line-2)">Positional Arguments:</text><text
class="terminal-2627781444-r1" x="976" y="68.8" textLength="12.2"
clip-path="url(#terminal-2627781444-line-2)">
+</text><text class="terminal-2627781444-r1" x="0" y="93.2" textLength="219.6"
clip-path="url(#terminal-2627781444-line-3)">  GROUP_OR_COMMAND</text><text
class="terminal-2627781444-r1" x="976" y="93.2" textLength="12.2"
clip-path="url(#terminal-2627781444-line-3)">
+</text><text class="terminal-2627781444-r1" x="976" y="117.6"
textLength="12.2" clip-path="url(#terminal-2627781444-line-4)">
+</text><text class="terminal-2627781444-r1" x="0" y="142" textLength="122"
clip-path="url(#terminal-2627781444-line-5)">    Groups</text><text
class="terminal-2627781444-r1" x="976" y="142" textLength="12.2"
clip-path="url(#terminal-2627781444-line-5)">
+</text><text class="terminal-2627781444-r1" x="0" y="166.4" textLength="549"
clip-path="url(#terminal-2627781444-line-6)">      assets        Perform Assets operations</text><text
class="terminal-2627781444-r1" x="976" y="166.4" textLength="12.2"
clip-path="url(#terminal-2627781444-line-6)">
+</text><text class="terminal-2627781444-r1" x="0" y="190.8" textLength="890.6"
clip-path="url(#terminal-2627781444-line-7)">      auth          Manage authentication for CLI. Either pass token from</text><text
class="terminal-2627781444-r1" x="976" y="190.8" textLength="12.2"
clip-path="url(#terminal-2627781444-line-7)">
+</text><text class="terminal-2627781444-r1" x="0" y="215.2" textLength="866.2"
clip-path="url(#terminal-2627781444-line-8)">                    environment variable/parameter or pass username and</text><text
class="terminal-2627781444-r1" x="976" y="215.2" textLength="12.2"
clip-path="url(#terminal-2627781444-line-8)">
+</text><text class="terminal-2627781444-r1" x="0" y="239.6" textLength="353.8"
clip-path="url(#terminal-2627781444-line-9)">                    password.</text><text
class="terminal-2627781444-r1" x="976" y="239.6" textLength="12.2"
clip-path="url(#terminal-2627781444-line-9)">
+</text><text class="terminal-2627781444-r1" x="0" y="264" textLength="585.6"
clip-path="url(#terminal-2627781444-line-10)">      backfills     Perform Backfills operations</text><text
class="terminal-2627781444-r1" x="976" y="264" textLength="12.2"
clip-path="url(#terminal-2627781444-line-10)">
+</text><text class="terminal-2627781444-r1" x="0" y="288.4" textLength="549"
clip-path="url(#terminal-2627781444-line-11)">      config        Perform Config operations</text><text
class="terminal-2627781444-r1" x="976" y="288.4" textLength="12.2"
clip-path="url(#terminal-2627781444-line-11)">
+</text><text class="terminal-2627781444-r1" x="0" y="312.8" textLength="610"
clip-path="url(#terminal-2627781444-line-12)">      connections   Perform Connections operations</text><text
class="terminal-2627781444-r1" x="976" y="312.8" textLength="12.2"
clip-path="url(#terminal-2627781444-line-12)">
+</text><text class="terminal-2627781444-r1" x="0" y="337.2" textLength="512.4"
clip-path="url(#terminal-2627781444-line-13)">      dag           Perform Dag operations</text><text
class="terminal-2627781444-r1" x="976" y="337.2" textLength="12.2"
clip-path="url(#terminal-2627781444-line-13)">
+</text><text class="terminal-2627781444-r1" x="0" y="361.6" textLength="549"
clip-path="url(#terminal-2627781444-line-14)">      dagrun        Perform DagRun operations</text><text
class="terminal-2627781444-r1" x="976" y="361.6" textLength="12.2"
clip-path="url(#terminal-2627781444-line-14)">
+</text><text class="terminal-2627781444-r1" x="0" y="386" textLength="524.6"
clip-path="url(#terminal-2627781444-line-15)">      jobs          Perform Jobs operations</text><text
class="terminal-2627781444-r1" x="976" y="386" textLength="12.2"
clip-path="url(#terminal-2627781444-line-15)">
+</text><text class="terminal-2627781444-r1" x="0" y="410.4" textLength="536.8"
clip-path="url(#terminal-2627781444-line-16)">      pools         Perform Pools operations</text><text
class="terminal-2627781444-r1" x="976" y="410.4" textLength="12.2"
clip-path="url(#terminal-2627781444-line-16)">
+</text><text class="terminal-2627781444-r1" x="0" y="434.8" textLength="585.6"
clip-path="url(#terminal-2627781444-line-17)">      providers     Perform Providers operations</text><text
class="terminal-2627781444-r1" x="976" y="434.8" textLength="12.2"
clip-path="url(#terminal-2627781444-line-17)">
+</text><text class="terminal-2627781444-r1" x="0" y="459.2" textLength="585.6"
clip-path="url(#terminal-2627781444-line-18)">      variables     Perform Variables operations</text><text
class="terminal-2627781444-r1" x="976" y="459.2" textLength="12.2"
clip-path="url(#terminal-2627781444-line-18)">
+</text><text class="terminal-2627781444-r1" x="976" y="483.6"
textLength="12.2" clip-path="url(#terminal-2627781444-line-19)">
+</text><text class="terminal-2627781444-r1" x="0" y="508" textLength="158.6"
clip-path="url(#terminal-2627781444-line-20)">    Commands:</text><text
class="terminal-2627781444-r1" x="976" y="508" textLength="12.2"
clip-path="url(#terminal-2627781444-line-20)">
+</text><text class="terminal-2627781444-r1" x="0" y="532.4" textLength="536.8"
clip-path="url(#terminal-2627781444-line-21)">      version       Show version information</text><text
class="terminal-2627781444-r1" x="976" y="532.4" textLength="12.2"
clip-path="url(#terminal-2627781444-line-21)">
+</text><text class="terminal-2627781444-r1" x="976" y="556.8"
textLength="12.2" clip-path="url(#terminal-2627781444-line-22)">
+</text><text class="terminal-2627781444-r1" x="0" y="581.2" textLength="231.8"
clip-path="url(#terminal-2627781444-line-23)">Optional Arguments:</text><text
class="terminal-2627781444-r1" x="976" y="581.2" textLength="12.2"
clip-path="url(#terminal-2627781444-line-23)">
+</text><text class="terminal-2627781444-r1" x="0" y="605.6" textLength="622.2"
clip-path="url(#terminal-2627781444-line-24)">  -h, --help        show this help message and exit</text><text
class="terminal-2627781444-r1" x="976" y="605.6" textLength="12.2"
clip-path="url(#terminal-2627781444-line-24)">
</text>
</g>
</g>
diff --git a/airflow-ctl/docs/images/output_version.svg
b/airflow-ctl/docs/images/output_version.svg
index ada202db71e..511817f589a 100644
--- a/airflow-ctl/docs/images/output_version.svg
+++ b/airflow-ctl/docs/images/output_version.svg
@@ -1,4 +1,4 @@
-<svg class="rich-terminal" viewBox="0 0 994 294.0"
xmlns="http://www.w3.org/2000/svg">
+<svg class="rich-terminal" viewBox="0 0 994 196.39999999999998"
xmlns="http://www.w3.org/2000/svg">
<!-- Generated with Rich https://www.textualize.io -->
<style>
@@ -19,75 +19,59 @@
font-weight: 700;
}
- .terminal-2016382024-matrix {
+ .terminal-2624149572-matrix {
font-family: Fira Code, monospace;
font-size: 20px;
line-height: 24.4px;
font-variant-east-asian: full-width;
}
- .terminal-2016382024-title {
+ .terminal-2624149572-title {
font-size: 18px;
font-weight: bold;
font-family: arial;
}
- .terminal-2016382024-r1 { fill: #c5c8c6 }
+ .terminal-2624149572-r1 { fill: #c5c8c6 }
</style>
<defs>
- <clipPath id="terminal-2016382024-clip-terminal">
- <rect x="0" y="0" width="975.0" height="243.0" />
+ <clipPath id="terminal-2624149572-clip-terminal">
+ <rect x="0" y="0" width="975.0" height="145.39999999999998" />
</clipPath>
- <clipPath id="terminal-2016382024-line-0">
+ <clipPath id="terminal-2624149572-line-0">
<rect x="0" y="1.5" width="976" height="24.65"/>
</clipPath>
-<clipPath id="terminal-2016382024-line-1">
+<clipPath id="terminal-2624149572-line-1">
<rect x="0" y="25.9" width="976" height="24.65"/>
</clipPath>
-<clipPath id="terminal-2016382024-line-2">
+<clipPath id="terminal-2624149572-line-2">
<rect x="0" y="50.3" width="976" height="24.65"/>
</clipPath>
-<clipPath id="terminal-2016382024-line-3">
+<clipPath id="terminal-2624149572-line-3">
<rect x="0" y="74.7" width="976" height="24.65"/>
</clipPath>
-<clipPath id="terminal-2016382024-line-4">
+<clipPath id="terminal-2624149572-line-4">
<rect x="0" y="99.1" width="976" height="24.65"/>
</clipPath>
-<clipPath id="terminal-2016382024-line-5">
- <rect x="0" y="123.5" width="976" height="24.65"/>
- </clipPath>
-<clipPath id="terminal-2016382024-line-6">
- <rect x="0" y="147.9" width="976" height="24.65"/>
- </clipPath>
-<clipPath id="terminal-2016382024-line-7">
- <rect x="0" y="172.3" width="976" height="24.65"/>
- </clipPath>
-<clipPath id="terminal-2016382024-line-8">
- <rect x="0" y="196.7" width="976" height="24.65"/>
- </clipPath>
</defs>
- <rect fill="#292929" stroke="rgba(255,255,255,0.35)" stroke-width="1"
x="1" y="1" width="992" height="292" rx="8"/><text
class="terminal-2016382024-title" fill="#c5c8c6" text-anchor="middle" x="496"
y="27">Command: version</text>
+ <rect fill="#292929" stroke="rgba(255,255,255,0.35)" stroke-width="1"
x="1" y="1" width="992" height="194.4" rx="8"/><text
class="terminal-2624149572-title" fill="#c5c8c6" text-anchor="middle" x="496"
y="27">Command: version</text>
<g transform="translate(26,22)">
<circle cx="0" cy="0" r="7" fill="#ff5f57"/>
<circle cx="22" cy="0" r="7" fill="#febc2e"/>
<circle cx="44" cy="0" r="7" fill="#28c840"/>
</g>
- <g transform="translate(9, 41)"
clip-path="url(#terminal-2016382024-clip-terminal)">
+ <g transform="translate(9, 41)"
clip-path="url(#terminal-2624149572-clip-terminal)">
- <g class="terminal-2016382024-matrix">
- <text class="terminal-2016382024-r1" x="0" y="20" textLength="512.4"
clip-path="url(#terminal-2016382024-line-0)">Usage: airflowctl version [-h] COMMAND ...</text><text
class="terminal-2016382024-r1" x="976" y="20" textLength="12.2"
clip-path="url(#terminal-2016382024-line-0)">
-</text><text class="terminal-2016382024-r1" x="976" y="44.4" textLength="12.2"
clip-path="url(#terminal-2016382024-line-1)">
-</text><text class="terminal-2016382024-r1" x="0" y="68.8" textLength="317.2"
clip-path="url(#terminal-2016382024-line-2)">Perform Version operations</text><text
class="terminal-2016382024-r1" x="976" y="68.8" textLength="12.2"
clip-path="url(#terminal-2016382024-line-2)">
-</text><text class="terminal-2016382024-r1" x="976" y="93.2" textLength="12.2"
clip-path="url(#terminal-2016382024-line-3)">
-</text><text class="terminal-2016382024-r1" x="0" y="117.6" textLength="256.2"
clip-path="url(#terminal-2016382024-line-4)">Positional Arguments:</text><text
class="terminal-2016382024-r1" x="976" y="117.6" textLength="12.2"
clip-path="url(#terminal-2016382024-line-4)">
-</text><text class="terminal-2016382024-r1" x="0" y="142" textLength="109.8"
clip-path="url(#terminal-2016382024-line-5)">  COMMAND</text><text
class="terminal-2016382024-r1" x="976" y="142" textLength="12.2"
clip-path="url(#terminal-2016382024-line-5)">
-</text><text class="terminal-2016382024-r1" x="0" y="166.4" textLength="427"
clip-path="url(#terminal-2016382024-line-6)">    get       Perform get operation</text><text
class="terminal-2016382024-r1" x="976" y="166.4" textLength="12.2"
clip-path="url(#terminal-2016382024-line-6)">
-</text><text class="terminal-2016382024-r1" x="976" y="190.8"
textLength="12.2" clip-path="url(#terminal-2016382024-line-7)">
-</text><text class="terminal-2016382024-r1" x="0" y="215.2" textLength="231.8"
clip-path="url(#terminal-2016382024-line-8)">Optional Arguments:</text><text
class="terminal-2016382024-r1" x="976" y="215.2" textLength="12.2"
clip-path="url(#terminal-2016382024-line-8)">
-</text><text class="terminal-2016382024-r1" x="0" y="239.6" textLength="549"
clip-path="url(#terminal-2016382024-line-9)">  -h, --help  show this help message and exit</text><text
class="terminal-2016382024-r1" x="976" y="239.6" textLength="12.2"
clip-path="url(#terminal-2016382024-line-9)">
+ <g class="terminal-2624149572-matrix">
+ <text class="terminal-2624149572-r1" x="0" y="20" textLength="366"
clip-path="url(#terminal-2624149572-line-0)">Usage: airflowctl version [-h]</text><text
class="terminal-2624149572-r1" x="976" y="20" textLength="12.2"
clip-path="url(#terminal-2624149572-line-0)">
+</text><text class="terminal-2624149572-r1" x="976" y="44.4" textLength="12.2"
clip-path="url(#terminal-2624149572-line-1)">
+</text><text class="terminal-2624149572-r1" x="0" y="68.8" textLength="292.8"
clip-path="url(#terminal-2624149572-line-2)">Show version information</text><text
class="terminal-2624149572-r1" x="976" y="68.8" textLength="12.2"
clip-path="url(#terminal-2624149572-line-2)">
+</text><text class="terminal-2624149572-r1" x="976" y="93.2" textLength="12.2"
clip-path="url(#terminal-2624149572-line-3)">
+</text><text class="terminal-2624149572-r1" x="0" y="117.6" textLength="231.8"
clip-path="url(#terminal-2624149572-line-4)">Optional Arguments:</text><text
class="terminal-2624149572-r1" x="976" y="117.6" textLength="12.2"
clip-path="url(#terminal-2624149572-line-4)">
+</text><text class="terminal-2624149572-r1" x="0" y="142" textLength="549"
clip-path="url(#terminal-2624149572-line-5)">  -h, --help  show this help message and exit</text><text
class="terminal-2624149572-r1" x="976" y="142" textLength="12.2"
clip-path="url(#terminal-2624149572-line-5)">
</text>
</g>
</g>
diff --git a/airflow-ctl/src/airflowctl/ctl/cli_config.py
b/airflow-ctl/src/airflowctl/ctl/cli_config.py
index 3314bb84a97..7da28d8b774 100644
--- a/airflow-ctl/src/airflowctl/ctl/cli_config.py
+++ b/airflow-ctl/src/airflowctl/ctl/cli_config.py
@@ -387,7 +387,7 @@ class CommandFactory:
with open(self.file_path, encoding="utf-8") as file:
tree = ast.parse(file.read(), filename=self.file_path)
- exclude_operation_names = ["LoginOperations"]
+ exclude_operation_names = ["LoginOperations", "VersionOperations"]
exclude_method_names = [
"error",
"__init__",
@@ -609,10 +609,12 @@ def merge_commands(
List of merged commands.
"""
merge_command_map = {}
+ new_commands: list[CLICommand] = []
for command in commands_will_be_merged:
+ if isinstance(command, ActionCommand):
+ new_commands.append(command)
if isinstance(command, GroupCommand):
merge_command_map[command.name] = command
- new_commands: list[CLICommand] = []
merged_commands = []
# Common commands
for command in base_commands:
@@ -721,6 +723,13 @@ core_commands: list[CLICommand] = [
help="Manage Airflow pools",
subcommands=POOL_COMMANDS,
),
+ ActionCommand(
+ name="version",
+ help="Show version information",
+ description="Show version information",
+
func=lazy_load_command("airflowctl.ctl.commands.version_command.version_info"),
+ args=(),
+ ),
GroupCommand(
name="variables",
help="Manage Airflow variables",
diff --git a/airflow-ctl/src/airflowctl/ctl/commands/version_command.py
b/airflow-ctl/src/airflowctl/ctl/commands/version_command.py
new file mode 100644
index 00000000000..2c8e103c937
--- /dev/null
+++ b/airflow-ctl/src/airflowctl/ctl/commands/version_command.py
@@ -0,0 +1,31 @@
+# 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 __future__ import annotations
+
+import rich
+
+from airflowctl import __version__ as airflowctl_version
+from airflowctl.api.client import NEW_API_CLIENT, ClientKind,
provide_api_client
+
+
+@provide_api_client(kind=ClientKind.CLI)
+def version_info(arg, api_client=NEW_API_CLIENT):
+ """Get version information."""
+ version_response = api_client.version.get()
+ version_dict = version_response.model_dump()
+ version_dict["airflowctl_version"] = airflowctl_version
+ rich.print(version_dict)
diff --git a/airflow-ctl/tests/airflow_ctl/ctl/commands/test_version_command.py
b/airflow-ctl/tests/airflow_ctl/ctl/commands/test_version_command.py
new file mode 100644
index 00000000000..389348b4ec4
--- /dev/null
+++ b/airflow-ctl/tests/airflow_ctl/ctl/commands/test_version_command.py
@@ -0,0 +1,54 @@
+# 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 __future__ import annotations
+
+from contextlib import redirect_stdout
+from io import StringIO
+from unittest import mock
+
+import pytest
+
+from airflowctl.api.client import Client
+from airflowctl.ctl import cli_parser
+from airflowctl.ctl.commands.version_command import version_info
+
+
[email protected]
+def mock_client():
+ """create a mock client"""
+ with mock.patch("airflowctl.api.client.get_client") as mock_get_client:
+ client = mock.MagicMock(spec=Client)
+ mock_get_client.return_value.__enter__.return_value = client
+
+ client.version.get.return_value.model_dump.return_value = {
+ "version": "3.1.0",
+ "git_version": None,
+ "airflowctl_version": "1.0.0",
+ }
+
+ return client
+
+
+parser = cli_parser.get_parser()
+
+
+def test_ctl_version(mock_client):
+ with redirect_stdout(StringIO()) as stdout:
+ version_info(parser.parse_args(["version"]), api_client=mock_client)
+ assert "version" in stdout.getvalue()
+ assert "git_version" in stdout.getvalue()
+ assert "airflowctl_version" in stdout.getvalue()