Lee-W commented on code in PR #38447:
URL: https://github.com/apache/airflow/pull/38447#discussion_r1538540678
##########
dev/breeze/src/airflow_breeze/commands/release_management_commands.py:
##########
@@ -949,6 +950,81 @@ def run_generate_constraints_in_parallel(
)
+@release_management.command(
+ name="tag-providers",
+ help="Generates tags for airflow provider releases.",
+)
[email protected](
+ "--clean-local-tags",
+ default=True,
+ is_flag=True,
+ envvar="CLEAN_LOCAL_TAGS",
+ help="Delete local tags that are created due to github connectivity issues
to avoid errors. "
+ "The default behaviour would be to clean such local tags.",
+ show_default=True,
+)
+@option_dry_run
+@option_verbose
+def tag_providers(
+ clean_local_tags: bool,
+):
+ found_remote = None
+ remotes = ["origin", "apache"]
+ for remote in remotes:
+ try:
+ command = ["git", "remote", "get-url", "--push",
shlex.quote(remote)]
+ result = run_command(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:
+ run_command(
+ ["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:
Review Comment:
I think we might not need `len(tags) > 0`.
```suggestion
if tags:
```
--
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]