chdsbd / kodiak

🔮 A bot to automatically update and merge GitHub PRs
https://kodiakhq.com
GNU Affero General Public License v3.0
1.03k stars 65 forks source link

Avoiding conflicts and waiting for renovate to rebase #876

Closed mheffner closed 7 months ago

mheffner commented 7 months ago

I'm trying to find the best way to use automerge labels with multiple dependency update PRs opened by renovatebot. Because the PRs all touch the same files (go.mod/go.sum), when one is merged the remaining PRs will become conflicted until renovatebot rebases. However, kodiak will detect the conflict and remove the automerge label before it gets a chance. This means we can't queue up multiple dependency PRs to merge.

Here's the general steps we are taking:

  1. renovatebot opens PRs 1 and 2, both touch the same files (go.mod/go.sum)
  2. A human approves PRs 1 and 2, adds automerge label to both
  3. Kodiak merges PR 1
  4. PR 2 is now in a conflict state
  5. Kodiak removes automerge label and adds comment
  6. renovatebot wakes up and rebases PR 2, fixing conflict state
  7. PR 2 doesn't get merged by kodiak

I guess the ideal state would be that kodiak waits for renovate to rebase the PR, waits for the checks to run and pass, then merges the PR.

Here's our .kodiak.toml:

version = 1

[merge]
blocking_labels = ["wip", "do-not-merge"]

[update]
always = true
ignored_usernames = ["dependabot", "renovate"]

We have branch protections set with "Require branches to be up to date before merging" enabled.

Thanks!

chdsbd commented 7 months ago

Hey @mheffner,

If you disable merge.notify_on_conflict, Kodiak will no longer remove the auto merge label on merge conflict.

# https://kodiakhq.com/docs/config-reference#mergenotify_on_conflict
merge.notify_on_conflict = false

I think with this option disabled, Kodiak and Renovate should "just work". Renovate will fix the PR when there's a merge conflict and then Kodiak will be able to merge it

Let me know if you have any questions

mheffner commented 7 months ago

Thanks @chdsbd , it looks like that did the trick. :tada: Renovate will rebase the PR when another lands and then Kodiak kicks and merges it when it's ready.

I believe I saw that option earlier, but disregarded it because I believed it only controlled the comment notification about conflicts, not the removing of the label behavior. :facepalm:

This should get us where we need to go for now. In the future would there be a way to only disable the conflict notification when the author is a bot, like renovate or dependabot? It may be nice to keep this enable for human PRs. Not a priority at the moment though.

Thanks again!

mheffner commented 7 months ago

This option resolved this for us, so closing.