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

Enable merge_group trigger for merge queues #35062

Merged
merged 3 commits into from
Oct 8, 2023

Conversation

tobiasdiez
Copy link
Contributor

@tobiasdiez tobiasdiez commented Feb 10, 2023

📚 Description

Two days ago github announced the public beta of merge queues. The idea is pretty similar the current release/merge process (as far as I understand it): Given you want to merge three PRs into develop, you add them to the merge queue and github will create three temporary branches:

  • PR1
  • PR1 + PR2 merged
  • PR1 + PR2 + PR3 merged

It then runs all checks with the merge_group trigger on each branch. Once all checks for all these temporary branches are successful, the whole group is merged into develop. If there are merge conflicts, say between PR3 and PR1, or the build for the PR1+2+3 branch fails, then PR3 is removed from the merge queue and only the first two PRs are merged into develop.

In this way, one could never end up in a situation where the checks are not passing in the develop branch, without requiring devs to always merge the latest develop branch themselves. (E.g., we will no longer hit the situation that PR2 introduces new linter rules which are not fullfiled by PR3 but both PRs are merged into develop).

References:


In this PR we add the merge_group trigger on the current PR-workflows, which enables to run these in the merge queue as well.


Since this effectively implements the current version of "Volker's temporary private develop branch", I was wondering if this would be eneough to give more people rights to merge PRs. What else would be necessary for such a step? @vbraun

📝 Checklist

  • I have linked an issue or discussion.
  • I have created tests covering the changes.
  • I have updated the documentation accordingly.

⌛ Dependencies

@dimpase
Copy link
Member

dimpase commented Feb 10, 2023

why is master branch mentioned there?

@tobiasdiez
Copy link
Contributor Author

Github will create temporary branches that will trigger the push event. This change restricts the push trigger to the only two branches that we currently have and ignores these temporary branches. Currently the push trigger is equivalent to push: -master -develop.

@dimpase
Copy link
Member

dimpase commented Feb 10, 2023

maybe I'm mistreading what the patch does, but appearnce of master right next to develop makes me think you want to do this queue on master as well as on develop

@dimpase
Copy link
Member

dimpase commented Feb 10, 2023

change restricts the push trigger to the only two branches that we currently have

but why do we need it on master? I'd say we don't...

@tobiasdiez
Copy link
Contributor Author

maybe I'm mistreading what the patch does, but appearnce of master right next to develop makes me think you want to do this queue on master as well as on develop

This is a bit of a stupid yml syntax. The indented "branches" only apply to "push" and not to "merge_queue".

change restricts the push trigger to the only two branches that we currently have

but why do we need it on master? I'd say we don't...

I was not sure about this change, since the role of the master branch is not clear to me. If it is indeed only an old copy of the develop branch and does not receive any updates, then sure we don't need to run these workflows on it (but then why is there a master branch in the first place?). If the master branch may be updated (hotfixes?) than you probably want to verify that the new commits adhere at least to these basic tests.

@mkoeppe
Copy link
Contributor

mkoeppe commented Feb 10, 2023

The master branch is fast-forwarded to stable release tags made on the develop branch.

@tobiasdiez
Copy link
Contributor Author

@vbraun Did you already found the time to look into merge queues? In its current form this PR doesn't replace your buildbots but it ensures that PR's don't introduce changes that make other PRs fail (when merged at the same time). This happened a few times in the last months and is pretty annoying since then the github workflow fails for every new PR.

@tobiasdiez
Copy link
Contributor Author

tobiasdiez commented Sep 28, 2023

@dimpase since you were interested in the merge queue feature.
My proposal would be to merge this PR now. Then we can test it by merging some test PRs into some test branch in the main repo (for which I can activate the merge queue independent of the develop branch). Once these tests are successful, we can approach @vbraun and discuss how to best integrate the merge queues with his release manager scripts (refs sagemath/sage-release-management#2). What do you think?

@github-actions
Copy link

Documentation preview for this PR (built with commit 043e76a; changes) is ready! 🎉

@dimpase
Copy link
Member

dimpase commented Sep 28, 2023

could it rather have a manual trigger, for the time being?

@dimpase
Copy link
Member

dimpase commented Sep 28, 2023

master branch ought to be removed here, IMHO

@tobiasdiez
Copy link
Contributor Author

One can only trigger a merge queue by merging PRs. There is no other way.

(The master branch there is just for completeness - it looks like its no longer used, but officially its still there.)

@dimpase
Copy link
Member

dimpase commented Sep 28, 2023

does this mean that PRs are merged automatically?
Into a temporary branch?

So then they are still mergeable in the usual way?

@tobiasdiez
Copy link
Contributor Author

tobiasdiez commented Sep 28, 2023

For the PRs targeting develop nothing changes. But I can configure it in github ui that all PRs that target a new 'test' branch have to go through merge queues

@dimpase
Copy link
Member

dimpase commented Sep 28, 2023

what does it mean for PR to " target" the 'test' branch?

@tobiasdiez
Copy link
Contributor Author

If you open a PR you can say into which branch you want to merge this PR.

@dimpase
Copy link
Member

dimpase commented Sep 28, 2023

Oh, right, of course. So, suppose this happens, and the PR gets more or less automatically merged into 'test'.
How is it going to reach 'develop' branch?

@tobiasdiez
Copy link
Contributor Author

Never ;-) The point of the 'test' branch would be to merge stupid test PRs (some nonsensical changes in the readme say, some others that break the build etc) in order to test that the merge queue works. Once this is established, we can approach @vbraun and ask that real PRs are merged into the develop branch using the merge queue.

