poorvirohidekar commented on code in PR #38447:
URL: https://github.com/apache/airflow/pull/38447#discussion_r1538111221
##########
dev/breeze/src/airflow_breeze/commands/release_management_commands.py:
##########
@@ -949,6 +950,72 @@ def run_generate_constraints_in_parallel(
)
+@release_management.command(
+ name="tag-providers",
+ help="Generates tags for airflow provider releases.",
+)
+@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:
+ get_console().print("[success]{push_output}[/]")
+ if push_error:
+ get_console().print("[error]{push_error}[/]")
+ get_console().print("\n[success]Tags pushed successfully.[/]")
+ except subprocess.CalledProcessError:
+ get_console().print("\n[error]Failed to push tags, probably a
connectivity issue to Github.[/]")
+ clean_local_tags = os.environ.get("CLEAN_LOCAL_TAGS",
"true").lower() == "true"
Review Comment:
Added this flag
--
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]