You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@arrow.apache.org by ap...@apache.org on 2024/02/12 15:30:39 UTC
(arrow) branch main updated: GH-39996: [Archery] Fix Crossbow build on a PR from a fork's main branch (#40002)
This is an automated email from the ASF dual-hosted git repository.
apitrou pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/arrow.git
The following commit(s) were added to refs/heads/main by this push:
new 52e560381b GH-39996: [Archery] Fix Crossbow build on a PR from a fork's main branch (#40002)
52e560381b is described below
commit 52e560381b916449b9efec3348c73ac339521641
Author: Antoine Pitrou <an...@python.org>
AuthorDate: Mon Feb 12 16:30:32 2024 +0100
GH-39996: [Archery] Fix Crossbow build on a PR from a fork's main branch (#40002)
Instead of doing an intermediate bare clone, just fix the locally created branch name when fetching.
Amended from PR #39997, which wasn't sufficient (the `git fetch` that works for me doesn't seem to work on GHA).
* Closes: #39996
Authored-by: Antoine Pitrou <an...@python.org>
Signed-off-by: Antoine Pitrou <an...@python.org>
---
.github/workflows/comment_bot.yml | 2 +-
dev/archery/archery/bot.py | 30 +++++++++++++++---------------
2 files changed, 16 insertions(+), 16 deletions(-)
diff --git a/.github/workflows/comment_bot.yml b/.github/workflows/comment_bot.yml
index fc939693c3..dbcbbff549 100644
--- a/.github/workflows/comment_bot.yml
+++ b/.github/workflows/comment_bot.yml
@@ -51,7 +51,7 @@ jobs:
ARROW_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
CROSSBOW_GITHUB_TOKEN: ${{ secrets.CROSSBOW_GITHUB_TOKEN }}
run: |
- archery trigger-bot \
+ archery --debug trigger-bot \
--event-name ${{ github.event_name }} \
--event-payload ${{ github.event_path }}
diff --git a/dev/archery/archery/bot.py b/dev/archery/archery/bot.py
index caab824aeb..2b87b93868 100644
--- a/dev/archery/archery/bot.py
+++ b/dev/archery/archery/bot.py
@@ -324,8 +324,7 @@ def crossbow(obj, crossbow):
obj['crossbow_repo'] = crossbow
-def _clone_arrow_and_crossbow(dest, crossbow_repo, arrow_repo_url,
- pr_number, pr_branch):
+def _clone_arrow_and_crossbow(dest, crossbow_repo, arrow_repo_url, pr_number):
"""
Clone the repositories and initialize crossbow objects.
@@ -335,23 +334,25 @@ def _clone_arrow_and_crossbow(dest, crossbow_repo, arrow_repo_url,
Filesystem path to clone the repositories to.
crossbow_repo : str
GitHub repository name, like kszucs/crossbow.
- pull_request : pygithub.PullRequest
- Object containing information about the pull request the comment bot
- was triggered from.
+ arrow_repo_url : str
+ Target Apache Arrow repository's clone URL, such as
+ "https://github.com/apache/arrow.git".
+ pr_number : int
+ Target PR number.
"""
- bare_arrow_path = dest / 'arrow_bare'
arrow_path = dest / 'arrow'
queue_path = dest / 'crossbow'
+ # we use unique branch name instead of fork's branch name to avoid
+ # branch name conflict such as 'main' (GH-39996)
+ local_branch = f'archery/pr-{pr_number}'
# 1. clone arrow and checkout the PR's branch
- pr_ref = f'pull/{pr_number}/head:{pr_branch}'
- # we do a bare clone of upstream arrow to avoid issues when the PR is
- # submitted from a fork's main branch (GH-39996)
- git.clone('--bare', arrow_repo_url, str(bare_arrow_path))
- # fetch the PR's branch into the bare clone
- git.fetch('origin', pr_ref, git_dir=bare_arrow_path)
- # clone and checkout the PR's branch into a full local repo
- git.clone(f'--branch={pr_branch}', bare_arrow_path, arrow_path)
+ pr_ref = f'pull/{pr_number}/head:{local_branch}'
+ git.clone('--no-checkout', arrow_repo_url, str(arrow_path))
+ # fetch the PR's branch into the clone
+ git.fetch('origin', pr_ref, git_dir=arrow_path)
+ # checkout the PR's branch into the clone
+ git.checkout(local_branch, git_dir=arrow_path)
# 2. clone crossbow repository
crossbow_url = 'https://github.com/{}'.format(crossbow_repo)
@@ -391,7 +392,6 @@ def submit(obj, tasks, groups, params, arrow_version, wait):
crossbow_repo=crossbow_repo,
arrow_repo_url=pull_request.base.repo.clone_url,
pr_number=pull_request.number,
- pr_branch=pull_request.head.ref,
)
# load available tasks configuration and groups from yaml
config = Config.load_yaml(arrow.path / "dev" / "tasks" / "tasks.yml")