atlantis icon indicating copy to clipboard operation
atlantis copied to clipboard

feat: Enable `hide-prev-plan-comments` Feature for BitBucket Cloud

Open ragne opened this issue 2 months ago • 9 comments

what

Atlantis produces a truly ungodly amount of comments during an extensive work on a PR in the bitbucket. For GH integration, there's an ability to collapse comments that are no longer relevant for a discussion (i.e. old plans that are now discarded, etc). This PR tries to add that to bitbucket with all its limitations. Since BB doesn't have an ability to collapse comments, the only way there is to delete old comments all-together. In my opinion, that is fine, since this feature is gated via a cmdline flag anyway.

Please let me know your thoughts. We used this code internally at $dayjob and it gets job done.

why

It's just annoying to scroll a kilometere-long comment just to find another one right after. The plans that we're working with are more than 2-3k lines. We used tf-summarize to reduce the amount of text in the comment, but the main problem of having too much comments from atlantis still stands.

tests

We have used the code in our own installation. I'll be honest, go isn't my strongest language, so I have no idea if I have to add tests to the codebase and how to do that.

references

ragne avatar Apr 30 '24 08:04 ragne

@ragne could you please add tests and docs for this?

jamengual avatar Apr 30 '24 16:04 jamengual

I've been considering doing something similar for GitLab—configuring Atlantis to delete previous comments (or retain up to X of them). Is there an opportunity (and desire) to make this work across SCM providers?

Some of our GitLab MRs exceed 4-5 MB of Atlantis output, putting my M1 laptop, Chrome, and Gitlab UI under so much pressure that I worry they will eventually become diamonds.

jippi avatar May 03 '24 17:05 jippi

it is always encourage to make features available to all VCSs.

github supports hiding comments which help with the long plans.

On Fri, May 3, 2024, 10:20 a.m. Christian Winther @.***> wrote:

I've been considering doing something similar for GitLab - configuring Atlantis to delete previous comments (or retain up to X of them) - is there an opportunity (and desire) to make this work cross SCM providers?

— Reply to this email directly, view it on GitHub https://github.com/runatlantis/atlantis/pull/4495#issuecomment-2093449076, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAQ3EREZGFL2WXOORLZJIYDZAPBOLAVCNFSM6AAAAABG72T67OVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDAOJTGQ2DSMBXGY . You are receiving this because your review was requested.Message ID: @.***>

jamengual avatar May 03 '24 20:05 jamengual

@jippi, Atlantis already support hiding previous comments in GitLab. https://www.runatlantis.io/docs/server-configuration.html#hide-prev-plan-comments

X-Guardian avatar May 04 '24 10:05 X-Guardian

I changed the PR title to make the intended change clearer.

X-Guardian avatar May 04 '24 10:05 X-Guardian

Can you add tests for this?

X-Guardian avatar May 04 '24 10:05 X-Guardian

@X-Guardian GitLab does indeed support hiding them, but they are still included in the initial page load, and thus add significant weight to the page size and performance - sadly its not as cleverly done as GitHub that doesn't load them at all, until you click on them and then JIT load them for you.

In GitLab its just wrapped in a details, making them visually smaller (but still quite large compared to GitHub), so the ability to "hide" via "delete" as proposed in this change, is something I've been keen on getting implemented in GitLab as well :)

Some of our GitLab MR pages are 5-10 MB TF output sent to the browser within those detail blocks, making it quite heavy on both end-user devices and the GitLab service itself.

jippi avatar May 04 '24 11:05 jippi

I'm not sure if the implementation there conforms to the name of the cmdline flag. If you want to create a separate flag (instead of hide-prev-plan-comments), please let me know. I honestly have no idea how to write tests in go, so I just copied whatever was there :)

ragne avatar May 07 '24 12:05 ragne