amoghrajesh commented on code in PR #33207:
URL: https://github.com/apache/airflow/pull/33207#discussion_r1287399331


##########
dev/breeze/src/airflow_breeze/commands/release_management_commands.py:
##########
@@ -815,7 +815,10 @@ def publish_docs(
 
 @release_management.command(
     name="add-back-references",
-    help="Command to add back references for documentation to make it backward 
compatible",
+    help="Command to add back references for documentation to make it backward 
compatible. "
+    "By default it generates back references for all providers. You can also 
specify "
+    "'apache-airflow' or 'helm-chart` as parameter to generate back references 
for them or you "
+    "can specify short ids of packages explicitly (including 'apache-airflow' 
and 'helm-chart').",

Review Comment:
   We know that by default it generates for providers but we should also 
include that in the description here



##########
BREEZE.rst:
##########
@@ -2034,23 +2034,35 @@ To add back references to the documentation generated 
by ``build-docs`` in Breez
 use the ``release-management add-back-references`` command. This is important 
to support backward compatibility
 the airflow documentation.
 
-.. code-block:: bash
-
-     breeze release-management add-back-references
+You have to specify which packages you run it on. For example you can run it 
for all providers:
 
 .. code-block:: bash
 
-     release-management add-back-references --airflow-site-directory DIRECTORY
+     release-management add-back-references --airflow-site-directory DIRECTORY 
all-providers
 
 The flag ``--airflow-site-directory`` takes the path of the cloned 
``airflow-site``. The command will
 not proceed if this is an invalid path.
 
+You can also run the command for apache-airflow (core documentation):
+
+.. code-block:: bash
+
+     breeze release-management publish-docs --airflow-site-directory DIRECTORY 
apache-airflow
+
+Also for helm-chart package:
+
+.. code-block:: bash
+
+     breeze release-management publish-docs --airflow-site-directory DIRECTORY 
helm-chart
+
+
+You can also manually specify (it's auto-completable) list of packages to run 
the command for including individual
+providers - you can mix apache-airflow, helm-chart and provider packages this 
way:
+
 .. code-block:: bash
 
-     breeze release-management publish-docs --gen-type [airflow | providers | 
helm]
+     breeze release-management publish-docs --airflow-site-directory DIRECTORY 
apache.airflow apache.beam google

Review Comment:
   Should we mention `DIRECRTORY` here? It has to be a copy pastable command 
right?



##########
dev/breeze/src/airflow_breeze/utils/add_back_references.py:
##########
@@ -149,26 +141,23 @@ def generate_back_references(link: str, base_path: Path):
                 create_back_reference_html(relative_path, dest_file_path)
 
 
-def start_generating_back_references(
-    gen_type: GenerationType, airflow_site_directory: Path, 
short_provider_package_ids: list[str]
-):
-    # Either packages or gen_type should be provided
+def start_generating_back_references(airflow_site_directory: Path, 
short_provider_package_ids: list[str]):
     docs_archive_path = airflow_site_directory / "docs-archive"
     airflow_docs_path = docs_archive_path / "apache-airflow"
     helm_docs_path = docs_archive_path / "helm-chart"
-
-    if gen_type == GenerationType.airflow:
+    if "apache-airflow" in short_provider_package_ids:
         generate_back_references(airflow_redirects_link, airflow_docs_path)
-    elif gen_type == GenerationType.helm:
+        short_provider_package_ids.remove("apache-airflow")
+    if "helm-chart" in short_provider_package_ids:
         generate_back_references(helm_redirects_link, helm_docs_path)
-    elif gen_type == GenerationType.providers:
-        if short_provider_package_ids:
-            all_providers = [
-                f"apache-airflow-providers-{package.replace('.','-')}"
-                for package in short_provider_package_ids
-            ]
-        else:
-            all_providers = get_available_documentation_provider_packages()
+        short_provider_package_ids.remove("helm-chart")
+    if "docker-stack" in short_provider_package_ids:
+        get_console().print("[info]Skipping docker-stack package. No 
back-reference needed.")
+        short_provider_package_ids.remove("docker-stack")
+    if short_provider_package_ids:
+        all_providers = [
+            f"apache-airflow-providers-{package.replace('.','-')}" for package 
in short_provider_package_ids
+        ]

Review Comment:
   It will enter at most one of the blocks. Cant it be if, elif blocks?



##########
dev/breeze/src/airflow_breeze/utils/common_options.py:
##########
@@ -448,7 +448,13 @@ def _set_default_from_parent(ctx: click.core.Context, 
option: click.core.Option,
     "packages",
     nargs=-1,
     required=False,
-    
type=BetterChoice(get_available_documentation_provider_packages(short_version=True)),
+    
type=BetterChoice(get_available_documentation_packages(short_version=True)),
+)
+argument_packages_plus_all_providers = click.argument(
+    "packages_plus_all_providers",
+    nargs=-1,
+    required=False,
+    type=BetterChoice(["all-providers"] + 
get_available_documentation_packages(short_version=True)),

Review Comment:
   I like this!



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to