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

ci: Create backport pr based on milestone. #1876

Merged
merged 30 commits into from
May 6, 2024
Merged

ci: Create backport pr based on milestone. #1876

merged 30 commits into from
May 6, 2024

Conversation

Yaminyam
Copy link
Member

@Yaminyam Yaminyam commented Feb 1, 2024

This repository manages a few release branches where latest bug fixes and minor improvements are backported and released as a series of prior versions.
(e.g., The main branch targets 24.09, while fixes are backported to 24.03 and 23.09 and shipped as their patch releases.)

So far, we have created the backport commits by manually git cherry-pick, adding several git trailers like Backported-from: main (24.09), Backported-to: 24.03.

In this PR, we are going to let GitHub Actions auto-generate the backport PRs. The target branches are calculated from the original PR's milestone property. Compared to individual cherry-picked commits, it has the following advantages:

  • As being a PR, we can make all required CI checks to be properly applied before pushing to the target release branch.
  • The backport PR could explicitly show what's broken in terms of both the code-level merge conflicts.
  • We could automate the merge if there is no code conflicts and all CI succeeds ("Enable auto-merge").
  • We could have an extra chance to review and update the backported change if it cannot be auto-merged.
  • When there are multiple target branches to backport, we can reduce the human labor to create backport PRs/commits to all of them.

Sometimes git cherry-pick may fail due to merge conflicts. In such case, the GitHub Actions workflow will append a comment to the original PR indicating that a human developer should take care of manual cherry-picking.

The workflow also automatically combines the git trailers including those already existing in the original PR's merge commit, those added by GitHub (e.g., Co-authored-by), and our own backport trackers (e.g., Backported-from, Backported-to, and a new Backport-of field).

The result backport PR is composed like the followings:

  • The title: {original-merge-commit-header} (#{backport-PR-number})
    For example, if the original PR's merge commit has the headline: "fix: A bug (#123)", the backport PRs will have the titles like "fix: A bug (#123) (#124)".
  • The body: "This is an auto-generated backport PR of #{original-PR-number} to the {target-milestone} release."
  • It has a single cherry-picked commit.

@github-actions github-actions bot added the size:M 30~100 LoC label Feb 1, 2024
@Yaminyam Yaminyam added the skip:changelog Make the action workflow to skip towncrier check label Feb 1, 2024
@Yaminyam Yaminyam added the area:infrastructure Infrastructure-related issues label Feb 6, 2024
@Yaminyam Yaminyam marked this pull request as ready for review February 16, 2024 00:04
@github-actions github-actions bot added size:L 100~500 LoC and removed size:M 30~100 LoC labels Feb 22, 2024
@achimnol achimnol added this to the 24.09 milestone Apr 24, 2024
Copy link
Member

@achimnol achimnol left a comment

Choose a reason for hiding this comment

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

Sion has tested most functionalities in his test repo.
Let's merge this and see if it goes well.

Copy link
Member

@achimnol achimnol left a comment

Choose a reason for hiding this comment

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

Sion has tested most functionalities in his test repo.
Let's merge this and see if it goes well.

@achimnol achimnol enabled auto-merge (squash) May 6, 2024 10:52
@achimnol achimnol merged commit e6a145c into main May 6, 2024
23 checks passed
@achimnol achimnol deleted the ci/backport-pr branch May 6, 2024 10:53
Copy link

github-actions bot commented May 6, 2024

Backport to 24.09 is failed. Please backport manually.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:infrastructure Infrastructure-related issues size:L 100~500 LoC skip:changelog Make the action workflow to skip towncrier check
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants