atlantis icon indicating copy to clipboard operation
atlantis copied to clipboard

Quadratic complexity of comment minimisation

Open ilyaluk opened this issue 2 years ago • 0 comments

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

We have a (relatively) huge terragrunt repo (~500 stacks). Sometimes we do major refactorings of multiple stacks. In worst cases, when we change some common files, we get plans in each stack. This yield enormous amount of comments (e.g. over 1k if many resources have changed and several iterations have passed). We enabled comment minimisation to reduce amount of noise in regular cases, this is extremely useful when PR changes only 1-5 stacks and has several iterations. However, it seems that comment minimisation does not check whether the comment was already minimized, and calls GH API on each Atlantis comment on each run, and this step takes a long time for big PRs (minutes).

While I did not check the debug logs to confirm whether this actually takes a long time, judging by long pause after all stacks planned (stack checks are green, and atlantis/plan is still in progress) and flickering of GH PR page while comments are being minimised, it takes a long time (several seconds per comment)

The check whether the comment already was minimised could be added in this loop: https://github.com/runatlantis/atlantis/blob/008b2ed9528f3f0f248304467816cbbb50fa1bf1/server/events/vcs/github_client.go#L226-L240

I'll be glad to send the PR fixing this, but the minimisation field is not yet included in ListComments go-github API (maybe it's not yet stabilised). I think it is possible to retrieve such information by manually listing comments using GH API. If that's fine solution, I'll send the PR.

ilyaluk avatar Jul 12 '22 14:07 ilyaluk