atlantis: `--gh-allow-mergeable-bypass-apply` flag will panic if no required checks on GH branch protection settings

Community Note

  • Please vote on this issue by adding a πŸ‘ reaction to the original issue to help the community and maintainers prioritize this request. Searching for pre-existing feature requests helps us consolidate datapoints for identical requirements into a single place, thank you!
  • Please do not leave β€œ+1” or other comments that do not add relevant new information or questions, they generate extra noise for issue followers and do not help prioritize the request.
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment.

Overview of the Issue

Atlantis v0.20.1 panicked when running atlantis apply on a GitHub PR configured with AllowMergeableBypassApply turned on.

runtime error: invalid memory address or nil pointer dereference
runtime/panic.go:260 (0x44c995)
runtime/signal_unix.go:835 (0x44c965)
github.com/runatlantis/atlantis/server/events/vcs/github_client.go:329 (0xb8b7cb)
github.com/runatlantis/atlantis/server/events/vcs/github_client.go:398 (0xb8bd97)
github.com/runatlantis/atlantis/server/events/vcs/instrumented_client.go:179 (0xb9278b)
github.com/runatlantis/atlantis/server/events/vcs/proxy.go:72 (0xb94184)
github.com/runatlantis/atlantis/server/events/vcs/pull_status_fetcher.go:28 (0xb94a05)
github.com/runatlantis/atlantis/server/events/apply_command_runner.go:108 (0xd74415)
github.com/runatlantis/atlantis/server/events/command_runner.go:296 (0xd79023)
runtime/asm_amd64.s:1594 (0x467ca0)

Doing another atlantis apply a bit later ran successfully. Could something in the responses from github in Repositories.GetBranchProtection or Checks.ListCheckSuitesForRef be nil in some cases?

Reproduction Steps

  • Turn on AllowMergeableBypassApply
  • Create a PR in a repo with other checks
  • Comment with atlantis plan
  • Comment with atlantis apply
  • Roll dice and observe if you get the panic or not.

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Reactions: 6
  • Comments: 18 (18 by maintainers)

Most upvoted comments

Well, probably the logic in this case should be something like that:

If there is no atlantis/apply required check in the repo then we should just ask GitHub if PR is mergeable (as if this feature doesn’t exist).

Unless someone wants to jump on it, I will try to find some time next week to fix it.

Just confirmed on two disctinct repos that checking the Require status checks to pass before merging flag works around the panic

@stasostrovskyi I enabled the single non-atlantis check to be a required and it started working

image

The Require status checks to pass before merging flag was off completely. Could that be it?

Sorry for not replying sooner! I have not seen this lately, but will try to make reproduction and report back