runatlantis / atlantis

Terraform Pull Request Automation
https://www.runatlantis.io
Other
7.84k stars 1.06k forks source link

GraphQL: Field 'rules' doesn't exist on type 'Ref'. #5038

Open and-ku opened 1 month ago

and-ku commented 1 month ago

Overview of the Issue

I keep getting this error. I am running GHE on prem.

GraphQL: Field 'rules' doesn't exist on type 'Ref'. Continuing with mergeable and approved assumed false

Atlantis Version: 0.30.0 GHE Version: GitHub Enterprise Server 3.12.8

Logs

Logs ``` {"level":"debug","ts":"2024-10-24T19:34:10.547Z","caller":"vcs/github_client.go:815","msg":"AllowMergeableBypassApply feature flag is enabled - attempting to bypass apply from mergeable requirements","json":{"repo":"XXXXXXXX","pull":"40"}} {"level":"debug","ts":"2024-10-24T19:34:10.945Z","caller":"metrics/debug.go:42","msg":"counter","json":{"name":"atlantis.github_event.comment_created.success_200","value":1,"tags":{"base_repo":"XXXXXXXX","pr_number":"40"},"type":"counter"}} {"level":"debug","ts":"2024-10-24T19:34:10.945Z","caller":"metrics/debug.go:42","msg":"counter","json":{"name":"atlantis.github.update_status.execution_success","value":1,"tags":{"base_repo":"XXXXXXXX","pr_number":"40"},"type":"counter"}} {"level":"debug","ts":"2024-10-24T19:34:10.945Z","caller":"metrics/debug.go:42","msg":"counter","json":{"name":"atlantis.github.pull_is_approved.execution_success","value":1,"tags":{"base_repo":"XXXXXXXX","pr_number":"40"},"type":"counter"}} {"level":"debug","ts":"2024-10-24T19:34:10.945Z","caller":"metrics/debug.go:42","msg":"counter","json":{"name":"atlantis.github.get_pull_request.execution_success","value":1,"tags":{"base_repo":"XXXXXXXX","pr_number":"40"},"type":"counter"}} {"level":"error","ts":"2024-10-24T19:34:11.345Z","caller":"vcs/instrumented_client.go:200","msg":"Unable to check pull mergeable status, error: getting pull request status: fetching rulesets, branch protections and status checks from GraphQL: Field 'rules' doesn't exist on type 'Ref'","json":{"repo":"XXXXXXXX","pull":"40"},"stacktrace":"github.com/runatlantis/atlantis/server/events/vcs.(*InstrumentedClient).PullIsMergeable\n\tgithub.com/runatlantis/atlantis/server/events/vcs/instrumented_client.go:200\ngithub.com/runatlantis/atlantis/server/events/vcs.(*ClientProxy).PullIsMergeable\n\tgithub.com/runatlantis/atlantis/server/events/vcs/proxy.go:85\ngithub.com/runatlantis/atlantis/server/events/vcs.(*pullReqStatusFetcher).FetchPullStatus\n\tgithub.com/runatlantis/atlantis/server/events/vcs/pull_status_fetcher.go:33\ngithub.com/runatlantis/atlantis/server/events.(*ApplyCommandRunner).Run\n\tgithub.com/runatlantis/atlantis/server/events/apply_command_runner.go:106\ngithub.com/runatlantis/atlantis/server/events.(*DefaultCommandRunner).RunCommentCommand\n\tgithub.com/runatlantis/atlantis/server/events/command_runner.go:389"} {"level":"debug","ts":"2024-10-24T19:34:11.345Z","caller":"metrics/debug.go:52","msg":"timer","json":{"name":"atlantis.github.pull_is_mergeable.execution_time","value":0.937468306,"tags":{"base_repo":"XXXXXXXX","pr_number":"40"},"type":"timer"}} ```
dosubot[bot] commented 1 month ago

Hey @and-ku! I'm here to help you with any bugs, questions, or contributions. Let's tackle this together!

The error message "GraphQL: Field 'rules' doesn't exist on type 'Ref'" suggests that the GraphQL query being used is trying to access a field that is not available in your current GitHub Enterprise (GHE) on-premise version. This could be due to differences in the GraphQL API version or features supported by your GHE instance compared to GitHub's cloud offering.

Here are a few steps you can take to address this issue:

  1. Check GHE Version: Ensure that your GHE version supports the GraphQL features being used. You might need to upgrade your GHE instance if it's outdated.

  2. Review GraphQL Queries: If you have access to the Atlantis codebase, review the GraphQL queries to ensure they are compatible with your GHE version. Unfortunately, I couldn't find specific details about where these queries are defined in the Atlantis codebase.

  3. Feature Flag: The logs mention that the AllowMergeableBypassApply feature flag is enabled. This flag allows the mergeable check to bypass the apply required check, which might be relevant if you're facing issues with mergeability checks [1][2].

  4. Contact Support: If the issue persists, consider reaching out to your GHE support for assistance with compatibility issues.

These steps should help you diagnose and potentially resolve the issue with the GraphQL query.

To continue talking to Dosu, mention @dosu.

and-ku commented 1 month ago

It looks like this is where it was added just recently. This change has broken my ability to upgrade.

https://github.com/runatlantis/atlantis/blame/release-0.30/server/events/vcs/github_client.go#L578

https://github.com/runatlantis/atlantis/pull/4193

arnzchen commented 3 weeks ago

I'm seeing this as well

stasostrovskyi commented 3 weeks ago

Quick search shows that latest version of GHES is 3.14. Anyone running on that version and can test this?