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

Add go buildinfo to velero to check toolchain version used. #8398

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

kaovilai
Copy link
Contributor

@kaovilai kaovilai commented Nov 12, 2024

Thank you for contributing to Velero!

Please add a summary of your change

Does your change fix a particular issue?

Facilitates requirements similar to #8397 that may come up in the future.
Helps validate go version used to build given that go.mod or commit hash of a built binary do not tell you this information.

Please indicate you've done the following:

Copy link

codecov bot commented Nov 12, 2024

Codecov Report

Attention: Patch coverage is 10.00000% with 9 lines in your changes missing coverage. Please review.

Project coverage is 58.93%. Comparing base (8e23752) to head (ff8496c).
Report is 4 commits behind head on main.

Files with missing lines Patch % Lines
pkg/buildinfo/buildinfo.go 0.00% 8 Missing ⚠️
pkg/cmd/server/server.go 0.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #8398      +/-   ##
==========================================
- Coverage   58.96%   58.93%   -0.03%     
==========================================
  Files         367      367              
  Lines       38895    38911      +16     
==========================================
+ Hits        22933    22934       +1     
- Misses      14500    14515      +15     
  Partials     1462     1462              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@kaovilai kaovilai changed the title Add go buildinfo to velero to assist with #8397 Add go buildinfo to velero to check tool chain version used. Nov 12, 2024
@kaovilai kaovilai changed the title Add go buildinfo to velero to check tool chain version used. Add go buildinfo to velero to check toolchain version used. Nov 13, 2024
Signed-off-by: Tiger Kaovilai <tkaovila@redhat.com>
@@ -69,6 +69,7 @@ func printVersion(w io.Writer, clientOnly bool, kbClient kbclient.Client, server
fmt.Fprintln(w, "Client:")
fmt.Fprintf(w, "\tVersion: %s\n", buildinfo.Version)
fmt.Fprintf(w, "\tGit commit: %s\n", buildinfo.FormattedGitSHA())
fmt.Fprintf(w, "\tGo version: %s\n", buildinfo.GoVersion())
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this clear enough that it is not user's local go? do we want to say Built by Go Version instead?


var (
// Version is the current version of Velero, set by the go linker's -X flag at build time.
Version string

// goVersion is the version of Go that was used to build Velero
goBuildInfo *debug.BuildInfo
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this necessary?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To be able to tell which golang version was used to build the code which can have implications around CVEs verification. ie someone built from a certain velero branch but used a different golang version. ie. #8397

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Dependencies Pull requests that update a dependency file has-changelog has-unit-tests
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants