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

Nil pointer error when manually running "atlantis plan" on Github with ATLANTIS_GH_ALLOW_MERGEABLE_BYPASS_APPLY and no required checks / Atlantis 0.24.2 #3563

Closed
dnozay opened this issue Jun 29, 2023 · 2 comments · Fixed by #3672
Labels
bug Something isn't working

Comments

@dnozay
Copy link

dnozay commented Jun 29, 2023

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

I first thought this was similar to #3196 but this is in the github client instead.

runtime error: invalid memory address or nil pointer dereference
runtime/panic.go:260 (0x44e11c)
runtime/signal_unix.go:837 (0x44e0ec)
github.com/runatlantis/atlantis/server/events/vcs/github_client.go:438 (0xd91157)
github.com/runatlantis/atlantis/server/events/vcs/github_client.go:507 (0xd91717)
github.com/runatlantis/atlantis/server/events/vcs/instrumented_client.go:206 (0xd98beb)
github.com/runatlantis/atlantis/server/events/vcs/proxy.go:80 (0xd9a984)
github.com/runatlantis/atlantis/server/events/vcs/pull_status_fetcher.go:32 (0xd9b255)
github.com/runatlantis/atlantis/server/events/plan_command_runner.go:174 (0xfb15f7)
github.com/runatlantis/atlantis/server/events/plan_command_runner.go:290 (0xfb2c8b)
github.com/runatlantis/atlantis/server/events/command_runner.go:298 (0xf97f43)
runtime/asm_amd64.s:1598 (0x46b2e0)

please note it's still in the same logical ballpark if you look at the bottom of the stack

github.com/runatlantis/atlantis/server/events/vcs/pull_status_fetcher.go:32 (0xd9b255)
github.com/runatlantis/atlantis/server/events/plan_command_runner.go:174 (0xfb15f7)
github.com/runatlantis/atlantis/server/events/plan_command_runner.go:290 (0xfb2c8b)
github.com/runatlantis/atlantis/server/events/command_runner.go:298 (0xf97f43)

Reproduction Steps

  1. create a PR on a github repo that does not have atlantis enabled.
  2. comment atlantis plan and watch nothing happen (as expected)
  3. enable the github app integration
  4. comment atlantis plan again
  5. atlantis server actually adds 👀 to the review
  6. next comment is the stacktrace.

Atlantis never got any other event for this particular PR because the github app wasn't installed in the repo before.

Logs

stacktrace from the logs

runtime.gopanic
        runtime/panic.go:890
runtime.panicmem
        runtime/panic.go:260
runtime.sigpanic
        runtime/signal_unix.go:837
github.com/runatlantis/atlantis/server/events/vcs.(*GithubClient).GetCombinedStatusMinusApply
        github.com/runatlantis/atlantis/server/events/vcs/github_client.go:438
github.com/runatlantis/atlantis/server/events/vcs.(*GithubClient).PullIsMergeable
        github.com/runatlantis/atlantis/server/events/vcs/github_client.go:507
github.com/runatlantis/atlantis/server/events/vcs.(*InstrumentedClient).PullIsMergeable
        github.com/runatlantis/atlantis/server/events/vcs/instrumented_client.go:206
github.com/runatlantis/atlantis/server/events/vcs.(*ClientProxy).PullIsMergeable
        github.com/runatlantis/atlantis/server/events/vcs/proxy.go:80
github.com/runatlantis/atlantis/server/events/vcs.(*pullReqStatusFetcher).FetchPullStatus
        github.com/runatlantis/atlantis/server/events/vcs/pull_status_fetcher.go:32
github.com/runatlantis/atlantis/server/events.(*PlanCommandRunner).run
        github.com/runatlantis/atlantis/server/events/plan_command_runner.go:174
github.com/runatlantis/atlantis/server/events.(*PlanCommandRunner).Run
        github.com/runatlantis/atlantis/server/events/plan_command_runner.go:290
github.com/runatlantis/atlantis/server/events.(*DefaultCommandRunner).RunCommentCommand
        github.com/runatlantis/atlantis/server/events/command_runner.go:298

Environment details

  • Atlantis version: 0.24.2
  • Deployment method: AWS EKS / helm

Atlantis server-side config file:

apiVersion: v1
data:
  repository-configuration: |
    {
      "repos": [
          {
            "id": "/.*/",
            "branch": "/.*/",
            "apply_requirements": ["approved", "mergeable", "undiverged"],
            "allowed_overrides": ["workflow"],
            "allow_custom_workflows": true,
            "repo_config_file": "atlantis.yaml"
          }
      ]
    }
kind: ConfigMap
... [redacted] ...
    - name: ATLANTIS_GH_ALLOW_MERGEABLE_BYPASS_APPLY
      value: "true"

Repo atlantis.yaml file:

N/A, there isn't one yet.

Additional Context

see also #3196

@dnozay dnozay added the bug Something isn't working label Jun 29, 2023
@dnozay
Copy link
Author

dnozay commented Jun 29, 2023

for _, r := range suite.CheckRuns {
//check to see if the check is required
if isRequiredCheck(*r.Name, required.RequiredStatusChecks.Contexts) {
if *c.Conclusion == "success" {
continue
} else {
return false, nil
}
} else {
//ignore checks that arent required
continue
}
}

  • branch protection rules -> no required checks
  • one check was actually run ( some security scanning check )

🤔 required or required.RequiredStatusChecks is nil ?

@dnozay dnozay changed the title Nil pointer error when manually running "atlantis plan" on Github after installing Atlantis 0.24.2 to new repo Nil pointer error when manually running "atlantis plan" on Github with ATLANTIS_GH_ALLOW_MERGEABLE_BYPASS_APPLY and no required checks / Atlantis 0.24.2 Jun 29, 2023
@dnozay
Copy link
Author

dnozay commented Jun 29, 2023

The code was added in #2436 but there isn't a lot of test coverage for the new behavior.

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
1 participant