-
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
Hide "plan" comments #897
Hide "plan" comments #897
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is really cool, nice work!
Aside from my inline comments I'd like to see:
- This turned on/off via a flag
--hide-prev-plan-comments
- pagination implemented
server/events/vcs/github_client.go
Outdated
// a reasonable one, given we've already filtered the comments by the | ||
// configured Atlantis user. | ||
body := strings.Split(comment.GetBody(), "\n") | ||
if !strings.Contains(body[0], models.ApplyCommand.String()) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should look for "Ran Plan for"
and **Plan Error**
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we need to inject hidden comments in the body. If a plan output is too large, Atlantis seems to split them across comments without a common header.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes but it's super uncommon for that to happen in my experience. I think it's okay to not handle that edge case
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How about we just search for "plan"?
The golang Github client recommends this.
And implement the Github version. The Golang Github client recommends using shurcooL/githubv4.
So that every pull update will auto clean older comments
Co-Authored-By: Luke Kysow <[email protected]>
495a316
to
dcd43be
Compare
Codecov Report
@@ Coverage Diff @@
## master #897 +/- ##
==========================================
- Coverage 71.74% 71.69% -0.06%
==========================================
Files 65 65
Lines 5284 5348 +64
==========================================
+ Hits 3791 3834 +43
- Misses 1199 1216 +17
- Partials 294 298 +4
Continue to review full report at Codecov.
|
} | ||
|
||
for _, comment := range allComments { | ||
if comment.User != nil && comment.User.GetLogin() != g.user { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Was testing this out but running into issues with case sensitive username.
if comment.User != nil && comment.User.GetLogin() != g.user { | |
if comment.User != nil && !strings.EqualFold(comment.User.GetLogin(), g.user) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay I'll add it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is amazing work. I'm really sorry it took so long to review. I've updated it with master in #994 but kept all your commits of course. This will be in the next release 🎉
Addresses #721
Read commit by commit. Attempted to isolate changes.
Did not implement this for other VCS's. Github is my primary concern right now.
This will only hide "plan" comments, because IMO "apply" comments are important enough to have unminimized because they impact actual systems and thus may be useful when people need to audit changes or figure out what/how things broke.
I didn't test the entire flow, but did test my new code in isolation:
See: goodspark/asd#7 for how it ran.