-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Add buildinfo flag #6286
Add buildinfo flag #6286
Conversation
0312ed4
to
b5fe72d
Compare
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.
IMO it is a pretty niche desire for wanting to read the build info if you do not have Go installed. That said, I suppose there is no harm in adding a CLI option as long as it does not introducing breaking changes.
35633e8
to
a448c14
Compare
Signed-off-by: Alex Bozhenko <[email protected]>
a448c14
to
f01098b
Compare
Signed-off-by: Alex Bozhenko <[email protected]>
f01098b
to
70443b5
Compare
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
Like @bruth not really sure of the use case here. We'd get better milage from publishing a SBOM in the industry standard format. |
@ripienaar: the use case is to find out what kind of binary I am dealing with. |
I understand why you would want it @alexbozhenko - but this is not something anyone else have asked for. So as a developer I can see the use case, but then I'd just run What I wouldn't do is expose developer specific information as flags to end users who would only find it adds more UI clutter and surprising or confusing output. So my question really is: As a end-user, how is this useful? |
@ripienaar
Other tools expose additional info about how binary was built too: |
The linked user issue is a case of the binary not being downloaded at all - how would the flag have helped there?
Again, I understand this makes the information easy to find - I am wondering what the end user utility of this information is, the CLI flags to ants-server is end user interface, not developer user interface so we need to frame these kinds of additions in the light of end users |
Here is how I thought the flag can be beneficial for the user in this case:
Or, let's imagine we decided to tune some other flag(existing or some future one). Let's say we start to build with GOAMD64=v4. And let's say such binary crashes for some users. If we make it easier to figure out the reason - that would be great. That's why I would like to have buildinfo exposed for the users. Answering the question "What kind of binary I am dealing with" is a valid user concern. And our users are developers, so they won't consider this info clutter... |
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.
Added some comments, also think might be too niche but could be convenient when trying to get on the same page with users when reproducing issues to get the build info from the Go version used to build it just in case instead of the Go version that might be available locally or when do not have one at hand.
It's either going to fail to run if its the wrong architecture or in some cases like some ARM combos you can just check it in the case that it would run:
It seems very contrived to have to add this imo, super niche need, minimal utility to end users. As we only support binaries released officially, none of these buildinfo checks would tell you if this is a supported version / build or not - verifying signatures, checksums against GitHub etc, those are the only ways. |
@ripienaar I updated to hide the helpfrom the users, is it a good compromise? It may be useful for us in support, so could we plase have it there? Users won't see it, and won't be confused... |
Hiding the flag is better. I think with 3 out of 3 reviewers voicing concern about the validity of the feature there may be an opportunity to take step back and see if this can be done in a more Idiomatic way. We don’t tend to expose useful info only on the command line |
maybe this would be better suited to report via varz? there is some buildinfo in that struct too |
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
Another option would be to have something like a |
varz would be better than command line but I think doing that could be very undesirable in some embedded uses, people might be embedding sensitive information into their binaries using linker flags that will then become exposed we should hear from the support team if this is really needed for their purposes @jarretlavallee |
Users may want to see how the binary was built, why this is not a valid use case?
But
Why? With We removed it from the usage text so that the flag will be hidden. So your concern about "cluttering the UI" is addressed. Now it seems like you just do not want me to add it... We can do
I am on the support team as well, and I thought it is going to be useful. This PR is literally 20 lines, I do not know what we argue about. |
When adding information to the NATS Server we have worked hard to do so in a way that supports our eco system of tools - this means adding it to the network queryable endpoints. This is there to support tools like This is not something we take lightly, we've invested many months of development time in these efforts and its the central enabler for many tools and features. It's how we do things, it's what is idiomatic in our eco system. Every bit of new code is code that requires maintenance and considerations around security exposure and more. So it's important that we add things that are really needed and that we consider them from all angles like their utility and security. So to your questions:
It's valuable to bring up these kinds of feature requests in meetings like the Field Ops discussions where background information can be obtained and methodologies shared so that implementations are done in line with our expectations, a bit of discussing ahead of time will yield much better outcomes for the time you invest in PRs As you say its 20 lines of code, it would be much more valuable if implemented in a way in line with how the project approach these kinds of features and thus supporting our wider eco system at the same time. |
Just to ad my two cents - I feel that if that went through ADR proposal followed up by a short discussion we would reach the consensus quicker. Let's chat about it. |
Thanks, @ripienaar. Ok, closing. |
Use https://pkg.go.dev/runtime/debug#BuildInfo to see all the knobs that were used to build the binary, including the Go toolchain version, https://go.dev/doc/godebug values, etc...
This information is already available through
go version -m path/to/binary
But it will be more convenient to have it available without Go installed(which is most likely the case in production)
Test plan:
go build .
./nats-server -buildinfo
./nats-server --buildinfo
Return:
Signed-off-by: Alex Bozhenko [email protected]