Skip to content
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

Merged
merged 17 commits into from Jan 12, 2023

Conversation

lafiona
Copy link
Contributor

@lafiona lafiona commented Oct 27, 2022

Overview

The goal of this pull request is to update the GitHub merge script to work with a repository default branch named master or main, as part of the effort to rename the Apache Arrow repository's default branch to main. The parent Jira ticket can be found here.

Implementation

  • In .github/workflows/dev.yml, get and pass the default branch name to the merge test script.
  • Added a function named git_default_branch_name to dev/merge_arrow_pr.py.
  • Used git_default_branch_name to replace hard-coded usages of master in the file.

Testing

  • Ran the dev/merge_arrow_pr.py in debug mode to confirm that there are no errors when attempting to merge an existing pull request.
  • Ran 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 in test_merge_arrow_pr.py.

Notes

Thank you @kevingurney for your help with this pull request!

@github-actions

This comment was marked as outdated.

@github-actions

This comment was marked as outdated.

@lafiona lafiona marked this pull request as ready for review November 17, 2022 22:20
@assignUser
Copy link
Member

@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!

@assignUser
Copy link
Member

(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 :) )

@lafiona
Copy link
Contributor Author

lafiona commented Dec 6, 2022

@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!

@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!

Copy link
Member

@assignUser assignUser left a 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)

@lafiona
Copy link
Contributor Author

lafiona commented Jan 7, 2023

@assignUser Thank you for your quick review! This is all set from my end.

dev/merge_arrow_pr.py Outdated Show resolved Hide resolved
Copy link
Member

@assignUser assignUser left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 Thanks!

Copy link
Member

@raulcd raulcd left a 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.

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:
Copy link
Member

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.

Copy link
Contributor Author

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.


if default_branch_name is None:
try:
default_reference = run_cmd(
Copy link
Member

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

Copy link
Contributor Author

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.

Copy link
Member

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?

Copy link
Member

@rok rok Jan 11, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Huh, that might be because Jira was locked down today - no changes to issues are possible going forward. But @raulcd still merged #33611 so I'm not sure. Could you try again @lafiona ?

Copy link
Member

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

Copy link
Contributor Author

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!

@github-actions
Copy link

⚠️ GitHub issue #33005 has been automatically assigned in GitHub to PR creator.

@github-actions
Copy link

⚠️ GitHub issue #33005 has been automatically assigned in GitHub to PR creator.

@apache apache deleted a comment from github-actions bot Jan 11, 2023
@apache apache deleted a comment from github-actions bot Jan 11, 2023
lafiona and others added 11 commits January 12, 2023 13:33
…ue to replace hard coded 'master' values.

Co-authored-by: Kevin Gurney <kgurney@mathworks.com>
Co-authored-by: Kevin Gurney <kgurney@mathworks.com>
…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>
Co-authored-by: Antoine Pitrou <pitrou@free.fr>
…and unused input argument in fix_version_from_branch()
Comment on lines 304 to 305
if merge_branches is None:
merge_branches = (git_default_branch_name(),)
Copy link
Member

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.

Copy link
Contributor Author

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!

Copy link
Member

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

Copy link
Member

@raulcd raulcd left a 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.

dev/merge_arrow_pr.py Outdated Show resolved Hide resolved
.github/workflows/dev.yml Outdated Show resolved Hide resolved
lafiona and others added 4 commits January 12, 2023 15:02
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>
@raulcd raulcd merged commit 3d26a43 into apache:master Jan 12, 2023
@ursabot
Copy link

ursabot commented Jan 14, 2023

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.
Conbench compare runs links:
[Finished ⬇️0.0% ⬆️0.0%] ec2-t3-xlarge-us-east-2
[Failed ⬇️0.39% ⬆️0.0%] test-mac-arm
[Finished ⬇️0.0% ⬆️0.0%] ursa-i9-9960x
[Finished ⬇️0.31% ⬆️0.03%] ursa-thinkcentre-m75q
Buildkite builds:
[Finished] 3d26a433 ec2-t3-xlarge-us-east-2
[Finished] 3d26a433 test-mac-arm
[Finished] 3d26a433 ursa-i9-9960x
[Finished] 3d26a433 ursa-thinkcentre-m75q
[Finished] 2e3683b7 ec2-t3-xlarge-us-east-2
[Failed] 2e3683b7 test-mac-arm
[Finished] 2e3683b7 ursa-i9-9960x
[Finished] 2e3683b7 ursa-thinkcentre-m75q
Supported benchmarks:
ec2-t3-xlarge-us-east-2: Supported benchmark langs: Python, R. Runs only benchmarks with cloud = True
test-mac-arm: Supported benchmark langs: C++, Python, R
ursa-i9-9960x: Supported benchmark langs: Python, R, JavaScript
ursa-thinkcentre-m75q: Supported benchmark langs: C++, Java

@kevingurney kevingurney deleted the ARROW-17777 branch August 21, 2023 18:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Dev] Update the pull request merge script to work with master or main
8 participants