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

Support posting PR comments in reverse order for VCS #2547

Open
1 task done
wpbeckwith opened this issue Oct 2, 2022 · 8 comments
Open
1 task done

Support posting PR comments in reverse order for VCS #2547

wpbeckwith opened this issue Oct 2, 2022 · 8 comments
Labels
feature New functionality/enhancement provider/bitbucket Stale

Comments

@wpbeckwith
Copy link
Contributor

wpbeckwith commented Oct 2, 2022

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.

Describe the user story

When Atlantis posts the terraform output back to a PR, if the output exceeds the single comment limit, then atlantis will post several comments. However the order of these comments is sub-optimal. Assuming atlantis needs to post 3 comments for the full output then the PR will read like

5 # start of 3rd comment
...
6 # end of 3rd comment
3 # start of 2nd comment
...
4 # end of 2nd comment
1 # start of 1st comment
...
2 # end of 1st comment

The current ordering requires a user to scan to section 1 and read to section 2, then scroll back up past sections 1 and 4 to find section 3 and read to 4, then repeat again and scroll to section 5 and finally finish at 6.

Describe the solution you'd like

Atlantis should reverse the order of the array before it posts the comments, then the PR will read like

1 # start of 1st comment
...
2 # end of 1st comment
3 # start of 2nd comment
...
4 # end of 2nd comment
5 # start of 3rd comment
...
6 # end of 3rd comment

This now reads more naturally from top to bottom. Even if another PR comment somehow was included while Atlantis was posting its comments, it would still retain the easier top down reading.

Describe the drawbacks of your solution

This section is important not only to identify future issues, but also for us to see whether
you thought through your request. When filling it, ask yourself what are the problems we could
have maintaining what you propose. How often will it break?

None known as this should be an option to reverse the posting behavior.

Describe alternatives you've considered

We have implemented the change here, 66a21de, minus a server config option to control the reversal.

@wpbeckwith wpbeckwith added the feature New functionality/enhancement label Oct 2, 2022
@jamengual
Copy link
Contributor

jamengual commented Oct 2, 2022 via email

@wpbeckwith
Copy link
Contributor Author

I haven't tested this with GH, only BitBucket because that is what we use FTM. However, next year we are looking to migrate to GHE.

@wpbeckwith
Copy link
Contributor Author

Honestly if Atlantis currently post for all the servers like this, then wrapping this in a config option should be a big win for all the VCS. As for testing, the code simply reverses the current slice order. If you think this is good, then I can implement the config option and some unit tests for this?

@jamengual
Copy link
Contributor

jamengual commented Oct 2, 2022 via email

@wpbeckwith
Copy link
Contributor Author

Ok, I've started working on this and I have written the reverse function and test in the server/events/vcs/common package and created the server configuration flag. What I'm stuck on is how to read the server configuration flag at the point where common.SplitComment(...) is called, like line 139 in the server/events/vcs/bitbucketserver/client.go file.

@jamengual
Copy link
Contributor

@nitrocode do you have an idea for this?

@nitrocode
Copy link
Member

@wpbeckwith could you submit a draft PR for now and we can try to comment on it so you can fine tune it?

@wpbeckwith wpbeckwith changed the title Support posting PR comments in reverse order for BitBucket Support posting PR comments in reverse order for VCS Dec 1, 2023
@wpbeckwith
Copy link
Contributor Author

I updated the title since this really is an option for any VCS that splits PR comments due to the size of the comment.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature New functionality/enhancement provider/bitbucket Stale
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants