-
Notifications
You must be signed in to change notification settings - Fork 2.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
feat(server): add version endpoint #4869
Conversation
@knqyf263 Have an idea where we can place the Is this a suitable place in the documentation where we can add information about endpoints? |
We may want to add a new package Line 17 in 0707569
We also need to update the version embedding. Line 9 in 0707569
Yes. |
pkg/version/version.go
Outdated
) | ||
|
||
var ( | ||
Version = "dev" |
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 want to make it read-only.
Version = "dev" | |
version = "dev" |
Then, can we add Version() string
or AppVersion() string
?
pkg/version/version.go
Outdated
PolicyBundle *policy.Metadata `json:",omitempty"` | ||
} | ||
|
||
func formatDbMetadata(title string, meta metadata.Metadata) 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.
nit: https://github.com/golang/go/wiki/CodeReviewComments#initialisms
func formatDbMetadata(title string, meta metadata.Metadata) string { | |
func formatDBMetadata(title string, meta metadata.Metadata) string { |
pkg/version/version.go
Outdated
return output | ||
} | ||
|
||
func BuildVersionInfo(appVersion string, cacheDir string) VersionInfo { |
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.
nit:
func BuildVersionInfo(appVersion string, cacheDir string) VersionInfo { | |
func NewVersionInfo(appVersion string, cacheDir string) VersionInfo { |
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.
Also, do we need to pass appVersion
here? There is a version info in this package?
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.
You also need to update magefile
Line 40 in e1c2a8c
return fmt.Sprintf("-s -w -X=main.version=%s", ver), nil |
Description
Added an endpoint to get the trivy and db versions.
Example output:
Related issues
Checklist