Skip to content

Commit

Permalink
[ZEPPELIN-6089][INFRA] Improve the merge PR script
Browse files Browse the repository at this point in the history
### What is this PR for?

Zeppelin has `dev/merge_zeppelin_pr.py` that was borrowed from Spark, I would recommend committers use this script over the GitHub button to merge PR, which has some benefits:

1. Simplify the backport process

the tools will ask you to backport the commit to lower maintained branches after you merge a PR to master, if there are no conflicts, all things you need to do are just type a "branch name" that you want to backport.

2. Automatically update JIRA information

the script uses the python jira client to update JIRA ticket, for example, automatically closes the JIRA ticket after PR is merged, fills in the fixed versions, which is important to users to know the features/bug fixes applied to versions.

3. Better PR title, body, and "Signed-off-by" info

Before
<img width="1080" alt="image" src="https://github.com/user-attachments/assets/3f407592-e95f-4bd2-8ad9-fed25adaac72">

After 
<img width="1080" alt="image" src="https://github.com/user-attachments/assets/43865062-c2f2-4ab9-aa44-9290e68162c9">

This PR syncs the change from the Spark upstream (around 4.0.0-preview2), and has several improvements recently, e.g. support using tokens instead of passwords for GitHub and JIRA authentication. Additionally, this PR switches to the GitHub open API <at>jongyoul suggested to merge the PR, which fixed the merged PR status from "Closed" to "Merged"

### What type of PR is it?

Improvement

### Todos

* [x] - verify this script by merging at least 3 PRs

### What is the Jira issue?

ZEPPELIN-6089

### How should this be tested?

Manually test. Currently not work due to permission issues.
```
$ dev/merge_zeppelin_pr.py 
git rev-parse --abbrev-ref HEAD
Which pull request would you like to merge? (e.g. 34): 4837

=== Pull Request apache#4837 ===
title   [MINOR] Remove duplicate entry in .gitignore
source  MyLanPangzi/patch-2
target  master
url     https://api.github.com/repos/apache/zeppelin/pulls/4837
Proceed with merging pull request apache#4837? (y/N): y
git config --get user.name
git config --get user.email
git fetch apache master
remote: Enumerating objects: 5, done.
remote: Counting objects: 100% (5/5), done.
remote: Compressing objects: 100% (3/3), done.
remote: Total 3 (delta 2), reused 0 (delta 0), pack-reused 0 (from 0)
Unpacking objects: 100% (3/3), 1.53 KiB | 260.00 KiB/s, done.
From github.com:apache/zeppelin
 * branch                master     -> FETCH_HEAD
   ad79848..35e1299  master     -> apache/master
Pull request apache#4837 merged!
Merge hash: 35e1299

Would you like to pick 35e1299 into another branch? (y/N): y
Enter a branch name [branch-0.9]: branch-0.11
git fetch apache branch-0.11:PR_TOOL_PICK_PR_4837_BRANCH-0.11
From github.com:apache/zeppelin
 * [new branch]          branch-0.11 -> PR_TOOL_PICK_PR_4837_BRANCH-0.11
git checkout PR_TOOL_PICK_PR_4837_BRANCH-0.11
Switched to branch 'PR_TOOL_PICK_PR_4837_BRANCH-0.11'
git cherry-pick -sx 35e1299
Pick complete (local ref PR_TOOL_PICK_PR_4837_BRANCH-0.11). Push to apache? (y/N): y
git push apache PR_TOOL_PICK_PR_4837_BRANCH-0.11:branch-0.11
Enumerating objects: 5, done.
Counting objects: 100% (5/5), done.
Delta compression using up to 10 threads
Compressing objects: 100% (3/3), done.
Writing objects: 100% (3/3), 1.60 KiB | 1.60 MiB/s, done.
Total 3 (delta 2), reused 0 (delta 0), pack-reused 0
remote: Resolving deltas: 100% (2/2), completed with 2 local objects.
remote: 
remote: GitHub found 199 vulnerabilities on apache/zeppelin's default branch (19 critical, 70 high, 87 moderate, 23 low). To find out more, visit:
remote:      https://github.com/apache/zeppelin/security/dependabot
remote: 
To github.com:apache/zeppelin.git
   7128f7d..a04da2e  PR_TOOL_PICK_PR_4837_BRANCH-0.11 -> branch-0.11
git rev-parse PR_TOOL_PICK_PR_4837_BRANCH-0.11
Restoring head pointer to ZEPPELIN-6089
git checkout ZEPPELIN-6089
Switched to branch 'ZEPPELIN-6089'
git branch
Deleting local branch PR_TOOL_PICK_PR_4837_BRANCH-0.11
git branch -D PR_TOOL_PICK_PR_4837_BRANCH-0.11
Pull request apache#4837 picked into branch-0.11!
Pick hash: a04da2e

Would you like to pick 35e1299 into another branch? (y/N): n
Would you like to update an associated JIRA? (y/N): n
Okay, exiting
Restoring head pointer to ZEPPELIN-6089
git checkout ZEPPELIN-6089
Already on 'ZEPPELIN-6089'
git branch
Restoring head pointer to ZEPPELIN-6089
git checkout ZEPPELIN-6089
Already on 'ZEPPELIN-6089'
git branch
```

### Screenshots (if appropriate)

### Questions:
* Does the license files need to update? No.
* Is there breaking changes for older versions? No.
* Does this needs documentation? No.


Closes apache#4831 from pan3793/ZEPPELIN-6089.

Signed-off-by: Cheng Pan <[email protected]>
  • Loading branch information
pan3793 authored Sep 21, 2024
1 parent 72a3fd3 commit e20cbbc
Showing 1 changed file with 473 additions and 196 deletions.
Loading

0 comments on commit e20cbbc

Please sign in to comment.