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

Renovate bot support for automerge by update type #701

Closed
erezrokah opened this issue Jul 28, 2021 · 13 comments
Closed

Renovate bot support for automerge by update type #701

erezrokah opened this issue Jul 28, 2021 · 13 comments
Labels
enhancement New feature or request

Comments

@erezrokah
Copy link

From looking at this regex:

title_regex = re.compile(r"from (?P<old_version>\S+) to (?P<new_version>\S+)")

looks like the following guide will only work for dependabot as renovate bot PR titles are a bit different.

See netlify/cli#3016. The title is fix(deps): update dependency @netlify/build to ^17.1.1 so the version type will not be detected.

Please let me know if I got this wrong or there's another way to handle it (I could configure the renovate PR title, but it feels this should work with the default one).

@erezrokah erezrokah added the enhancement New feature or request label Jul 28, 2021
@chdsbd
Copy link
Owner

chdsbd commented Jul 29, 2021

Good idea!

After looking at your example PR, I think we can parse the version numbers from the pull request body to determine the upgrade type

@erezrokah
Copy link
Author

Thanks!

I'm adding some more PRs as reference:
netlify/cli#3011
netlify/cli#3003
netlify/cli#2998
netlify/cli#2997
netlify/cli#2999

@chdsbd
Copy link
Owner

chdsbd commented Aug 14, 2021

@erezrokah Thanks for the links!

It looks like handling dependency updates like netlify/cli#2998 is similar to handling Dependabot updates.

The GitHub Action dependency update (netlify/cli#2997) doesn't follow semver, but I think we can just ignore the v prefix and then treat the update like any other semver.

I was thinking we would consider the lock file update for netlify/cli#2999 a "minor" version upgrade for Kodiak's auto merge purposes.

@chdsbd
Copy link
Owner

chdsbd commented Aug 14, 2021

@erezrokah I was looking at the Renovate docs and was wondering where Renovate's auto merge falls short.

It looks like Renovate supports auto merging by update type here: https://docs.renovatebot.com/automerge-configuration/#automerge-non-major-updates

@erezrokah
Copy link
Author

Thanks @chdsbd, that's a very good question.

Renovate auto merge falls short when a branch has the Require branches to be up to date before merging protection rule.
In that case Renovate's default is to sync PRs when they are 1 commit behind the base branch. See here.
That leads to wasteful CI jobs, and can also lead to starvation of non-renovate PRs.

I would like Kodiak to efficiently sync those renovates PRs, and have renovate only update the PR when it's conflicted (by setting rebaseWhen: conflicted.

I thought about opening an issue on Renovate's side, but I think since it's doesn't have the full context of the PRs queue, it has to be done on Kodiak's side.

Please let me know if that makes sense.

@chdsbd
Copy link
Owner

chdsbd commented Aug 18, 2021

I think setting rebaseWhen: conflicted might work.

By default, Kodiak will efficiently update the PR right before merging.

@chdsbd
Copy link
Owner

chdsbd commented Aug 18, 2021

I now realize we still need to update Kodiak to support auto merging Renovate PRs by update type.

However, if you want to auto merge all Renovate PRs, adding the automerge label will work

@erezrokah
Copy link
Author

I now realize we still need to update Kodiak to support auto merging Renovate PRs by update type.

💯

However, if you want to auto merge all Renovate PRs, adding the automerge label will work

Correct, however we can't auto merge Renovate major version updates PRs, as they usually contain breaking changes and require user intervention

kodiakhq bot pushed a commit that referenced this issue Aug 24, 2021
This change supports auto merging Renovate PRs by update type.

related #701
@chdsbd
Copy link
Owner

chdsbd commented Aug 24, 2021

I've released a new version of Kodiak with support for auto merging Renovate PRs by upgrade type.

I used the PRs you linked as test cases, so those examples you gave should work in the future.

The Kodiak docs on Dependabot should be applicable to Renovate: https://kodiakhq.com/docs/recipes#automated-dependency-updates-with-dependabot-or-renovate

Let me know if you run into any issues.

@erezrokah
Copy link
Author

Looks like this is working, see netlify/eslint-config-node#287.

Thanks @chdsbd 🥳

@erezrokah
Copy link
Author

Not sure if to open a new issue for it, but we probably want to match netlify/cli#3273 as well.
I would consider those as minor versions upgrades.

Happy to learn of another way to put those into the Kodiak's merge queue automatically.

@chdsbd
Copy link
Owner

chdsbd commented Aug 30, 2021

@erezrokah I think Kodiak should auto merge that PR as a "patch" update. There's a test using netlify/cli#2999 as an example: https://github.com/chdsbd/kodiak/blob/06a92425ac4869695e4a77e8d815745e2ebd35c6/bot/kodiak/tests/dependencies/renovate_pull_requests/update-patch-lock_file_maintenance.txt

I think that PR isn't merging because Testing for CLI / build (ubuntu-latest, *) (pull_request) is failing

@erezrokah
Copy link
Author

Woo, I missed that. Thank you for clarifying ❤️

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants