amoghrajesh commented on code in PR #38447:
URL: https://github.com/apache/airflow/pull/38447#discussion_r1537083067
##########
dev/breeze/doc/09_release_management_tasks.rst:
##########
@@ -189,6 +189,26 @@ These are all of the available flags for the
``release-prod-images`` command:
:width: 100%
:alt: Breeze release management release prod images
+Adding git tags for providers
+"""""""""""""""""""""""""""
Review Comment:
There are a few quotes missing. You need to cover the heading with quotes
##########
dev/breeze/src/airflow_breeze/commands/release_management_commands.py:
##########
@@ -949,6 +950,70 @@ def run_generate_constraints_in_parallel(
)
+@release_management.command(
+ name="tag-providers",
+ help="Generates tags for providers.",
Review Comment:
nit: Generates tags for airflow provider releases
##########
dev/breeze/src/airflow_breeze/commands/release_management_commands.py:
##########
@@ -949,6 +950,70 @@ def run_generate_constraints_in_parallel(
)
+@release_management.command(
+ name="tag-providers",
+ help="Generates tags for providers.",
+)
+@option_dry_run
+@option_verbose
+def tag_providers():
+ found_remote = None
+ remotes = ["origin", "apache"]
+ for remote in remotes:
+ try:
+ command = ["git", "remote", "get-url", "--push",
shlex.quote(remote)]
+ result = subprocess.run(command, stdout=subprocess.PIPE,
stderr=subprocess.DEVNULL, text=True)
+ if "apache/airflow.git" in result.stdout:
+ found_remote = remote
+ break
+ except subprocess.CalledProcessError:
+ pass
+
+ if found_remote is None:
+ raise ValueError("Could not find remote configured to push to
apache/airflow")
+
+ tags = []
+ for file in os.listdir(os.path.join(SOURCE_DIR_PATH, "dist")):
+ if file.endswith(".whl"):
+ match = re.match(r".*airflow_providers_(.*)-(.*)-py3.*", file)
+ if match:
+ provider = f"providers-{match.group(1).replace('_', '-')}"
+ tag = f"{provider}/{match.group(2)}"
+ try:
+ subprocess.run(
+ ["git", "tag", shlex.quote(tag), "-m", f"Release
{date.today()} of providers"],
+ check=True,
+ )
+ tags.append(tag)
+ except subprocess.CalledProcessError:
+ pass
+
+ if tags and len(tags) > 0:
+ try:
+ push_command = ["git", "push", remote] + [shlex.quote(tag) for tag
in tags]
+ push_result = subprocess.Popen(
+ push_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE,
text=True
+ )
+ push_output, push_error = push_result.communicate()
+ if push_output:
+ print(push_output)
+ if push_error:
+ print(push_error)
+ print("Tags pushed successfully")
Review Comment:
Let us use get_console().print() instead with appropriate level of error?
For example:
For success, you can do this:
`get_console().print("[success]{push_output}[/]")`
For error:
`get_console().print("[error]{push_error}[/]")`
And similarly in other places as well
##########
dev/breeze/doc/09_release_management_tasks.rst:
##########
@@ -189,6 +189,26 @@ These are all of the available flags for the
``release-prod-images`` command:
:width: 100%
:alt: Breeze release management release prod images
+Adding git tags for providers
+"""""""""""""""""""""""""""
+
+Assume that your remote for apache repository is called apache you should now
set tags for the providers in the repo.
+Sometimes in cases when there is a connectivity issue to Github, it might be
possible that local tags get created and lead to annoying errors.
+The default behaviour would be to clean such local tags up.
+
+If you want to disable this behaviour, set the env CLEAN_LOCAL_TAGS to false.
Review Comment:
This text doesn't define the intention of the command, can you reword
something like this:
```
This command can be utilized to manage git tags for providers within the
airflow remote repository during provider releases. Sometimes in cases when
there is a connectivity issue to Github, it might be possible that local tags
get created and lead to annoying errors. The default behaviour would be to
clean such local tags up.
```
--
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]