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

fix: removing mr.Headpipeline.Source log when mr.HeadPipeline is missing #3996

Merged
merged 2 commits into from
Dec 7, 2023

Conversation

fitz7
Copy link
Contributor

@fitz7 fitz7 commented Nov 20, 2023

what

when mr.HeadPipeline is missing and the gitlab client retries, it logs mr.HeadPipeline.Source which causes a panic:

runtime error: invalid memory address or nil pointer dereference
runtime/panic.go:261 (0x4507d7)
runtime/signal_unix.go:861 (0x4507a5)
github.com/runatlantis/atlantis/server/events/vcs/gitlab_client.go:391 (0xdebc50)
github.com/runatlantis/atlantis/server/events/vcs/proxy.go:84 (0xdf1ecc)
github.com/runatlantis/atlantis/server/events/commit_status_updater.go:135 (0x1005e77)
github.com/runatlantis/atlantis/server/events/commit_status_updater.go:111 (0x1005a5a)
github.com/runatlantis/atlantis/server/events/pre_workflow_hooks_command_runner.go:146 (0x101b995)
github.com/runatlantis/atlantis/server/events/pre_workflow_hooks_command_runner.go:90 (0x101afbd)
github.com/runatlantis/atlantis/server/events/command_runner.go:183 (0xffa913)
runtime/asm_amd64.s:1650 (0x46cba0)

why

Should fix the panic

@jamengual
Copy link
Contributor

@X-Guardian FYI

@@ -387,12 +387,12 @@ func (g *GitlabClient) UpdateStatus(repo models.Repo, pull models.PullRequest, s
break
}
if i != retries {
g.logger.Debug("Head pipeline not found for merge request %d, source '%s'. Retrying in %s",
pull.Num, mr.HeadPipeline.Source, delay)
g.logger.Debug("Head pipeline not found for merge request %d. Retrying in %s",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there another var that contains the source repo?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

https://docs.gitlab.com/ee/api/merge_requests.html#response
from the merge request API this is just the type of event that triggered the pipeline which doesn't seem important to log when there is no pipeline yet

Copy link
Contributor

@X-Guardian X-Guardian left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks fine

@chenrui333
Copy link
Member

LGTM

@jamengual
Copy link
Contributor

thanks for your contribution @fitz7

@jamengual jamengual merged commit 0f8db49 into runatlantis:main Dec 7, 2023
25 checks passed
ijames-gc pushed a commit to gocardless/atlantis that referenced this pull request Feb 13, 2024
…ing (runatlantis#3996)

* fix: removing mr.Headpipeline.Source log when mr.HeadPipeline is missing

* fix: remove  mr.HeadPipeline.Source from other log
ijames-gc pushed a commit to gocardless/atlantis that referenced this pull request Feb 13, 2024
…ing (runatlantis#3996)

* fix: removing mr.Headpipeline.Source log when mr.HeadPipeline is missing

* fix: remove  mr.HeadPipeline.Source from other log
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
go Pull requests that update Go code provider/gitlab
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants