You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by "kaxil (via GitHub)" <gi...@apache.org> on 2025/08/26 21:54:30 UTC
[PR] Dev: Add Task SDK support to `start-rc-process` [airflow]
kaxil opened a new pull request, #54960:
URL: https://github.com/apache/airflow/pull/54960
Added support to automate building Task SDK too and `--remote-name` parameter to allow passing a different remote (for example I use a different remote than origin). Also added some validations to prevent errors!
<!--
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.
-->
<!--
Thank you for contributing! Please make sure that your code changes
are covered with tests. And in case of new features or big changes
remember to adjust the documentation.
Feel free to ping committers for the review!
In case of an existing issue, reference it using one of the following:
closes: #ISSUE
related: #ISSUE
How to write a good git commit message:
http://chris.beams.io/posts/git-commit/
-->
<!-- Please keep an empty line above the dashes. -->
---
**^ Add meaningful description above**
Read the **[Pull Request Guidelines](https://github.com/apache/airflow/blob/main/contributing-docs/05_pull_requests.rst#pull-request-guidelines)** for more information.
In case of fundamental code changes, an Airflow Improvement Proposal ([AIP](https://cwiki.apache.org/confluence/display/AIRFLOW/Airflow+Improvement+Proposals)) is needed.
In case of a new dependency, check compliance with the [ASF 3rd Party License Policy](https://www.apache.org/legal/resolved.html#category-x).
In case of backwards incompatible changes please leave a note in a newsfragment file, named `{pr_number}.significant.rst` or `{issue_number}.significant.rst`, in [airflow-core/newsfragments](https://github.com/apache/airflow/tree/main/airflow-core/newsfragments).
--
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: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Dev: Add Task SDK support to `start-rc-process` [airflow]
Posted by "kaxil (via GitHub)" <gi...@apache.org>.
kaxil merged PR #54960:
URL: https://github.com/apache/airflow/pull/54960
--
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: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Dev: Add Task SDK support to `start-rc-process` [airflow]
Posted by "kaxil (via GitHub)" <gi...@apache.org>.
kaxil commented on code in PR #54960:
URL: https://github.com/apache/airflow/pull/54960#discussion_r2302287044
##########
dev/breeze/src/airflow_breeze/commands/release_candidate_command.py:
##########
@@ -32,7 +32,179 @@
from airflow_breeze.utils.shared_options import get_dry_run
-def merge_pr(version_branch):
+def validate_remote_tracks_apache_airflow(remote_name):
+ """Validate that the specified remote tracks the apache/airflow repository."""
+ console_print(f"[info]Validating remote '{remote_name}' tracks apache/airflow...")
+
+ result = run_command(
+ ["git", "remote", "get-url", remote_name],
+ check=False,
+ capture_output=True,
+ text=True,
+ dry_run_override=False,
+ )
+
+ if result.returncode != 0:
+ console_print(f"[error]Remote '{remote_name}' does not exist!")
+ console_print("Available remotes:")
+ run_command(["git", "remote", "-v"])
+ exit(1)
+
+ remote_url = result.stdout.strip()
+
+ # Check if it's the apache/airflow repository
+ apache_patterns = [
+ "https://github.com/apache/airflow",
+ "https://github.com/apache/airflow.git",
+ "git@github.com:apache/airflow",
+ "git@github.com:apache/airflow.git",
+ "ssh://git@github.com/apache/airflow",
+ "ssh://git@github.com/apache/airflow.git",
+ ]
+
+ is_apache_repo = any(pattern in remote_url for pattern in apache_patterns)
+
+ if not is_apache_repo:
+ console_print(f"[error]Remote '{remote_name}' does not track apache/airflow!")
+ console_print(f"Remote URL: {remote_url}")
+ console_print("Expected patterns: apache/airflow")
+ if not confirm_action("Do you want to continue anyway? This is NOT recommended for releases."):
+ exit(1)
+ else:
+ console_print(f"[success]Remote '{remote_name}' correctly tracks apache/airflow")
+
+
+def validate_git_status():
+ """Validate that git working directory is clean."""
+ console_print("[info]Validating git status...")
+
+ # Check if working directory is clean
+ result = run_command(
+ ["git", "status", "--porcelain"],
+ check=True,
+ capture_output=True,
+ text=True,
+ )
+
+ if result.stdout.strip():
+ console_print("[error]Working directory is not clean!")
+ run_command(["git", "status"])
+ if not confirm_action("Do you want to continue with uncommitted changes? This is NOT recommended."):
+ exit(1)
+ else:
+ console_print("[success]Working directory is clean")
Review Comment:
Fixed in https://github.com/apache/airflow/pull/54960/commits/769435bffc94d9b857c3c3b008dade6a43b01f1e
##########
dev/breeze/src/airflow_breeze/commands/release_candidate_command.py:
##########
@@ -32,7 +32,179 @@
from airflow_breeze.utils.shared_options import get_dry_run
-def merge_pr(version_branch):
+def validate_remote_tracks_apache_airflow(remote_name):
+ """Validate that the specified remote tracks the apache/airflow repository."""
+ console_print(f"[info]Validating remote '{remote_name}' tracks apache/airflow...")
+
+ result = run_command(
+ ["git", "remote", "get-url", remote_name],
+ check=False,
+ capture_output=True,
+ text=True,
+ dry_run_override=False,
+ )
+
+ if result.returncode != 0:
+ console_print(f"[error]Remote '{remote_name}' does not exist!")
+ console_print("Available remotes:")
+ run_command(["git", "remote", "-v"])
+ exit(1)
+
+ remote_url = result.stdout.strip()
+
+ # Check if it's the apache/airflow repository
+ apache_patterns = [
+ "https://github.com/apache/airflow",
+ "https://github.com/apache/airflow.git",
+ "git@github.com:apache/airflow",
+ "git@github.com:apache/airflow.git",
+ "ssh://git@github.com/apache/airflow",
+ "ssh://git@github.com/apache/airflow.git",
+ ]
+
+ is_apache_repo = any(pattern in remote_url for pattern in apache_patterns)
+
+ if not is_apache_repo:
+ console_print(f"[error]Remote '{remote_name}' does not track apache/airflow!")
+ console_print(f"Remote URL: {remote_url}")
+ console_print("Expected patterns: apache/airflow")
+ if not confirm_action("Do you want to continue anyway? This is NOT recommended for releases."):
+ exit(1)
+ else:
+ console_print(f"[success]Remote '{remote_name}' correctly tracks apache/airflow")
Review Comment:
Fixed in https://github.com/apache/airflow/pull/54960/commits/769435bffc94d9b857c3c3b008dade6a43b01f1e
--
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: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Dev: Add Task SDK support to `start-rc-process` [airflow]
Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #54960:
URL: https://github.com/apache/airflow/pull/54960#issuecomment-3226033881
### Backport successfully created: v3-0-test
<table>
<tr>
<th>Status</th>
<th>Branch</th>
<th>Result</th>
</tr>
<tr>
<td>✅</td>
<td>v3-0-test</td>
<td><a href="https://github.com/apache/airflow/pull/54963"><img src="https://img.shields.io/badge/PR-54963-blue" alt="PR Link"></a></td>
</tr>
</table>
--
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: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Dev: Add Task SDK support to `start-rc-process` [airflow]
Posted by "jedcunningham (via GitHub)" <gi...@apache.org>.
jedcunningham commented on code in PR #54960:
URL: https://github.com/apache/airflow/pull/54960#discussion_r2302231289
##########
dev/breeze/src/airflow_breeze/commands/release_candidate_command.py:
##########
@@ -32,7 +32,179 @@
from airflow_breeze.utils.shared_options import get_dry_run
-def merge_pr(version_branch):
+def validate_remote_tracks_apache_airflow(remote_name):
+ """Validate that the specified remote tracks the apache/airflow repository."""
+ console_print(f"[info]Validating remote '{remote_name}' tracks apache/airflow...")
+
+ result = run_command(
+ ["git", "remote", "get-url", remote_name],
+ check=False,
+ capture_output=True,
+ text=True,
+ dry_run_override=False,
+ )
+
+ if result.returncode != 0:
+ console_print(f"[error]Remote '{remote_name}' does not exist!")
+ console_print("Available remotes:")
+ run_command(["git", "remote", "-v"])
+ exit(1)
+
+ remote_url = result.stdout.strip()
+
+ # Check if it's the apache/airflow repository
+ apache_patterns = [
+ "https://github.com/apache/airflow",
+ "https://github.com/apache/airflow.git",
+ "git@github.com:apache/airflow",
+ "git@github.com:apache/airflow.git",
+ "ssh://git@github.com/apache/airflow",
+ "ssh://git@github.com/apache/airflow.git",
+ ]
+
+ is_apache_repo = any(pattern in remote_url for pattern in apache_patterns)
+
+ if not is_apache_repo:
+ console_print(f"[error]Remote '{remote_name}' does not track apache/airflow!")
+ console_print(f"Remote URL: {remote_url}")
+ console_print("Expected patterns: apache/airflow")
+ if not confirm_action("Do you want to continue anyway? This is NOT recommended for releases."):
+ exit(1)
+ else:
+ console_print(f"[success]Remote '{remote_name}' correctly tracks apache/airflow")
+
+
+def validate_git_status():
+ """Validate that git working directory is clean."""
+ console_print("[info]Validating git status...")
+
+ # Check if working directory is clean
+ result = run_command(
+ ["git", "status", "--porcelain"],
+ check=True,
+ capture_output=True,
+ text=True,
+ )
+
+ if result.stdout.strip():
+ console_print("[error]Working directory is not clean!")
+ run_command(["git", "status"])
+ if not confirm_action("Do you want to continue with uncommitted changes? This is NOT recommended."):
+ exit(1)
+ else:
+ console_print("[success]Working directory is clean")
+
+
+def validate_version_branches_exist(version_branch, remote_name):
+ """Validate that the required version branches exist."""
+ console_print(f"[info]Validating version branches exist for {version_branch}...")
+
+ # Check if test branch exists
+ test_branch = f"v{version_branch}-test"
+ stable_branch = f"v{version_branch}-stable"
+
+ # Fetch to get latest remote branches
+ run_command(["git", "fetch", remote_name], check=True)
+
+ # Check remote branches
+ result = run_command(
+ ["git", "branch", "-r"],
+ check=True,
+ capture_output=True,
+ text=True,
+ dry_run_override=False,
+ )
+ remote_branches = result.stdout
+
+ test_branch_exists = f"{remote_name}/{test_branch}" in remote_branches
+ stable_branch_exists = f"{remote_name}/{stable_branch}" in remote_branches
+
+ if not test_branch_exists:
+ console_print(f"[error]Test branch '{remote_name}/{test_branch}' does not exist!")
+ console_print("Available remote branches:")
+ run_command(["git", "branch", "-r"])
+ exit(1)
+ else:
+ console_print(f"[success]Test branch '{remote_name}/{test_branch}' exists")
Review Comment:
```suggestion
console_print(f"[success]Test branch '{remote_name}/{test_branch}' exists")
```
nit
##########
dev/breeze/src/airflow_breeze/commands/release_candidate_command.py:
##########
@@ -32,7 +32,179 @@
from airflow_breeze.utils.shared_options import get_dry_run
-def merge_pr(version_branch):
+def validate_remote_tracks_apache_airflow(remote_name):
+ """Validate that the specified remote tracks the apache/airflow repository."""
+ console_print(f"[info]Validating remote '{remote_name}' tracks apache/airflow...")
+
+ result = run_command(
+ ["git", "remote", "get-url", remote_name],
+ check=False,
+ capture_output=True,
+ text=True,
+ dry_run_override=False,
+ )
+
+ if result.returncode != 0:
+ console_print(f"[error]Remote '{remote_name}' does not exist!")
+ console_print("Available remotes:")
+ run_command(["git", "remote", "-v"])
+ exit(1)
+
+ remote_url = result.stdout.strip()
+
+ # Check if it's the apache/airflow repository
+ apache_patterns = [
+ "https://github.com/apache/airflow",
+ "https://github.com/apache/airflow.git",
+ "git@github.com:apache/airflow",
+ "git@github.com:apache/airflow.git",
+ "ssh://git@github.com/apache/airflow",
+ "ssh://git@github.com/apache/airflow.git",
+ ]
+
+ is_apache_repo = any(pattern in remote_url for pattern in apache_patterns)
+
+ if not is_apache_repo:
+ console_print(f"[error]Remote '{remote_name}' does not track apache/airflow!")
+ console_print(f"Remote URL: {remote_url}")
+ console_print("Expected patterns: apache/airflow")
+ if not confirm_action("Do you want to continue anyway? This is NOT recommended for releases."):
+ exit(1)
+ else:
+ console_print(f"[success]Remote '{remote_name}' correctly tracks apache/airflow")
Review Comment:
```suggestion
console_print(f"[success]Remote '{remote_name}' correctly tracks apache/airflow")
```
nit
##########
dev/breeze/src/airflow_breeze/commands/release_candidate_command.py:
##########
@@ -32,7 +32,179 @@
from airflow_breeze.utils.shared_options import get_dry_run
-def merge_pr(version_branch):
+def validate_remote_tracks_apache_airflow(remote_name):
+ """Validate that the specified remote tracks the apache/airflow repository."""
+ console_print(f"[info]Validating remote '{remote_name}' tracks apache/airflow...")
+
+ result = run_command(
+ ["git", "remote", "get-url", remote_name],
+ check=False,
+ capture_output=True,
+ text=True,
+ dry_run_override=False,
+ )
+
+ if result.returncode != 0:
+ console_print(f"[error]Remote '{remote_name}' does not exist!")
+ console_print("Available remotes:")
+ run_command(["git", "remote", "-v"])
+ exit(1)
+
+ remote_url = result.stdout.strip()
+
+ # Check if it's the apache/airflow repository
+ apache_patterns = [
+ "https://github.com/apache/airflow",
+ "https://github.com/apache/airflow.git",
+ "git@github.com:apache/airflow",
+ "git@github.com:apache/airflow.git",
+ "ssh://git@github.com/apache/airflow",
+ "ssh://git@github.com/apache/airflow.git",
+ ]
+
+ is_apache_repo = any(pattern in remote_url for pattern in apache_patterns)
+
+ if not is_apache_repo:
+ console_print(f"[error]Remote '{remote_name}' does not track apache/airflow!")
+ console_print(f"Remote URL: {remote_url}")
+ console_print("Expected patterns: apache/airflow")
+ if not confirm_action("Do you want to continue anyway? This is NOT recommended for releases."):
+ exit(1)
+ else:
+ console_print(f"[success]Remote '{remote_name}' correctly tracks apache/airflow")
+
+
+def validate_git_status():
+ """Validate that git working directory is clean."""
+ console_print("[info]Validating git status...")
+
+ # Check if working directory is clean
+ result = run_command(
+ ["git", "status", "--porcelain"],
+ check=True,
+ capture_output=True,
+ text=True,
+ )
+
+ if result.stdout.strip():
+ console_print("[error]Working directory is not clean!")
+ run_command(["git", "status"])
+ if not confirm_action("Do you want to continue with uncommitted changes? This is NOT recommended."):
+ exit(1)
+ else:
+ console_print("[success]Working directory is clean")
Review Comment:
```suggestion
console_print("[success]Working directory is clean")
```
nit
##########
dev/breeze/src/airflow_breeze/commands/release_candidate_command.py:
##########
@@ -32,7 +32,179 @@
from airflow_breeze.utils.shared_options import get_dry_run
-def merge_pr(version_branch):
+def validate_remote_tracks_apache_airflow(remote_name):
+ """Validate that the specified remote tracks the apache/airflow repository."""
+ console_print(f"[info]Validating remote '{remote_name}' tracks apache/airflow...")
+
+ result = run_command(
+ ["git", "remote", "get-url", remote_name],
+ check=False,
+ capture_output=True,
+ text=True,
+ dry_run_override=False,
+ )
+
+ if result.returncode != 0:
+ console_print(f"[error]Remote '{remote_name}' does not exist!")
+ console_print("Available remotes:")
+ run_command(["git", "remote", "-v"])
+ exit(1)
+
+ remote_url = result.stdout.strip()
+
+ # Check if it's the apache/airflow repository
+ apache_patterns = [
+ "https://github.com/apache/airflow",
+ "https://github.com/apache/airflow.git",
+ "git@github.com:apache/airflow",
+ "git@github.com:apache/airflow.git",
+ "ssh://git@github.com/apache/airflow",
+ "ssh://git@github.com/apache/airflow.git",
+ ]
+
+ is_apache_repo = any(pattern in remote_url for pattern in apache_patterns)
+
+ if not is_apache_repo:
+ console_print(f"[error]Remote '{remote_name}' does not track apache/airflow!")
+ console_print(f"Remote URL: {remote_url}")
+ console_print("Expected patterns: apache/airflow")
+ if not confirm_action("Do you want to continue anyway? This is NOT recommended for releases."):
+ exit(1)
+ else:
+ console_print(f"[success]Remote '{remote_name}' correctly tracks apache/airflow")
+
+
+def validate_git_status():
+ """Validate that git working directory is clean."""
+ console_print("[info]Validating git status...")
+
+ # Check if working directory is clean
+ result = run_command(
+ ["git", "status", "--porcelain"],
+ check=True,
+ capture_output=True,
+ text=True,
+ )
+
+ if result.stdout.strip():
+ console_print("[error]Working directory is not clean!")
+ run_command(["git", "status"])
+ if not confirm_action("Do you want to continue with uncommitted changes? This is NOT recommended."):
+ exit(1)
+ else:
+ console_print("[success]Working directory is clean")
+
+
+def validate_version_branches_exist(version_branch, remote_name):
+ """Validate that the required version branches exist."""
+ console_print(f"[info]Validating version branches exist for {version_branch}...")
+
+ # Check if test branch exists
+ test_branch = f"v{version_branch}-test"
+ stable_branch = f"v{version_branch}-stable"
+
+ # Fetch to get latest remote branches
+ run_command(["git", "fetch", remote_name], check=True)
+
+ # Check remote branches
+ result = run_command(
+ ["git", "branch", "-r"],
+ check=True,
+ capture_output=True,
+ text=True,
+ dry_run_override=False,
+ )
+ remote_branches = result.stdout
+
+ test_branch_exists = f"{remote_name}/{test_branch}" in remote_branches
+ stable_branch_exists = f"{remote_name}/{stable_branch}" in remote_branches
+
+ if not test_branch_exists:
+ console_print(f"[error]Test branch '{remote_name}/{test_branch}' does not exist!")
+ console_print("Available remote branches:")
+ run_command(["git", "branch", "-r"])
+ exit(1)
+ else:
+ console_print(f"[success]Test branch '{remote_name}/{test_branch}' exists")
+
+ if not stable_branch_exists:
+ console_print(f"[error]Stable branch '{remote_name}/{stable_branch}' does not exist!")
+ console_print("Available remote branches:")
+ run_command(["git", "branch", "-r"])
+ exit(1)
+ else:
+ console_print(f"[success]Stable branch '{remote_name}/{stable_branch}' exists")
+
+
+def validate_tag_does_not_exist(version, remote_name):
+ """Validate that the release tag doesn't already exist."""
+ console_print(f"[info]Checking if tag '{version}' already exists...")
+
+ # Check if tag exists locally
+ local_result = run_command(
+ ["git", "tag", "-l", version],
+ check=True,
+ capture_output=True,
+ text=True,
+ )
+
+ # Check if tag exists on remote using ls-remote with --exit-code
+ remote_result = run_command(
+ ["git", "ls-remote", "--exit-code", "--tags", remote_name, f"refs/tags/{version}"],
+ check=False,
+ capture_output=True,
Review Comment:
Do we need to capture output if we are just checking the exit code?
##########
dev/breeze/src/airflow_breeze/commands/release_candidate_command.py:
##########
@@ -32,7 +32,179 @@
from airflow_breeze.utils.shared_options import get_dry_run
-def merge_pr(version_branch):
+def validate_remote_tracks_apache_airflow(remote_name):
+ """Validate that the specified remote tracks the apache/airflow repository."""
+ console_print(f"[info]Validating remote '{remote_name}' tracks apache/airflow...")
+
+ result = run_command(
+ ["git", "remote", "get-url", remote_name],
+ check=False,
+ capture_output=True,
+ text=True,
+ dry_run_override=False,
+ )
+
+ if result.returncode != 0:
+ console_print(f"[error]Remote '{remote_name}' does not exist!")
+ console_print("Available remotes:")
+ run_command(["git", "remote", "-v"])
+ exit(1)
+
+ remote_url = result.stdout.strip()
+
+ # Check if it's the apache/airflow repository
+ apache_patterns = [
+ "https://github.com/apache/airflow",
+ "https://github.com/apache/airflow.git",
+ "git@github.com:apache/airflow",
+ "git@github.com:apache/airflow.git",
+ "ssh://git@github.com/apache/airflow",
+ "ssh://git@github.com/apache/airflow.git",
+ ]
+
+ is_apache_repo = any(pattern in remote_url for pattern in apache_patterns)
+
+ if not is_apache_repo:
+ console_print(f"[error]Remote '{remote_name}' does not track apache/airflow!")
+ console_print(f"Remote URL: {remote_url}")
+ console_print("Expected patterns: apache/airflow")
+ if not confirm_action("Do you want to continue anyway? This is NOT recommended for releases."):
+ exit(1)
+ else:
+ console_print(f"[success]Remote '{remote_name}' correctly tracks apache/airflow")
+
+
+def validate_git_status():
+ """Validate that git working directory is clean."""
+ console_print("[info]Validating git status...")
+
+ # Check if working directory is clean
+ result = run_command(
+ ["git", "status", "--porcelain"],
+ check=True,
+ capture_output=True,
+ text=True,
+ )
+
+ if result.stdout.strip():
+ console_print("[error]Working directory is not clean!")
+ run_command(["git", "status"])
+ if not confirm_action("Do you want to continue with uncommitted changes? This is NOT recommended."):
+ exit(1)
+ else:
+ console_print("[success]Working directory is clean")
+
+
+def validate_version_branches_exist(version_branch, remote_name):
+ """Validate that the required version branches exist."""
+ console_print(f"[info]Validating version branches exist for {version_branch}...")
+
+ # Check if test branch exists
+ test_branch = f"v{version_branch}-test"
+ stable_branch = f"v{version_branch}-stable"
+
+ # Fetch to get latest remote branches
+ run_command(["git", "fetch", remote_name], check=True)
+
+ # Check remote branches
+ result = run_command(
+ ["git", "branch", "-r"],
+ check=True,
+ capture_output=True,
+ text=True,
+ dry_run_override=False,
+ )
+ remote_branches = result.stdout
+
+ test_branch_exists = f"{remote_name}/{test_branch}" in remote_branches
+ stable_branch_exists = f"{remote_name}/{stable_branch}" in remote_branches
+
+ if not test_branch_exists:
+ console_print(f"[error]Test branch '{remote_name}/{test_branch}' does not exist!")
+ console_print("Available remote branches:")
+ run_command(["git", "branch", "-r"])
+ exit(1)
+ else:
+ console_print(f"[success]Test branch '{remote_name}/{test_branch}' exists")
+
+ if not stable_branch_exists:
+ console_print(f"[error]Stable branch '{remote_name}/{stable_branch}' does not exist!")
+ console_print("Available remote branches:")
+ run_command(["git", "branch", "-r"])
+ exit(1)
+ else:
+ console_print(f"[success]Stable branch '{remote_name}/{stable_branch}' exists")
Review Comment:
```suggestion
console_print(f"[success]Stable branch '{remote_name}/{stable_branch}' exists")
```
nit
##########
dev/breeze/src/airflow_breeze/commands/release_candidate_command.py:
##########
@@ -32,7 +32,179 @@
from airflow_breeze.utils.shared_options import get_dry_run
-def merge_pr(version_branch):
+def validate_remote_tracks_apache_airflow(remote_name):
+ """Validate that the specified remote tracks the apache/airflow repository."""
+ console_print(f"[info]Validating remote '{remote_name}' tracks apache/airflow...")
+
+ result = run_command(
+ ["git", "remote", "get-url", remote_name],
+ check=False,
+ capture_output=True,
+ text=True,
+ dry_run_override=False,
+ )
+
+ if result.returncode != 0:
+ console_print(f"[error]Remote '{remote_name}' does not exist!")
+ console_print("Available remotes:")
+ run_command(["git", "remote", "-v"])
+ exit(1)
+
+ remote_url = result.stdout.strip()
+
+ # Check if it's the apache/airflow repository
+ apache_patterns = [
+ "https://github.com/apache/airflow",
+ "https://github.com/apache/airflow.git",
+ "git@github.com:apache/airflow",
+ "git@github.com:apache/airflow.git",
+ "ssh://git@github.com/apache/airflow",
+ "ssh://git@github.com/apache/airflow.git",
+ ]
+
+ is_apache_repo = any(pattern in remote_url for pattern in apache_patterns)
+
+ if not is_apache_repo:
+ console_print(f"[error]Remote '{remote_name}' does not track apache/airflow!")
+ console_print(f"Remote URL: {remote_url}")
+ console_print("Expected patterns: apache/airflow")
+ if not confirm_action("Do you want to continue anyway? This is NOT recommended for releases."):
+ exit(1)
+ else:
+ console_print(f"[success]Remote '{remote_name}' correctly tracks apache/airflow")
+
+
+def validate_git_status():
+ """Validate that git working directory is clean."""
+ console_print("[info]Validating git status...")
+
+ # Check if working directory is clean
+ result = run_command(
+ ["git", "status", "--porcelain"],
+ check=True,
+ capture_output=True,
+ text=True,
+ )
+
+ if result.stdout.strip():
+ console_print("[error]Working directory is not clean!")
+ run_command(["git", "status"])
+ if not confirm_action("Do you want to continue with uncommitted changes? This is NOT recommended."):
+ exit(1)
+ else:
+ console_print("[success]Working directory is clean")
+
+
+def validate_version_branches_exist(version_branch, remote_name):
+ """Validate that the required version branches exist."""
+ console_print(f"[info]Validating version branches exist for {version_branch}...")
+
+ # Check if test branch exists
+ test_branch = f"v{version_branch}-test"
+ stable_branch = f"v{version_branch}-stable"
+
+ # Fetch to get latest remote branches
+ run_command(["git", "fetch", remote_name], check=True)
+
+ # Check remote branches
+ result = run_command(
+ ["git", "branch", "-r"],
+ check=True,
+ capture_output=True,
+ text=True,
+ dry_run_override=False,
+ )
+ remote_branches = result.stdout
+
+ test_branch_exists = f"{remote_name}/{test_branch}" in remote_branches
+ stable_branch_exists = f"{remote_name}/{stable_branch}" in remote_branches
+
+ if not test_branch_exists:
+ console_print(f"[error]Test branch '{remote_name}/{test_branch}' does not exist!")
+ console_print("Available remote branches:")
+ run_command(["git", "branch", "-r"])
+ exit(1)
+ else:
+ console_print(f"[success]Test branch '{remote_name}/{test_branch}' exists")
+
+ if not stable_branch_exists:
+ console_print(f"[error]Stable branch '{remote_name}/{stable_branch}' does not exist!")
+ console_print("Available remote branches:")
+ run_command(["git", "branch", "-r"])
+ exit(1)
+ else:
+ console_print(f"[success]Stable branch '{remote_name}/{stable_branch}' exists")
+
+
+def validate_tag_does_not_exist(version, remote_name):
+ """Validate that the release tag doesn't already exist."""
+ console_print(f"[info]Checking if tag '{version}' already exists...")
+
+ # Check if tag exists locally
+ local_result = run_command(
+ ["git", "tag", "-l", version],
+ check=True,
+ capture_output=True,
+ text=True,
+ )
+
+ # Check if tag exists on remote using ls-remote with --exit-code
+ remote_result = run_command(
+ ["git", "ls-remote", "--exit-code", "--tags", remote_name, f"refs/tags/{version}"],
+ check=False,
+ capture_output=True,
+ text=True,
+ )
+
+ tag_exists_locally = bool(local_result.stdout.strip())
+ tag_exists_remotely = remote_result.returncode == 0
+
+ if tag_exists_locally or tag_exists_remotely:
+ location = []
+ if tag_exists_locally:
+ location.append("locally")
+ if tag_exists_remotely:
+ location.append("remotely")
+
+ console_print(f"[error]Tag '{version}' already exists {' and '.join(location)}!")
+
+ if tag_exists_locally:
+ console_print(f"Use 'git tag -d {version}' to delete it locally if needed")
+ if tag_exists_remotely:
+ console_print(f"Use 'git push {remote_name} --delete {version}' to delete it remotely if needed")
+
+ if not confirm_action("Do you want to continue anyway? This may cause issues."):
+ exit(1)
+ else:
+ console_print(f"[success]Tag '{version}' does not exist yet")
Review Comment:
```suggestion
if not tag_exists_locally and not tag_exists_remotely:
console_print(f"[success]Tag '{version}' does not exist yet")
return
location = []
if tag_exists_locally:
location.append("locally")
if tag_exists_remotely:
location.append("remotely")
console_print(f"[error]Tag '{version}' already exists {' and '.join(location)}!")
if tag_exists_locally:
console_print(f"Use 'git tag -d {version}' to delete it locally if needed")
if tag_exists_remotely:
console_print(f"Use 'git push {remote_name} --delete {version}' to delete it remotely if needed")
if not confirm_action("Do you want to continue anyway? This may cause issues."):
exit(1)
```
nit, invert it then you can short circuit out early and reduce nesting
##########
dev/breeze/src/airflow_breeze/commands/release_candidate_command.py:
##########
@@ -32,7 +32,179 @@
from airflow_breeze.utils.shared_options import get_dry_run
-def merge_pr(version_branch):
+def validate_remote_tracks_apache_airflow(remote_name):
+ """Validate that the specified remote tracks the apache/airflow repository."""
+ console_print(f"[info]Validating remote '{remote_name}' tracks apache/airflow...")
+
+ result = run_command(
+ ["git", "remote", "get-url", remote_name],
+ check=False,
+ capture_output=True,
+ text=True,
+ dry_run_override=False,
+ )
+
+ if result.returncode != 0:
+ console_print(f"[error]Remote '{remote_name}' does not exist!")
+ console_print("Available remotes:")
+ run_command(["git", "remote", "-v"])
+ exit(1)
+
+ remote_url = result.stdout.strip()
+
+ # Check if it's the apache/airflow repository
+ apache_patterns = [
+ "https://github.com/apache/airflow",
+ "https://github.com/apache/airflow.git",
+ "git@github.com:apache/airflow",
+ "git@github.com:apache/airflow.git",
+ "ssh://git@github.com/apache/airflow",
+ "ssh://git@github.com/apache/airflow.git",
+ ]
+
+ is_apache_repo = any(pattern in remote_url for pattern in apache_patterns)
+
+ if not is_apache_repo:
+ console_print(f"[error]Remote '{remote_name}' does not track apache/airflow!")
+ console_print(f"Remote URL: {remote_url}")
+ console_print("Expected patterns: apache/airflow")
+ if not confirm_action("Do you want to continue anyway? This is NOT recommended for releases."):
+ exit(1)
+ else:
+ console_print(f"[success]Remote '{remote_name}' correctly tracks apache/airflow")
+
+
+def validate_git_status():
+ """Validate that git working directory is clean."""
+ console_print("[info]Validating git status...")
+
+ # Check if working directory is clean
+ result = run_command(
+ ["git", "status", "--porcelain"],
+ check=True,
+ capture_output=True,
+ text=True,
+ )
+
+ if result.stdout.strip():
+ console_print("[error]Working directory is not clean!")
+ run_command(["git", "status"])
+ if not confirm_action("Do you want to continue with uncommitted changes? This is NOT recommended."):
+ exit(1)
+ else:
+ console_print("[success]Working directory is clean")
+
+
+def validate_version_branches_exist(version_branch, remote_name):
+ """Validate that the required version branches exist."""
+ console_print(f"[info]Validating version branches exist for {version_branch}...")
+
+ # Check if test branch exists
+ test_branch = f"v{version_branch}-test"
+ stable_branch = f"v{version_branch}-stable"
+
+ # Fetch to get latest remote branches
+ run_command(["git", "fetch", remote_name], check=True)
+
+ # Check remote branches
+ result = run_command(
+ ["git", "branch", "-r"],
+ check=True,
+ capture_output=True,
+ text=True,
+ dry_run_override=False,
+ )
+ remote_branches = result.stdout
+
+ test_branch_exists = f"{remote_name}/{test_branch}" in remote_branches
+ stable_branch_exists = f"{remote_name}/{stable_branch}" in remote_branches
+
+ if not test_branch_exists:
+ console_print(f"[error]Test branch '{remote_name}/{test_branch}' does not exist!")
+ console_print("Available remote branches:")
+ run_command(["git", "branch", "-r"])
+ exit(1)
+ else:
+ console_print(f"[success]Test branch '{remote_name}/{test_branch}' exists")
+
+ if not stable_branch_exists:
+ console_print(f"[error]Stable branch '{remote_name}/{stable_branch}' does not exist!")
+ console_print("Available remote branches:")
+ run_command(["git", "branch", "-r"])
+ exit(1)
+ else:
+ console_print(f"[success]Stable branch '{remote_name}/{stable_branch}' exists")
+
+
+def validate_tag_does_not_exist(version, remote_name):
+ """Validate that the release tag doesn't already exist."""
+ console_print(f"[info]Checking if tag '{version}' already exists...")
+
+ # Check if tag exists locally
+ local_result = run_command(
+ ["git", "tag", "-l", version],
+ check=True,
+ capture_output=True,
+ text=True,
+ )
+
+ # Check if tag exists on remote using ls-remote with --exit-code
+ remote_result = run_command(
+ ["git", "ls-remote", "--exit-code", "--tags", remote_name, f"refs/tags/{version}"],
+ check=False,
+ capture_output=True,
+ text=True,
+ )
+
+ tag_exists_locally = bool(local_result.stdout.strip())
+ tag_exists_remotely = remote_result.returncode == 0
+
+ if tag_exists_locally or tag_exists_remotely:
+ location = []
+ if tag_exists_locally:
+ location.append("locally")
+ if tag_exists_remotely:
+ location.append("remotely")
+
+ console_print(f"[error]Tag '{version}' already exists {' and '.join(location)}!")
+
+ if tag_exists_locally:
+ console_print(f"Use 'git tag -d {version}' to delete it locally if needed")
+ if tag_exists_remotely:
+ console_print(f"Use 'git push {remote_name} --delete {version}' to delete it remotely if needed")
+
+ if not confirm_action("Do you want to continue anyway? This may cause issues."):
+ exit(1)
+ else:
+ console_print(f"[success]Tag '{version}' does not exist yet")
+
+
+def validate_on_correct_branch_for_tagging(version_branch):
+ """Validate that we're on the correct branch for tagging (stable branch)."""
+ console_print("[info]Validating we're on the correct branch for tagging...")
+
+ expected_branch = f"v{version_branch}-stable"
+
+ # Check current branch
+ result = run_command(
+ ["git", "branch", "--show-current"],
+ check=True,
+ capture_output=True,
+ text=True,
+ dry_run_override=False,
+ )
+ current_branch = result.stdout.strip()
+
+ if current_branch != expected_branch:
+ console_print(f"[error]Currently on branch '{current_branch}', expected '{expected_branch}'!")
+ console_print("Tags should be created on the stable branch after merging the sync PR.")
+ console_print("Make sure the PR merge step completed successfully.")
+ exit(1)
+ else:
+ console_print(f"[success]On correct branch '{expected_branch}' for tagging")
Review Comment:
```suggestion
console_print(f"[success]On correct branch '{expected_branch}' for tagging")
```
--
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: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Dev: Add Task SDK support to `start-rc-process` [airflow]
Posted by "jedcunningham (via GitHub)" <gi...@apache.org>.
jedcunningham commented on code in PR #54960:
URL: https://github.com/apache/airflow/pull/54960#discussion_r2302239232
##########
dev/breeze/src/airflow_breeze/commands/release_candidate_command.py:
##########
@@ -32,7 +32,179 @@
from airflow_breeze.utils.shared_options import get_dry_run
-def merge_pr(version_branch):
+def validate_remote_tracks_apache_airflow(remote_name):
+ """Validate that the specified remote tracks the apache/airflow repository."""
+ console_print(f"[info]Validating remote '{remote_name}' tracks apache/airflow...")
+
+ result = run_command(
+ ["git", "remote", "get-url", remote_name],
+ check=False,
+ capture_output=True,
+ text=True,
+ dry_run_override=False,
+ )
+
+ if result.returncode != 0:
+ console_print(f"[error]Remote '{remote_name}' does not exist!")
+ console_print("Available remotes:")
+ run_command(["git", "remote", "-v"])
+ exit(1)
+
+ remote_url = result.stdout.strip()
+
+ # Check if it's the apache/airflow repository
+ apache_patterns = [
+ "https://github.com/apache/airflow",
+ "https://github.com/apache/airflow.git",
+ "git@github.com:apache/airflow",
+ "git@github.com:apache/airflow.git",
+ "ssh://git@github.com/apache/airflow",
+ "ssh://git@github.com/apache/airflow.git",
+ ]
+
+ is_apache_repo = any(pattern in remote_url for pattern in apache_patterns)
+
+ if not is_apache_repo:
+ console_print(f"[error]Remote '{remote_name}' does not track apache/airflow!")
+ console_print(f"Remote URL: {remote_url}")
+ console_print("Expected patterns: apache/airflow")
+ if not confirm_action("Do you want to continue anyway? This is NOT recommended for releases."):
+ exit(1)
+ else:
+ console_print(f"[success]Remote '{remote_name}' correctly tracks apache/airflow")
+
+
+def validate_git_status():
+ """Validate that git working directory is clean."""
+ console_print("[info]Validating git status...")
+
+ # Check if working directory is clean
+ result = run_command(
+ ["git", "status", "--porcelain"],
+ check=True,
+ capture_output=True,
+ text=True,
+ )
+
+ if result.stdout.strip():
+ console_print("[error]Working directory is not clean!")
+ run_command(["git", "status"])
+ if not confirm_action("Do you want to continue with uncommitted changes? This is NOT recommended."):
+ exit(1)
+ else:
+ console_print("[success]Working directory is clean")
+
+
+def validate_version_branches_exist(version_branch, remote_name):
+ """Validate that the required version branches exist."""
+ console_print(f"[info]Validating version branches exist for {version_branch}...")
+
+ # Check if test branch exists
+ test_branch = f"v{version_branch}-test"
+ stable_branch = f"v{version_branch}-stable"
+
+ # Fetch to get latest remote branches
+ run_command(["git", "fetch", remote_name], check=True)
+
+ # Check remote branches
+ result = run_command(
+ ["git", "branch", "-r"],
+ check=True,
+ capture_output=True,
+ text=True,
+ dry_run_override=False,
+ )
+ remote_branches = result.stdout
+
+ test_branch_exists = f"{remote_name}/{test_branch}" in remote_branches
+ stable_branch_exists = f"{remote_name}/{stable_branch}" in remote_branches
+
+ if not test_branch_exists:
+ console_print(f"[error]Test branch '{remote_name}/{test_branch}' does not exist!")
+ console_print("Available remote branches:")
+ run_command(["git", "branch", "-r"])
+ exit(1)
+ else:
+ console_print(f"[success]Test branch '{remote_name}/{test_branch}' exists")
+
+ if not stable_branch_exists:
+ console_print(f"[error]Stable branch '{remote_name}/{stable_branch}' does not exist!")
+ console_print("Available remote branches:")
+ run_command(["git", "branch", "-r"])
+ exit(1)
+ else:
+ console_print(f"[success]Stable branch '{remote_name}/{stable_branch}' exists")
+
+
+def validate_tag_does_not_exist(version, remote_name):
+ """Validate that the release tag doesn't already exist."""
+ console_print(f"[info]Checking if tag '{version}' already exists...")
+
+ # Check if tag exists locally
+ local_result = run_command(
+ ["git", "tag", "-l", version],
+ check=True,
+ capture_output=True,
+ text=True,
+ )
+
+ # Check if tag exists on remote using ls-remote with --exit-code
+ remote_result = run_command(
+ ["git", "ls-remote", "--exit-code", "--tags", remote_name, f"refs/tags/{version}"],
+ check=False,
+ capture_output=True,
+ text=True,
+ )
+
+ tag_exists_locally = bool(local_result.stdout.strip())
+ tag_exists_remotely = remote_result.returncode == 0
+
+ if tag_exists_locally or tag_exists_remotely:
+ location = []
+ if tag_exists_locally:
+ location.append("locally")
+ if tag_exists_remotely:
+ location.append("remotely")
+
+ console_print(f"[error]Tag '{version}' already exists {' and '.join(location)}!")
+
+ if tag_exists_locally:
+ console_print(f"Use 'git tag -d {version}' to delete it locally if needed")
+ if tag_exists_remotely:
+ console_print(f"Use 'git push {remote_name} --delete {version}' to delete it remotely if needed")
+
+ if not confirm_action("Do you want to continue anyway? This may cause issues."):
+ exit(1)
+ else:
+ console_print(f"[success]Tag '{version}' does not exist yet")
+
+
+def validate_on_correct_branch_for_tagging(version_branch):
+ """Validate that we're on the correct branch for tagging (stable branch)."""
+ console_print("[info]Validating we're on the correct branch for tagging...")
+
+ expected_branch = f"v{version_branch}-stable"
+
+ # Check current branch
+ result = run_command(
+ ["git", "branch", "--show-current"],
+ check=True,
+ capture_output=True,
+ text=True,
+ dry_run_override=False,
+ )
+ current_branch = result.stdout.strip()
+
+ if current_branch != expected_branch:
+ console_print(f"[error]Currently on branch '{current_branch}', expected '{expected_branch}'!")
+ console_print("Tags should be created on the stable branch after merging the sync PR.")
+ console_print("Make sure the PR merge step completed successfully.")
+ exit(1)
+ else:
+ console_print(f"[success]On correct branch '{expected_branch}' for tagging")
Review Comment:
```suggestion
console_print(f"[success]On correct branch '{expected_branch}' for tagging")
```
nit
--
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: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Dev: Add Task SDK support to `start-rc-process` [airflow]
Posted by "kaxil (via GitHub)" <gi...@apache.org>.
kaxil commented on code in PR #54960:
URL: https://github.com/apache/airflow/pull/54960#discussion_r2302286195
##########
dev/breeze/src/airflow_breeze/commands/release_candidate_command.py:
##########
@@ -32,7 +32,179 @@
from airflow_breeze.utils.shared_options import get_dry_run
-def merge_pr(version_branch):
+def validate_remote_tracks_apache_airflow(remote_name):
+ """Validate that the specified remote tracks the apache/airflow repository."""
+ console_print(f"[info]Validating remote '{remote_name}' tracks apache/airflow...")
+
+ result = run_command(
+ ["git", "remote", "get-url", remote_name],
+ check=False,
+ capture_output=True,
+ text=True,
+ dry_run_override=False,
+ )
+
+ if result.returncode != 0:
+ console_print(f"[error]Remote '{remote_name}' does not exist!")
+ console_print("Available remotes:")
+ run_command(["git", "remote", "-v"])
+ exit(1)
+
+ remote_url = result.stdout.strip()
+
+ # Check if it's the apache/airflow repository
+ apache_patterns = [
+ "https://github.com/apache/airflow",
+ "https://github.com/apache/airflow.git",
+ "git@github.com:apache/airflow",
+ "git@github.com:apache/airflow.git",
+ "ssh://git@github.com/apache/airflow",
+ "ssh://git@github.com/apache/airflow.git",
+ ]
+
+ is_apache_repo = any(pattern in remote_url for pattern in apache_patterns)
+
+ if not is_apache_repo:
+ console_print(f"[error]Remote '{remote_name}' does not track apache/airflow!")
+ console_print(f"Remote URL: {remote_url}")
+ console_print("Expected patterns: apache/airflow")
+ if not confirm_action("Do you want to continue anyway? This is NOT recommended for releases."):
+ exit(1)
+ else:
+ console_print(f"[success]Remote '{remote_name}' correctly tracks apache/airflow")
+
+
+def validate_git_status():
+ """Validate that git working directory is clean."""
+ console_print("[info]Validating git status...")
+
+ # Check if working directory is clean
+ result = run_command(
+ ["git", "status", "--porcelain"],
+ check=True,
+ capture_output=True,
+ text=True,
+ )
+
+ if result.stdout.strip():
+ console_print("[error]Working directory is not clean!")
+ run_command(["git", "status"])
+ if not confirm_action("Do you want to continue with uncommitted changes? This is NOT recommended."):
+ exit(1)
+ else:
+ console_print("[success]Working directory is clean")
+
+
+def validate_version_branches_exist(version_branch, remote_name):
+ """Validate that the required version branches exist."""
+ console_print(f"[info]Validating version branches exist for {version_branch}...")
+
+ # Check if test branch exists
+ test_branch = f"v{version_branch}-test"
+ stable_branch = f"v{version_branch}-stable"
+
+ # Fetch to get latest remote branches
+ run_command(["git", "fetch", remote_name], check=True)
+
+ # Check remote branches
+ result = run_command(
+ ["git", "branch", "-r"],
+ check=True,
+ capture_output=True,
+ text=True,
+ dry_run_override=False,
+ )
+ remote_branches = result.stdout
+
+ test_branch_exists = f"{remote_name}/{test_branch}" in remote_branches
+ stable_branch_exists = f"{remote_name}/{stable_branch}" in remote_branches
+
+ if not test_branch_exists:
+ console_print(f"[error]Test branch '{remote_name}/{test_branch}' does not exist!")
+ console_print("Available remote branches:")
+ run_command(["git", "branch", "-r"])
+ exit(1)
+ else:
+ console_print(f"[success]Test branch '{remote_name}/{test_branch}' exists")
+
+ if not stable_branch_exists:
+ console_print(f"[error]Stable branch '{remote_name}/{stable_branch}' does not exist!")
+ console_print("Available remote branches:")
+ run_command(["git", "branch", "-r"])
+ exit(1)
+ else:
+ console_print(f"[success]Stable branch '{remote_name}/{stable_branch}' exists")
+
+
+def validate_tag_does_not_exist(version, remote_name):
+ """Validate that the release tag doesn't already exist."""
+ console_print(f"[info]Checking if tag '{version}' already exists...")
+
+ # Check if tag exists locally
+ local_result = run_command(
+ ["git", "tag", "-l", version],
+ check=True,
+ capture_output=True,
+ text=True,
+ )
+
+ # Check if tag exists on remote using ls-remote with --exit-code
+ remote_result = run_command(
+ ["git", "ls-remote", "--exit-code", "--tags", remote_name, f"refs/tags/{version}"],
+ check=False,
+ capture_output=True,
+ text=True,
+ )
+
+ tag_exists_locally = bool(local_result.stdout.strip())
+ tag_exists_remotely = remote_result.returncode == 0
+
+ if tag_exists_locally or tag_exists_remotely:
+ location = []
+ if tag_exists_locally:
+ location.append("locally")
+ if tag_exists_remotely:
+ location.append("remotely")
+
+ console_print(f"[error]Tag '{version}' already exists {' and '.join(location)}!")
+
+ if tag_exists_locally:
+ console_print(f"Use 'git tag -d {version}' to delete it locally if needed")
+ if tag_exists_remotely:
+ console_print(f"Use 'git push {remote_name} --delete {version}' to delete it remotely if needed")
+
+ if not confirm_action("Do you want to continue anyway? This may cause issues."):
+ exit(1)
+ else:
+ console_print(f"[success]Tag '{version}' does not exist yet")
+
+
+def validate_on_correct_branch_for_tagging(version_branch):
+ """Validate that we're on the correct branch for tagging (stable branch)."""
+ console_print("[info]Validating we're on the correct branch for tagging...")
+
+ expected_branch = f"v{version_branch}-stable"
+
+ # Check current branch
+ result = run_command(
+ ["git", "branch", "--show-current"],
+ check=True,
+ capture_output=True,
+ text=True,
+ dry_run_override=False,
+ )
+ current_branch = result.stdout.strip()
+
+ if current_branch != expected_branch:
+ console_print(f"[error]Currently on branch '{current_branch}', expected '{expected_branch}'!")
+ console_print("Tags should be created on the stable branch after merging the sync PR.")
+ console_print("Make sure the PR merge step completed successfully.")
+ exit(1)
+ else:
+ console_print(f"[success]On correct branch '{expected_branch}' for tagging")
Review Comment:
Fixed in https://github.com/apache/airflow/pull/54960/commits/769435bffc94d9b857c3c3b008dade6a43b01f1e
##########
dev/breeze/src/airflow_breeze/commands/release_candidate_command.py:
##########
@@ -32,7 +32,179 @@
from airflow_breeze.utils.shared_options import get_dry_run
-def merge_pr(version_branch):
+def validate_remote_tracks_apache_airflow(remote_name):
+ """Validate that the specified remote tracks the apache/airflow repository."""
+ console_print(f"[info]Validating remote '{remote_name}' tracks apache/airflow...")
+
+ result = run_command(
+ ["git", "remote", "get-url", remote_name],
+ check=False,
+ capture_output=True,
+ text=True,
+ dry_run_override=False,
+ )
+
+ if result.returncode != 0:
+ console_print(f"[error]Remote '{remote_name}' does not exist!")
+ console_print("Available remotes:")
+ run_command(["git", "remote", "-v"])
+ exit(1)
+
+ remote_url = result.stdout.strip()
+
+ # Check if it's the apache/airflow repository
+ apache_patterns = [
+ "https://github.com/apache/airflow",
+ "https://github.com/apache/airflow.git",
+ "git@github.com:apache/airflow",
+ "git@github.com:apache/airflow.git",
+ "ssh://git@github.com/apache/airflow",
+ "ssh://git@github.com/apache/airflow.git",
+ ]
+
+ is_apache_repo = any(pattern in remote_url for pattern in apache_patterns)
+
+ if not is_apache_repo:
+ console_print(f"[error]Remote '{remote_name}' does not track apache/airflow!")
+ console_print(f"Remote URL: {remote_url}")
+ console_print("Expected patterns: apache/airflow")
+ if not confirm_action("Do you want to continue anyway? This is NOT recommended for releases."):
+ exit(1)
+ else:
+ console_print(f"[success]Remote '{remote_name}' correctly tracks apache/airflow")
+
+
+def validate_git_status():
+ """Validate that git working directory is clean."""
+ console_print("[info]Validating git status...")
+
+ # Check if working directory is clean
+ result = run_command(
+ ["git", "status", "--porcelain"],
+ check=True,
+ capture_output=True,
+ text=True,
+ )
+
+ if result.stdout.strip():
+ console_print("[error]Working directory is not clean!")
+ run_command(["git", "status"])
+ if not confirm_action("Do you want to continue with uncommitted changes? This is NOT recommended."):
+ exit(1)
+ else:
+ console_print("[success]Working directory is clean")
+
+
+def validate_version_branches_exist(version_branch, remote_name):
+ """Validate that the required version branches exist."""
+ console_print(f"[info]Validating version branches exist for {version_branch}...")
+
+ # Check if test branch exists
+ test_branch = f"v{version_branch}-test"
+ stable_branch = f"v{version_branch}-stable"
+
+ # Fetch to get latest remote branches
+ run_command(["git", "fetch", remote_name], check=True)
+
+ # Check remote branches
+ result = run_command(
+ ["git", "branch", "-r"],
+ check=True,
+ capture_output=True,
+ text=True,
+ dry_run_override=False,
+ )
+ remote_branches = result.stdout
+
+ test_branch_exists = f"{remote_name}/{test_branch}" in remote_branches
+ stable_branch_exists = f"{remote_name}/{stable_branch}" in remote_branches
+
+ if not test_branch_exists:
+ console_print(f"[error]Test branch '{remote_name}/{test_branch}' does not exist!")
+ console_print("Available remote branches:")
+ run_command(["git", "branch", "-r"])
+ exit(1)
+ else:
+ console_print(f"[success]Test branch '{remote_name}/{test_branch}' exists")
+
+ if not stable_branch_exists:
+ console_print(f"[error]Stable branch '{remote_name}/{stable_branch}' does not exist!")
+ console_print("Available remote branches:")
+ run_command(["git", "branch", "-r"])
+ exit(1)
+ else:
+ console_print(f"[success]Stable branch '{remote_name}/{stable_branch}' exists")
+
+
+def validate_tag_does_not_exist(version, remote_name):
+ """Validate that the release tag doesn't already exist."""
+ console_print(f"[info]Checking if tag '{version}' already exists...")
+
+ # Check if tag exists locally
+ local_result = run_command(
+ ["git", "tag", "-l", version],
+ check=True,
+ capture_output=True,
+ text=True,
+ )
+
+ # Check if tag exists on remote using ls-remote with --exit-code
+ remote_result = run_command(
+ ["git", "ls-remote", "--exit-code", "--tags", remote_name, f"refs/tags/{version}"],
+ check=False,
+ capture_output=True,
+ text=True,
+ )
+
+ tag_exists_locally = bool(local_result.stdout.strip())
+ tag_exists_remotely = remote_result.returncode == 0
+
+ if tag_exists_locally or tag_exists_remotely:
+ location = []
+ if tag_exists_locally:
+ location.append("locally")
+ if tag_exists_remotely:
+ location.append("remotely")
+
+ console_print(f"[error]Tag '{version}' already exists {' and '.join(location)}!")
+
+ if tag_exists_locally:
+ console_print(f"Use 'git tag -d {version}' to delete it locally if needed")
+ if tag_exists_remotely:
+ console_print(f"Use 'git push {remote_name} --delete {version}' to delete it remotely if needed")
+
+ if not confirm_action("Do you want to continue anyway? This may cause issues."):
+ exit(1)
+ else:
+ console_print(f"[success]Tag '{version}' does not exist yet")
Review Comment:
Fixed in https://github.com/apache/airflow/pull/54960/commits/769435bffc94d9b857c3c3b008dade6a43b01f1e
--
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: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Dev: Add Task SDK support to `start-rc-process` [airflow]
Posted by "kaxil (via GitHub)" <gi...@apache.org>.
kaxil commented on code in PR #54960:
URL: https://github.com/apache/airflow/pull/54960#discussion_r2302286566
##########
dev/breeze/src/airflow_breeze/commands/release_candidate_command.py:
##########
@@ -32,7 +32,179 @@
from airflow_breeze.utils.shared_options import get_dry_run
-def merge_pr(version_branch):
+def validate_remote_tracks_apache_airflow(remote_name):
+ """Validate that the specified remote tracks the apache/airflow repository."""
+ console_print(f"[info]Validating remote '{remote_name}' tracks apache/airflow...")
+
+ result = run_command(
+ ["git", "remote", "get-url", remote_name],
+ check=False,
+ capture_output=True,
+ text=True,
+ dry_run_override=False,
+ )
+
+ if result.returncode != 0:
+ console_print(f"[error]Remote '{remote_name}' does not exist!")
+ console_print("Available remotes:")
+ run_command(["git", "remote", "-v"])
+ exit(1)
+
+ remote_url = result.stdout.strip()
+
+ # Check if it's the apache/airflow repository
+ apache_patterns = [
+ "https://github.com/apache/airflow",
+ "https://github.com/apache/airflow.git",
+ "git@github.com:apache/airflow",
+ "git@github.com:apache/airflow.git",
+ "ssh://git@github.com/apache/airflow",
+ "ssh://git@github.com/apache/airflow.git",
+ ]
+
+ is_apache_repo = any(pattern in remote_url for pattern in apache_patterns)
+
+ if not is_apache_repo:
+ console_print(f"[error]Remote '{remote_name}' does not track apache/airflow!")
+ console_print(f"Remote URL: {remote_url}")
+ console_print("Expected patterns: apache/airflow")
+ if not confirm_action("Do you want to continue anyway? This is NOT recommended for releases."):
+ exit(1)
+ else:
+ console_print(f"[success]Remote '{remote_name}' correctly tracks apache/airflow")
+
+
+def validate_git_status():
+ """Validate that git working directory is clean."""
+ console_print("[info]Validating git status...")
+
+ # Check if working directory is clean
+ result = run_command(
+ ["git", "status", "--porcelain"],
+ check=True,
+ capture_output=True,
+ text=True,
+ )
+
+ if result.stdout.strip():
+ console_print("[error]Working directory is not clean!")
+ run_command(["git", "status"])
+ if not confirm_action("Do you want to continue with uncommitted changes? This is NOT recommended."):
+ exit(1)
+ else:
+ console_print("[success]Working directory is clean")
+
+
+def validate_version_branches_exist(version_branch, remote_name):
+ """Validate that the required version branches exist."""
+ console_print(f"[info]Validating version branches exist for {version_branch}...")
+
+ # Check if test branch exists
+ test_branch = f"v{version_branch}-test"
+ stable_branch = f"v{version_branch}-stable"
+
+ # Fetch to get latest remote branches
+ run_command(["git", "fetch", remote_name], check=True)
+
+ # Check remote branches
+ result = run_command(
+ ["git", "branch", "-r"],
+ check=True,
+ capture_output=True,
+ text=True,
+ dry_run_override=False,
+ )
+ remote_branches = result.stdout
+
+ test_branch_exists = f"{remote_name}/{test_branch}" in remote_branches
+ stable_branch_exists = f"{remote_name}/{stable_branch}" in remote_branches
+
+ if not test_branch_exists:
+ console_print(f"[error]Test branch '{remote_name}/{test_branch}' does not exist!")
+ console_print("Available remote branches:")
+ run_command(["git", "branch", "-r"])
+ exit(1)
+ else:
+ console_print(f"[success]Test branch '{remote_name}/{test_branch}' exists")
+
+ if not stable_branch_exists:
+ console_print(f"[error]Stable branch '{remote_name}/{stable_branch}' does not exist!")
+ console_print("Available remote branches:")
+ run_command(["git", "branch", "-r"])
+ exit(1)
+ else:
+ console_print(f"[success]Stable branch '{remote_name}/{stable_branch}' exists")
+
+
+def validate_tag_does_not_exist(version, remote_name):
+ """Validate that the release tag doesn't already exist."""
+ console_print(f"[info]Checking if tag '{version}' already exists...")
+
+ # Check if tag exists locally
+ local_result = run_command(
+ ["git", "tag", "-l", version],
+ check=True,
+ capture_output=True,
+ text=True,
+ )
+
+ # Check if tag exists on remote using ls-remote with --exit-code
+ remote_result = run_command(
+ ["git", "ls-remote", "--exit-code", "--tags", remote_name, f"refs/tags/{version}"],
+ check=False,
+ capture_output=True,
Review Comment:
Fixed in https://github.com/apache/airflow/pull/54960/commits/769435bffc94d9b857c3c3b008dade6a43b01f1e
##########
dev/breeze/src/airflow_breeze/commands/release_candidate_command.py:
##########
@@ -32,7 +32,179 @@
from airflow_breeze.utils.shared_options import get_dry_run
-def merge_pr(version_branch):
+def validate_remote_tracks_apache_airflow(remote_name):
+ """Validate that the specified remote tracks the apache/airflow repository."""
+ console_print(f"[info]Validating remote '{remote_name}' tracks apache/airflow...")
+
+ result = run_command(
+ ["git", "remote", "get-url", remote_name],
+ check=False,
+ capture_output=True,
+ text=True,
+ dry_run_override=False,
+ )
+
+ if result.returncode != 0:
+ console_print(f"[error]Remote '{remote_name}' does not exist!")
+ console_print("Available remotes:")
+ run_command(["git", "remote", "-v"])
+ exit(1)
+
+ remote_url = result.stdout.strip()
+
+ # Check if it's the apache/airflow repository
+ apache_patterns = [
+ "https://github.com/apache/airflow",
+ "https://github.com/apache/airflow.git",
+ "git@github.com:apache/airflow",
+ "git@github.com:apache/airflow.git",
+ "ssh://git@github.com/apache/airflow",
+ "ssh://git@github.com/apache/airflow.git",
+ ]
+
+ is_apache_repo = any(pattern in remote_url for pattern in apache_patterns)
+
+ if not is_apache_repo:
+ console_print(f"[error]Remote '{remote_name}' does not track apache/airflow!")
+ console_print(f"Remote URL: {remote_url}")
+ console_print("Expected patterns: apache/airflow")
+ if not confirm_action("Do you want to continue anyway? This is NOT recommended for releases."):
+ exit(1)
+ else:
+ console_print(f"[success]Remote '{remote_name}' correctly tracks apache/airflow")
+
+
+def validate_git_status():
+ """Validate that git working directory is clean."""
+ console_print("[info]Validating git status...")
+
+ # Check if working directory is clean
+ result = run_command(
+ ["git", "status", "--porcelain"],
+ check=True,
+ capture_output=True,
+ text=True,
+ )
+
+ if result.stdout.strip():
+ console_print("[error]Working directory is not clean!")
+ run_command(["git", "status"])
+ if not confirm_action("Do you want to continue with uncommitted changes? This is NOT recommended."):
+ exit(1)
+ else:
+ console_print("[success]Working directory is clean")
+
+
+def validate_version_branches_exist(version_branch, remote_name):
+ """Validate that the required version branches exist."""
+ console_print(f"[info]Validating version branches exist for {version_branch}...")
+
+ # Check if test branch exists
+ test_branch = f"v{version_branch}-test"
+ stable_branch = f"v{version_branch}-stable"
+
+ # Fetch to get latest remote branches
+ run_command(["git", "fetch", remote_name], check=True)
+
+ # Check remote branches
+ result = run_command(
+ ["git", "branch", "-r"],
+ check=True,
+ capture_output=True,
+ text=True,
+ dry_run_override=False,
+ )
+ remote_branches = result.stdout
+
+ test_branch_exists = f"{remote_name}/{test_branch}" in remote_branches
+ stable_branch_exists = f"{remote_name}/{stable_branch}" in remote_branches
+
+ if not test_branch_exists:
+ console_print(f"[error]Test branch '{remote_name}/{test_branch}' does not exist!")
+ console_print("Available remote branches:")
+ run_command(["git", "branch", "-r"])
+ exit(1)
+ else:
+ console_print(f"[success]Test branch '{remote_name}/{test_branch}' exists")
+
+ if not stable_branch_exists:
+ console_print(f"[error]Stable branch '{remote_name}/{stable_branch}' does not exist!")
+ console_print("Available remote branches:")
+ run_command(["git", "branch", "-r"])
+ exit(1)
+ else:
+ console_print(f"[success]Stable branch '{remote_name}/{stable_branch}' exists")
Review Comment:
Fixed in https://github.com/apache/airflow/pull/54960/commits/769435bffc94d9b857c3c3b008dade6a43b01f1e
##########
dev/breeze/src/airflow_breeze/commands/release_candidate_command.py:
##########
@@ -32,7 +32,179 @@
from airflow_breeze.utils.shared_options import get_dry_run
-def merge_pr(version_branch):
+def validate_remote_tracks_apache_airflow(remote_name):
+ """Validate that the specified remote tracks the apache/airflow repository."""
+ console_print(f"[info]Validating remote '{remote_name}' tracks apache/airflow...")
+
+ result = run_command(
+ ["git", "remote", "get-url", remote_name],
+ check=False,
+ capture_output=True,
+ text=True,
+ dry_run_override=False,
+ )
+
+ if result.returncode != 0:
+ console_print(f"[error]Remote '{remote_name}' does not exist!")
+ console_print("Available remotes:")
+ run_command(["git", "remote", "-v"])
+ exit(1)
+
+ remote_url = result.stdout.strip()
+
+ # Check if it's the apache/airflow repository
+ apache_patterns = [
+ "https://github.com/apache/airflow",
+ "https://github.com/apache/airflow.git",
+ "git@github.com:apache/airflow",
+ "git@github.com:apache/airflow.git",
+ "ssh://git@github.com/apache/airflow",
+ "ssh://git@github.com/apache/airflow.git",
+ ]
+
+ is_apache_repo = any(pattern in remote_url for pattern in apache_patterns)
+
+ if not is_apache_repo:
+ console_print(f"[error]Remote '{remote_name}' does not track apache/airflow!")
+ console_print(f"Remote URL: {remote_url}")
+ console_print("Expected patterns: apache/airflow")
+ if not confirm_action("Do you want to continue anyway? This is NOT recommended for releases."):
+ exit(1)
+ else:
+ console_print(f"[success]Remote '{remote_name}' correctly tracks apache/airflow")
+
+
+def validate_git_status():
+ """Validate that git working directory is clean."""
+ console_print("[info]Validating git status...")
+
+ # Check if working directory is clean
+ result = run_command(
+ ["git", "status", "--porcelain"],
+ check=True,
+ capture_output=True,
+ text=True,
+ )
+
+ if result.stdout.strip():
+ console_print("[error]Working directory is not clean!")
+ run_command(["git", "status"])
+ if not confirm_action("Do you want to continue with uncommitted changes? This is NOT recommended."):
+ exit(1)
+ else:
+ console_print("[success]Working directory is clean")
+
+
+def validate_version_branches_exist(version_branch, remote_name):
+ """Validate that the required version branches exist."""
+ console_print(f"[info]Validating version branches exist for {version_branch}...")
+
+ # Check if test branch exists
+ test_branch = f"v{version_branch}-test"
+ stable_branch = f"v{version_branch}-stable"
+
+ # Fetch to get latest remote branches
+ run_command(["git", "fetch", remote_name], check=True)
+
+ # Check remote branches
+ result = run_command(
+ ["git", "branch", "-r"],
+ check=True,
+ capture_output=True,
+ text=True,
+ dry_run_override=False,
+ )
+ remote_branches = result.stdout
+
+ test_branch_exists = f"{remote_name}/{test_branch}" in remote_branches
+ stable_branch_exists = f"{remote_name}/{stable_branch}" in remote_branches
+
+ if not test_branch_exists:
+ console_print(f"[error]Test branch '{remote_name}/{test_branch}' does not exist!")
+ console_print("Available remote branches:")
+ run_command(["git", "branch", "-r"])
+ exit(1)
+ else:
+ console_print(f"[success]Test branch '{remote_name}/{test_branch}' exists")
Review Comment:
Fixed in https://github.com/apache/airflow/pull/54960/commits/769435bffc94d9b857c3c3b008dade6a43b01f1e
--
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: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org