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

"Require merge queue" branch protection rule is incompatible with automerge feature #871

Open
vitalyster opened this issue Mar 27, 2023 · 15 comments
Labels
bug Something isn't working

Comments

@vitalyster
Copy link

vitalyster commented Mar 27, 2023

My config:

# .kodiak.toml
version = 1

[merge]
method = "rebase_fast_forward"
[approve]
# note: remove the "[bot]" suffix from GitHub Bot usernames.
# Instead of "dependabot[bot]" use "dependabot".
auto_approve_usernames = ["dependabot"]
@vitalyster vitalyster added the bug Something isn't working label Mar 27, 2023
@vitalyster
Copy link
Author

With method="rebase" I see:

API call 'pull_request/merge' failed with HTTP status '405' and response: 'b'{"message":"Server Error","documentation_url":"[https://docs.github.com/articles/about-protected-branches"}\](https://docs.github.com/articles/about-protected-branches%22%7D%5C)''

@vitalyster
Copy link
Author

Same without method option

@chdsbd
Copy link
Owner

chdsbd commented Mar 30, 2023

Hey @vitalyster, do you still get a "Server Error" from the GitHub API?

GitHub's API can be flaky sometime, but will usually resolve itself. Are you still able to replicate this issue?

@vitalyster
Copy link
Author

vitalyster commented Mar 30, 2023

@chdsbd still the same problem right now and that happens last 2-3 months, kodiak bot is unable to merge PRs most of the time

@chdsbd
Copy link
Owner

chdsbd commented Mar 30, 2023

@vitalyster Is the repository public?

@vitalyster
Copy link
Author

@chdsbd see this one from example

@chdsbd
Copy link
Owner

chdsbd commented Apr 3, 2023

@vitalyster Thanks, I see this happening on other repositories too occasionally. I'm going to take a closer look and then open a ticket with GitHub Support

@chdsbd
Copy link
Owner

chdsbd commented Apr 4, 2023

I've opened a support ticket with GitHub Support and will let you know what I hear from them

Here's the Curl output for context:

curl --request PUT \
  --url https://api.github.com/repos/BombusMod/BombusMod/pulls/167/merge \
  --header 'Accept: application/vnd.github.antiope-preview+json,application/vnd.github.merge-info-preview+json' \
  --header 'Authorization: Bearer ghs_redacted' \
  --header 'Content-Type: application/json' \
  --data '{"merge_method": "rebase"}' -vvv
*   Trying 140.82.112.5:443...
* Connected to api.github.com (140.82.112.5) port 443 (#0)
* ALPN: offers h2
* ALPN: offers http/1.1
*  CAfile: /etc/ssl/cert.pem
*  CApath: none
* [CONN-0-0][CF-SSL] (304) (OUT), TLS handshake, Client hello (1):
* [CONN-0-0][CF-SSL] (304) (IN), TLS handshake, Server hello (2):
* [CONN-0-0][CF-SSL] (304) (IN), TLS handshake, Unknown (8):
* [CONN-0-0][CF-SSL] (304) (IN), TLS handshake, Certificate (11):
* [CONN-0-0][CF-SSL] (304) (IN), TLS handshake, CERT verify (15):
* [CONN-0-0][CF-SSL] (304) (IN), TLS handshake, Finished (20):
* [CONN-0-0][CF-SSL] (304) (OUT), TLS handshake, Finished (20):
* SSL connection using TLSv1.3 / AEAD-CHACHA20-POLY1305-SHA256
* ALPN: server accepted h2
* Server certificate:
*  subject: C=US; ST=California; L=San Francisco; O=GitHub, Inc.; CN=*.github.com
*  start date: Feb 16 00:00:00 2023 GMT
*  expire date: Mar 15 23:59:59 2024 GMT
*  subjectAltName: host "api.github.com" matched cert's "*.github.com"
*  issuer: C=US; O=DigiCert Inc; CN=DigiCert TLS Hybrid ECC SHA384 2020 CA1
*  SSL certificate verify ok.
* Using HTTP2, server supports multiplexing
* Copying HTTP/2 data in stream buffer to connection buffer after upgrade: len=0
* h2h3 [:method: PUT]
* h2h3 [:path: /repos/BombusMod/BombusMod/pulls/167/merge]
* h2h3 [:scheme: https]
* h2h3 [:authority: api.github.com]
* h2h3 [user-agent: curl/7.87.0]
* h2h3 [accept: application/vnd.github.antiope-preview+json,application/vnd.github.merge-info-preview+json]
* h2h3 [authorization: Bearer ghs_redacted]
* h2h3 [content-type: application/json]
* h2h3 [content-length: 26]
* Using Stream ID: 1 (easy handle 0x159011400)
> PUT /repos/BombusMod/BombusMod/pulls/167/merge HTTP/2
> Host: api.github.com
> user-agent: curl/7.87.0
> accept: application/vnd.github.antiope-preview+json,application/vnd.github.merge-info-preview+json
> authorization: Bearer ghs_redacted
> content-type: application/json
> content-length: 26
> 
* We are completely uploaded and fine
< HTTP/2 405 
< server: GitHub.com
< date: Tue, 04 Apr 2023 00:42:15 GMT
< content-type: application/json; charset=utf-8
< content-length: 116
< x-github-media-type: github.v3; param=antiope-preview; format=json, github.merge-info-preview; format=json
< x-github-api-version-selected: 2022-11-28
< x-ratelimit-limit: 5000
< x-ratelimit-remaining: 4997
< x-ratelimit-reset: 1680572487
< x-ratelimit-used: 3
< x-ratelimit-resource: core
< access-control-expose-headers: ETag, Link, Location, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Used, X-RateLimit-Resource, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval, X-GitHub-Media-Type, X-GitHub-SSO, X-GitHub-Request-Id, Deprecation, Sunset
< access-control-allow-origin: *
< strict-transport-security: max-age=31536000; includeSubdomains; preload
< x-frame-options: deny
< x-content-type-options: nosniff
< x-xss-protection: 0
< referrer-policy: origin-when-cross-origin, strict-origin-when-cross-origin
< content-security-policy: default-src 'none'
< vary: Accept-Encoding, Accept, X-Requested-With
< x-github-request-id: CB17:1B25:47082E:927730:642B7267
< 
{
  "message": "Server Error",
  "documentation_url": "https://docs.github.com/articles/about-protected-branches"
}
* Connection #0 to host api.github.com left intact  

@vitalyster
Copy link
Author

Still an issue in all my repositories. Maybe they change API and that method is really does not exists?

@vitalyster
Copy link
Author

Well, I checked API documentation and everything looks correct...

@chdsbd
Copy link
Owner

chdsbd commented Apr 11, 2023

Hi @vitalyster

I'm still waiting for a response from GitHub support. I feel like their support times have gotten worse since their layoff.

@vitalyster
Copy link
Author

@chdsbd found the solution. After comparing broken repos and working repos I uncheck "require merge queues (beta)" and PRs now merged correctly.

@vitalyster vitalyster changed the title API call 'pull_request/update_ref' failed with HTTP status '422' and response: 'b'{"message":"Update is not a fast forward","documentation_url":"https://docs.github.com/rest/reference/git#update-a-reference"}\'' "Require merge queues" branch protection rule is incompatible with automerge feature Apr 12, 2023
@vitalyster vitalyster changed the title "Require merge queues" branch protection rule is incompatible with automerge feature "Require merge queue" branch protection rule is incompatible with automerge feature Apr 12, 2023
@olegshilov
Copy link

Is there any way to get kodiak work with merge queue?

@chdsbd
Copy link
Owner

chdsbd commented Jan 12, 2024

@olegshilov Kodiak doesn't support merging with the GitHub Merge Queue. We could update Kodiak to support it using these APIs: https://github.blog/changelog/2023-04-19-pull-request-merge-queue-public-beta-api-support-and-recent-fixes/

This is where we call the merge APIs in Kodiak:

await set_status("⛴ attempting to merge PR (merging)")
try:
# Use the Git Refs API to rebase merge.
#
# This preserves the rebased commits and their hashes. Using the
# GitHub Pull Request API to rebase merge rewrites the rebased
# commits, so the commit hashes change.
#
# For build systems that depend on commit hashes instead of tree
# hashes, it's desirable to not rewrite commits.
if merge_args.merge_method is MergeMethod.rebase_fast_forward:
await api.update_ref(
ref=pull_request.baseRefName, sha=pull_request.latest_sha
)
else:
await api.merge(
merge_method=merge_args.merge_method,
commit_title=merge_args.commit_title,
commit_message=merge_args.commit_message,
)
# if we encounter an internal server error (status code 500), it is
# _not_ safe to retry. Instead we mark the pull request as unmergable

@eddpascoal
Copy link

Since

Kodiak doesn't support merging with the GitHub Merge Queue

Should this be labelled as enhancement ? This definetely would be a great feature. 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants