-
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
feat: Add --max-comments-per-command
configuration
#3905
feat: Add --max-comments-per-command
configuration
#3905
Conversation
Hi! This is my first Atlantis PR and is a basic attempt to fix #416. I'd love to have some high-level feedback as to whether this is a reasonable approach that would be accepted before I finish it. So far I've just focused on the top level structure of how to add a new entry; before this could be merged I would write implementations for non-GitHub VCS implementations. |
--max-comments-per-command
configuration--max-comments-per-command
configuration
Allow Atlantis administrators to cap the number of VCS comments that will be created for a single command. (The default value is 0, which means unlimited comments.) If you're trying something like `TF_LOG=debug`, Atlantis can produce so many comments that it becomes challenging to read your PR, or worse still, your VCS might rate-limit Atlantis, effectively breaking your ability to use it for an extended period of time. While this PR does not change the default behavior, it's probably a good idea to set this flag to something like 10. Fixes runatlantis#416.
b611d7c
to
cf12f97
Compare
@glasser thanks for the contribution! I think this is definitely a step in the right direction. I've recently been a bit worried about the growing number of configuration options to Another unrelated concern I have is clipping the end, when likely the last few lines will have a lot more value than the lines in the middle. I'm not sure really how to address that, and that could will be a future improvement, something akin to: golang/go#7181. For example if there are determined to be All that said, certainly some logs are better than the crashing behavior we have now, so I definitely want to pursue this. |
I do like the idea of preserving (say) the last page. That said, you can also view the full log at the web UI anyway, right? Which in practice is what I'd do for any log that triggers this. I was trying to avoid backwards-incompatible changes without any way to even revert it, thus the configuration. If you'd prefer an uncontrollable change, I'd get that. My project will probably limit to 10. |
Yeah good point. Let's leave this as "maybe do" for later.
That's my personal preference, others may differ. We can always make it configurable later if need be, I just want to defer adding a server flag if possible, since those are harder to remove. I personally agree that getting back >10 comments, each with 30k characters of text, feels pretty cumbersome, and users should at that point be encouraged to pursue a different way of saving/shipping logs. |
Ok, cool. I'm not sure how the process works around here -- before I go and rip out the option, is this a relatively solid decision and you're likely to merge the PR, or should we wait for more thoughts? |
@GenPage ,@nitrocode and I are the maintainers and @lukemassa has been helping with a lot of contributions lately. let's wait for us to catch up with this PR in a few weeks. Thanks |
Ah sorry, I should have been more clear; I was just offering my opinion, I don't have any authority on the matter :) I'll let @jamengual take it from here with a recommendation, apologies for not clarifying that. |
all good @lukemassa your input is super valuable to us and is always welcome. I hope next week we could find more time to do reviews, plus we are in the process of changing the release pipeline do is going to take some time. |
Hi, I'm just a regular engineer and I absolutely do not mean to knock the work you've put it. I really appreciate every contributor to this project and it's helped us so much. I think this PR is pretty useful functionality to have, but maybe some minor tweaks. I see a few issues:
These are just my 2c, we do run into this issue sometimes. We would never use |
Sure, it would be reasonable to have a struct for common configuration for creating comments.
It's not being configured separately per SCM, just passed through. (The different SCMs do have different formats for their headers/footers and length limits, which is why the split call is happening inside the SCM code.) |
Totally missed that. awesome, great work. It wouldn't especially help our team / teams (we have 10+ atlantis instances running internally, my team runs 2 - one for dev, one for prod), but what I am seeing is that teams are simply taking the output and persisting it elsewhere via a python script. I (highly) appreciate everyone who has contributed to this project. My ideas were mostly suggestions to spur future thoughts, I don't expect them to make it into your PR or want to complicate things. However middle truncation is kind of a base level functionality. It would almost be better to limit the maximum number of projects that can run, or to allow custom filtering inline. Many different people are using Atlantis. If this would be e.g., a default of 10 comments per atlantis command, e.g., I'm not expecting you to change anything our behalf. Just trying to give some perspective on different use cases in case it's useful. Huge appreciators of the maintainers along with everyone who contributes great useful features like this! |
That seems like a good data point about the question @lukemassa raised as to whether it would be reasonable to have this be a non-configurable hardcoded value (with the answer "no"). |
We would be stuck on whatever version of Atlantis allowed us to use it, I guess :) If there was some sort of mechanism to persist the file logs to "offsite storage" (a bucket seems logical since there are relatively few restrictions beyond access, and it removes the burden of cleanup from Atlantis entirely, let users cleanup their own bucket). Then that would completely resolve any concerns about truncation, number of comments, whatever. Tne logs in the "Detail Link" are kind of a joke unless you're just testing a single module to learn terraform and have time to sit around and watch it. 95% of the time the data is gone by the time we need it. Since Atlantis is in a completely isolated environment, non-admins can't get anywhere near that cluster. I don't think more advanced devops people would care if it was removed entirely for the most part. Our users can't access it and it would be empty if they did. Without persistence, pre/post workflow hooks, stuff like that it's maybe between 0-5% useful in my experience. It's certainly not close to a replacement for the PR comments which are available for more than the 3-4 minutes it takes for the module to run. The single usecase is "my module has been running for 45 minutes and I have no idea what's going on, lets see whats up*. But out of thousands and thousands of deployments we've never actually needed it to debug that issue with those logs (hint: it's network connectivity or you're replacing node groups on an eks cluster). The point there is that those live streaming logs are not a replacement for anything. Possibly "offsite" persistence via s3 could actually make those logs useful, who knows. I really apologize if one of you implemented those. Absolutely nothing personal and I'll buy you a drink next time you're in town. Sorry for being brutally honest |
We have teams persisting to That would remove any pressure on changes to the PR comments, truncationation, formatting anything. No matter what, you'd always be able to refer to the actual unfiltered output. The PR comments are critical right now because you can't do anything without them. They're the source of truth. Full, unaltered text output could become the source of truth, and give more flexibility to alterations in the content of the comments. And hey you probably read those files back in when someone wants to see the output of "job" via the "Show Details" link. Then rather than the constant disappointment that greets users when they see that empty, black screen, there's a chance it could help them solve a problem |
Just to recap since my comments might be interpreted as off-topic. Here here's is gist
There is no fallback right now if Truncation is merged and breaks a 1/10000 use case. Changes to the primary interface with 0 fallbacks are going to be inherently risks. People will come in hot with stuff like "". At least if they're in s3 or somewhere you can tell them to use that instead. like git |
@glasser @brandon-fryslie I'm a bit conflicted by this feature. It is trying to solve a problem that does not pertain to Atlanti's core features, and I will explain why.
Based on that, if you want to debug a run in Atlantis, you should enable debug and use the Detail live logs to see the logs, but I won't recommend running a debug run based on my earlier comment. Atlantis support for external log storage will be better suited for this kind of stuff, where you can send logs to s3, cloud watch, fluentd or any other system instead of your pr comments. You could have a repo server-side config like:
That could point to your log aggregator to then send the log somewhere else to be seen by whoever is trying to debug. That feature does not exist and will be to be built. |
@lukemassa sorry for the back-and-forth. I addressed the first 2 points of your comment. for 3) and 4) I would argue that this would be better in its own PR, as AFAIK no such mechanism exists. Also, I would argue (and plan to do so in my company) that post-plan or post-apply hooks would allow someone to implement such mechanism - for example by uploading the plan / command results to s3. But I doubt we can have a solution baked in atlantis that works for all. So please, could you do another review, and thank you for your feedback! |
…s a valid value that should not be overriden)
@benoittoulme looks good to me! @GenPage if this looks good to you we I'm happy to go ahead and merge. NOTE: If we accept this as is, it'll need to go out in a minor release, and there should be a call in the release notes. This changes default functionality, such that if a user relies on >100 comment long plans, they will need to set this value to 0 to restore the current behavior. Overall I still think we're more likely to fix problems than cause them with this change (famous last words...), so I'm still supportive of the non-backwards compatible approach in this instance, as long as it's properly announced with a description of how to keep prior behavior. |
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.
LGTM, I added the feature
and breaking-change
and removed docs
label which should highlight this in the release notes
@benoittoulme Thanks for finishing this up! (I removed you from my fork.) |
Thanks for all the work everyone put into this. Any idea when this will be getting shipped out? Just tried to use the flag only to realize it's not included in the latest release. |
I believe this will be included into v0.29.0 release, because of the breaking change ( I am also waiting for this release :) ) |
🥳 🎉 https://github.com/runatlantis/atlantis/releases/tag/v0.29.0 |
@benoittoulme Thank you for working on this awesome addition, much appreciated! |
Not intentional, and I have a fix here #4980 |
what
Allow Atlantis administrators to cap the number of VCS comments that will be created for a single command. (The default value is 0, which means unlimited comments.)
why
If you're trying something like
TF_LOG=debug
, Atlantis can produce so many comments that it becomes challenging to read your PR, or worse still, your VCS might rate-limit Atlantis, effectively breaking your ability to use it for an extended period of time. While this PR does not change the default behavior, it's probably a good idea to set this flag to something like 10.tests
Unit tests for
common.SplitComment
. (There doesn't appear to be other tests of comment splitting.)references