-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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 Gitlab after upgrading Atlantis to 0.23.2 #3196
Comments
I should clarify that I don't know the expected behavior of auto plan when the draft status is removed from a merge request. What I observed with Atlantis 0.21 is that auto plan would not run after the draft status was removed. I had to manually trigger a plan operation. |
@lyoung-confluent @krrrr38 what do you think? |
We see this same issue. I will note that when we get the nil pointer error, closing and re-opening the merge request often allows Atlantis to function normally. Though, no matter what we do, it's not auto planning when opening an MR. We have to manually trigger it.
|
Any chance you could clarify this? When a Draft MR is marked |
It would make sense if you set a PR to Additional thoughts @runatlantis/maintainers ? |
I guess Atlantis is expecting a push to happens so it does not know of the status change |
Looks like it's part of the Some references Line 59 in 3214b8c
Line 121 in 3214b8c
atlantis/server/controllers/github_app_controller.go Lines 105 to 115 in 3214b8c
It might be as easy as adding https://docs.github.com/en/webhooks-and-events/events/issue-event-types#ready_for_review We might want to add |
If you guys do not have access to gitlab, I have an env I can test from. |
Unfortunately, while https://docs.gitlab.com/ee/user/project/integrations/webhook_events.html There is a |
Ive opened a support request with Gitlab to see what they say. |
https://gitlab.com/gitlab-org/gitlab/-/issues/398224 Thats the support request |
I finally had some time to revisit this issue. I thing I haven't mentioned yet is that I added ---
version: 3
projects:
- dir: .
workflow: "production"
terraform_version: "v1.3.9"
autoplan:
when_modified: ["**/*"]
enabled: true Auto plan still did not run on 0.22 or 0.23.3 with those settings. Today, I upgraded Atlantis to 0.23.4. Auto plan is now working correctly when the My Gitlab installation is on version 15.9.4 now for what it is worth. It'll be upgraded to 15.10 in the very near future. |
Hello, I have also noticed this happens however in my experience this happens when someone issues an {
"id": 222683528,
"iid": 2,
"project_id": 35657329,
"title": "Draft: test2",
"description": "",
"state": "opened",
[...]
"pipeline": null,
"head_pipeline": null,
[...]
} We see that To replicate this issue in a setting where you use atlantis, you can create a MR and set it to atlantis/server/events/vcs/gitlab_client.go Line 229 in bd284eb
where There was a PR #1981 that suggested to add a mechanism to detect when this is null to avoid this error which was refused because it the behavior of the Gitlab API was not very clear on this type of scenario. I have opened a support ticket asking them to explain if this behavior is intended. If it is intended maybe the proposed PR should be implemented ? |
You are not the first to create a support ticket with gitlab.
https://gitlab.com/gitlab-org/gitlab/-/issues/398224
I think we could bring back #1981 until Gitlab fixes this and add a comment
that is a temporary fix.
@GenPage @nitrocode What do you guys think?
|
The original pr author deleted the branch so it cannot be reopened cc @marceloboeira |
he offered to bring it back if we were ok with it, we can wait for his answer. |
I digged a bit more and it seems there is an Epic to bring the entire Rest API to Open API v2 but there is no timeline. If there is any way I can help let me know. :) |
@nitrocode let me see if I can bring it back |
Gitlab appears to have closed the other issues, and then opened a new one: https://gitlab.com/gitlab-org/gitlab/-/issues/321268 |
Community Note
Overview of the Issue
After upgrading Atlantis to version 0.23.2, I ran into an issue where Atlantis would error out with a "invalid memory address or nil pointer dereference" exception.
The specific scenario is manually triggering a plan operation because auto plan did not run. Looking at the code, I think the issue was introduced in #2979. Specifically, it was introduced at the following line.
atlantis/server/events/plan_command_runner.go
Line 174 in 739d6e4
When fetching the status of a Gitlab merge request, a nil pointer dereference exception is thrown if Atlantis has not added a commit status to the merge request's commit. This behavior is described in more detail in #1852. If auto plan runs, then the commit status will exist and the manual plan operation succeeds. If a project has a repo-level configuration file, then auto plan will fail to run because of #3122. If I manually trigger an apply operation, then the commit status will appear even though the apply operation will fail. After that, I can manually trigger a plan operation. Another scenario where auto plan doesn't run is when Atlantis is configured to ignore draft merge requests. Removing the draft status and manually triggering an auto plan will result in the nil pointer exception.
The combination of this issue and #3122 makes version 0.23 almost unusable on Gitlab. I've had to revert my deployment to version 0.22.3.
Reproduction Steps
The simplest way to reproduce the issue is to disable auto plan by configuring Atlantis to ignore draft merge requests.
allow-draft-prs
set tofalse
.atlantis plan
Logs
Here are logs for both the creation of a merge request and the manual run of
atlantis plan
. The merge request contained one change to a.tf
file in the root of the project.Environment details
Atlantis Version: 0.23.2
Gitlab Version: 15.9.2 and 15.6.8
Atlantis server-side config file:
Repo
atlantis.yaml
file:Server side config
Additional Context
The text was updated successfully, but these errors were encountered: