New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
GH-33005: [Dev] Update the pull request merge script to work with master or main #14533
Conversation
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
@lafiona I see that this has been ready for review for a while. Visibility for the status off PRs is not great at the moment (we constantly >250 open in recent times) so feel free to ping potential reviewers directly (e.g. @raulcd, @jorisvandenbossche, me ...) to move things forward! |
(oh and we have recently worked quite a lot on the merge script to enable the use of github issues, so you will need to rebase and fix conflicts :) ) |
@assignUser thank you for the suggestion to directly ping reviewers! I will keep this in mind. For this pull request, I'll rebase, fix conflicts, and comment here again. Thank you! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tests look good, I tested it locally in debug mode and on a fork issue: assignUser#6
@lafiona is this done from your end? I would like to push this forward (after another review on such an important part of our infra)
@assignUser Thank you for your quick review! This is all set from my end. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 Thanks!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the PR @lafiona . I think the code has some left overs from past workflows and we don't really require the default branch check. I think it's better to simplify it now that we are modifying it.
dev/merge_arrow_pr.py
Outdated
def fix_version_from_branch(branch, versions): | ||
# Note: Assumes this is a sorted (newest->oldest) list of un-released | ||
# versions | ||
if branch == "master": | ||
if branch == git_default_branch_name(): | ||
return versions[-1] | ||
else: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this else is never executed because we never call get_candidate_fix_version
with merge_branches
. We always use the default ('master',)
. We could simplify the script to just return versions[-1]
on this function and remove all the logic based on the branch.
The merge script uses the GitHub API and that will already point the PR to the correct default branch.
We don't use branches prefixed branch-
. This code is 7 years old so it is probably a left over from an old workflow.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@raulcd , thanks for this suggestion and confirmation that it's leftover code. I'll remove the conditional here as you suggested.
dev/merge_arrow_pr.py
Outdated
|
||
if default_branch_name is None: | ||
try: | ||
default_reference = run_cmd( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lint:
/arrow/dev/merge_arrow_pr.py:119:13: F841 local variable 'default_reference' is assigned to but never used
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for pointing this out! I have pushed the fix for this issue, however, I am now seeing an error that I did not see before, when running the script in debug mode:
`Traceback` (most recent call last):
File "/Users/fionala/r2023b/arrow/dev/merge_arrow_pr.py", line 747, in <module>
cli()
File "/Users/fionala/r2023b/arrow/dev/merge_arrow_pr.py", line 742, in cli
pr.issue.resolve(fix_version, issue_comment, pr.body)
File "/Users/fionala/r2023b/arrow/dev/merge_arrow_pr.py", line 187, in resolve
resolve = [x for x in self.jira_con.transitions(self.jira_id)
IndexError: list index out of range
I'm working on debugging this to determine if it is related to the most recent changes I made.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think that it's not related.
I think that it's related to Jira -> GitHub migration.
@rok What do you think about this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
a rebase to integrate the changes made to the script today might also be good
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for the insight about Jira being locked down, I was able to run the test without the error, just now. And I have rebased to integrate the most recent changes.
This change is good to go on my end now. Thank you everyone for all your help!
|
|
…ue to replace hard coded 'master' values. Co-authored-by: Kevin Gurney <kgurney@mathworks.com>
Co-authored-by: Kevin Gurney <kgurney@mathworks.com>
…e, pass this value to the merge script.
…ontaining a head reference to get the default branch
Co-authored-by: Kevin Gurney <kgurney@mathworks.com> Co-authored-by: Sreehari Hegden <sreehari.hegden@gmail.com>
…ault branch name via git rev-parse.
Co-authored-by: Antoine Pitrou <pitrou@free.fr>
…and unused input argument in fix_version_from_branch()
dev/merge_arrow_pr.py
Outdated
if merge_branches is None: | ||
merge_branches = (git_default_branch_name(),) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @lafiona for the changes! Only one more thing, now merge_branches
is never used, we can get rid of it and we can also get rid of the new function created to retrieve the git_default_branch_name
because the script is never calling that function once we remove merge_branches
. That makes sense as we use the GitHub API to merge the PR and we use the base branch defined on the PR, not the one on this script.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @raulcd, I apologize that I didn't see this earlier, it's tied to the feedback that you already left yesterday! And I've removed the input argument as well as references to merge_branches
in the function body. Thanks for pointing it out!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you very much! I'll wait for the linter to pass and I'll merge after successful build
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you very much for the changes I think they have been great! One step closer to migrate the default branch! I'll merge this with this two suggestions. I'll use this branch merge script to test it.
Co-authored-by: Raúl Cumplido <raulcumplido@gmail.com>
Co-authored-by: Raúl Cumplido <raulcumplido@gmail.com>
Co-authored-by: Raúl Cumplido <raulcumplido@gmail.com>
Co-authored-by: Raúl Cumplido <raulcumplido@gmail.com>
Benchmark runs are scheduled for baseline = 2e3683b and contender = 3d26a43. 3d26a43 is a master commit associated with this PR. Results will be available as each benchmark for each run completes. |
Overview
The goal of this pull request is to update the GitHub merge script to work with a repository default branch named
master
ormain
, as part of the effort to rename the Apache Arrow repository's default branch tomain
. The parent Jira ticket can be found here.Implementation
.github/workflows/dev.yml
, get and pass the default branch name to the merge test script.git_default_branch_name
todev/merge_arrow_pr.py
.git_default_branch_name
to replace hard-coded usages ofmaster
in the file.Testing
dev/merge_arrow_pr.py
in debug mode to confirm that there are no errors when attempting to merge an existing pull request.test_merge_arrow_pr.py
locally to confirm there are no failures.Future Directions
Updated ARROW-18011 to include updating the hard-coded
master
value intest_merge_arrow_pr.py
.Notes
Thank you @kevingurney for your help with this pull request!