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

feat(azure): add support for rebase-merge #33732

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

basilfx
Copy link

@basilfx basilfx commented Jan 21, 2025

Changes

Azure DevOps has support for semi-linear rebase (rebase with merge commit, see 1). Our branch policies enforce this option, which is incompatible with any of the automergeStrategy options currently available.

In fact, when this option is set to auto, Renovate Bot will actually select semi-linear rebasing if that is the only option. But if there are other (allowed) options, then there is nothing to enforce it.

This adds the rebase-merge option, which is different from using rebase (again, see 1).

Based on closer inspection, I see that Gitea will do a rebase with merge when the option is rebase. I did not adapt this, because that would break current configurations. Also, I only have the option to test this with Azure DevOps.

Context

I could not get automerge to work, until I found out that the rebase option does not map to semi-linear rebase within Azure DevOps. This silently fails when a PR gets created.

Given that rebase-merge is rebase + merge combined, this option makes sense.

Documentation (please check one with an [x])

  • I have updated the documentation, or
  • No documentation update is required

How I've tested my work (please select one)

I have verified these changes via:

  • Code inspection only, or
  • Newly added/modified unit tests, or
  • No unit tests but ran on a real repository, or
  • Both unit tests + ran on a real repository

Azure DevOps has support for semi-linear rebase (rebase with merge
commit, see [1]). Our branch policies enforce this option, which is
incompatible with any of the `automergeStrategy` options currently
available.

In fact, when this option is set to auto, Renovate Bot will actually
select semi-linear rebasing if that is the only option. But if there
are other (allowed) options, then there is nothing to enforce it.

This adds the `rebase-merge` option, which is different from using
`rebase` (again, see [1]).

Based on closer inspection, I see that Gitea will do a rebase with
merge when the option is `rebase`. I did not adapt this, because that
would break current configurations. Also, I only have the option to
test this with Azure DevOps.

[1]: https://devblogs.microsoft.com/devops/pull-requests-with-rebase/
@@ -263,6 +263,7 @@ You may choose from these values:
- `fast-forward`, "fast-forwarding" the main branch reference, no new commits in the resultant tree
- `merge-commit`, create a new merge commit
- `rebase`, rewrite history as part of the merge, but usually keep the individual commits
- `rebase-merge`, create a new merge commit, but rebase the commits prior merging
Copy link
Collaborator

Choose a reason for hiding this comment

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

Note here that it's Azure-only

Copy link
Member

@viceice viceice left a comment

Choose a reason for hiding this comment

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

we need to check gitea and bitbucket. at least gitea also supports both strategies too.

@basilfx
Copy link
Author

basilfx commented Jan 23, 2025

@viceice Thank you for the review. Happy to make the requested changes, but any advice on how to deal with Gitea?

Like mentioned in the PR and commit, I saw that Gitea will use rebase-merge if the rebase option is selected. I could change that, but that would be a breaking change.

So technically, it is not an Azure DevOps specific feature, as requested.

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.

3 participants