Copy link
Member

@dimpase dimpase left a comment

Choose a reason for hiding this comment

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

OK

@mkoeppe
Copy link
Contributor

mkoeppe commented Sep 28, 2023

Do these experiments to get familiar with merge queues really have to be done in this repo? I'd suggest not.

@dimpase
Copy link
Member

dimpase commented Sep 28, 2023

Why not? It's not breaking anything

@tobiasdiez
Copy link
Contributor Author

tobiasdiez commented Sep 29, 2023

Pull request merge queues are available in any public repository owned by an organization

So you cannot try it out in a private fork.

Thanks @dimpase for your review!

vbraun pushed a commit to vbraun/sage that referenced this pull request Oct 1, 2023
    
### 📚 Description

Two days ago [github announced the public beta of merge
queues](https://github.blog/changelog/2023-02-08-pull-request-merge-
queue-public-beta/). The idea is pretty similar the current
release/merge process (as far as I understand it): Given you want to
merge three PRs into `develop`, you add them to the merge queue and
github will create three temporary branches:
- PR1
- PR1 + PR2 merged
- PR1 + PR2 + PR3 merged

It then runs all checks with the `merge_group` trigger on each branch.
Once all checks for all these temporary branches are successful, the
whole group is merged into `develop`. If there are merge conflicts, say
between PR3 and PR1, or the build for the PR1+2+3 branch fails, then PR3
is removed from the merge queue and only the first two PRs are merged
into `develop`.

In this way, one could never end up in a situation where the checks are
not passing in the develop branch, without requiring devs to always
merge the latest develop branch themselves. (E.g., we will no longer hit
the situation that PR2 introduces new linter rules which are not
fullfiled by PR3 but both PRs are merged into develop).

References:
- https://docs.github.com/en/repositories/configuring-branches-and-
merges-in-your-repository/configuring-pull-request-merges/managing-a-
merge-queue
- https://docs.github.com/en/actions/using-workflows/events-that-
trigger-workflows#merge_group

---

In this PR we add the merge_group trigger on the current PR-workflows,
which enables to run these in the merge queue as well.

---

Since this effectively implements the current version of "Volker's
temporary private develop branch", I was wondering if this would be
eneough to give more people rights to merge PRs. What else would be
necessary for such a step? @vbraun

<!-- Describe your changes in detail -->
<!-- Why is this change required? What problem does it solve? -->
<!-- If it resolves an open issue, please link to the issue here. For
example "Closes sagemath#1337" -->

### 📝 Checklist

<!-- Put an `x` in all the boxes that apply. -->
<!-- If your change requires a documentation PR, please link it
appropriately -->
<!-- If you're unsure about any of these, don't hesitate to ask. We're
here to help! -->

- [ ] I have linked an issue or discussion.
- [ ] I have created tests covering the changes.
- [ ] I have updated the documentation accordingly.

### ⌛ Dependencies
<!-- List all open pull requests that this PR logically depends on -->
<!--
- #xyz: short description why this is a dependency
- #abc: ...
-->
    
URL: sagemath#35062
Reported by: Tobias Diez
Reviewer(s): Dima Pasechnik, Matthias Köppe, Tobias Diez
@vbraun vbraun merged commit d687f2e into sagemath:develop Oct 8, 2023
12 of 13 checks passed
@tobiasdiez tobiasdiez deleted the merge-group branch October 8, 2023 14:15
@mkoeppe mkoeppe added this to the sage-10.2 milestone Oct 8, 2023
@tobiasdiez tobiasdiez mentioned this pull request Oct 9, 2023
5 tasks
@tobiasdiez
Copy link
Contributor Author

I've now enabled the merge queue feature. You can try it out by creating a PR against https://github.com/sagemath/sage/tree/test_merge_queue. For example, #36432.

Currently, only the linter workflow has to pass for the merge to succeed.

github-merge-queue bot pushed a commit that referenced this pull request Oct 9, 2023
<!-- ^^^^^
Please provide a concise, informative and self-explanatory title.
Don't put issue numbers in there, do this in the PR body below.
For example, instead of "Fixes #1234" use "Introduce new method to
calculate 1+1"
-->
<!-- Describe your changes here in detail -->

<!-- Why is this change required? What problem does it solve? -->
<!-- If this PR resolves an open issue, please link to it here. For
example "Fixes #12345". -->
<!-- If your change requires a documentation PR, please link it
appropriately. -->

Tests if the merge queue added in
#35062 is working.

### 📝 Checklist

<!-- Put an `x` in all the boxes that apply. -->
<!-- If your change requires a documentation PR, please link it
appropriately -->
<!-- If you're unsure about any of these, don't hesitate to ask. We're
here to help! -->
<!-- Feel free to remove irrelevant items. -->

- [ ] The title is concise, informative, and self-explanatory.
- [ ] The description explains in detail what this PR is about.
- [ ] I have linked a relevant issue or discussion.
- [ ] I have created tests covering the changes.
- [ ] I have updated the documentation accordingly.

### ⌛ Dependencies

<!-- List all open PRs that this PR logically depends on
- #12345: short description why this is a dependency
- #34567: ...
-->

<!-- If you're unsure about any of these, don't hesitate to ask. We're
here to help! -->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants