-
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
Switch build target from main.go to a package. #8342
Conversation
In order to reduce the size of the build container, builds are run without access to the full contents of the .git dir. This prevents golang from being able to determine VCS stamps. We should probably add cc @dereknola |
👀 I am in support of building without the VCS. |
@dlorenc are you up for adding that build flag to this PR? |
This changes the way go embeds versions in the binary. Today, Grype can't determine which k3s version is used in k3s itself because it's built with the file. Here's what a scan looks like: ``` NAME INSTALLED FIXED-IN TYPE VULNERABILITY SEVERITY github.com/k3s-io/k3s (devel) 1.24.17 go-module GHSA-m4hf-6vgr-75r2 High ``` If you make this switch, the scanner can correctly determine the version instead of (devel). Signed-off-by: Dan Lorenc <[email protected]>
Signed-off-by: Derek Nola <[email protected]>
Codecov ReportAll modified lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #8342 +/- ##
===========================================
+ Coverage 19.55% 51.18% +31.62%
===========================================
Files 84 144 +60
Lines 7904 14964 +7060
===========================================
+ Hits 1546 7660 +6114
+ Misses 6123 6093 -30
- Partials 235 1211 +976
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
* Switch build target from main.go to a package. * Dont build with vcs Signed-off-by: Dan Lorenc <[email protected]> Signed-off-by: Derek Nola <[email protected]> Co-authored-by: Derek Nola <[email protected]> (cherry picked from commit 3d25e9f) Signed-off-by: Brad Davidson <[email protected]>
* Switch build target from main.go to a package. * Dont build with vcs Signed-off-by: Dan Lorenc <[email protected]> Signed-off-by: Derek Nola <[email protected]> Co-authored-by: Derek Nola <[email protected]> (cherry picked from commit 3d25e9f) Signed-off-by: Brad Davidson <[email protected]>
* Switch build target from main.go to a package. * Dont build with vcs Signed-off-by: Dan Lorenc <[email protected]> Signed-off-by: Derek Nola <[email protected]> Co-authored-by: Derek Nola <[email protected]> (cherry picked from commit 3d25e9f) Signed-off-by: Brad Davidson <[email protected]>
* Switch build target from main.go to a package. * Dont build with vcs Signed-off-by: Dan Lorenc <[email protected]> Signed-off-by: Derek Nola <[email protected]> Co-authored-by: Derek Nola <[email protected]> (cherry picked from commit 3d25e9f) Signed-off-by: Brad Davidson <[email protected]>
* Switch build target from main.go to a package. * Dont build with vcs Signed-off-by: Dan Lorenc <[email protected]> Signed-off-by: Derek Nola <[email protected]> Co-authored-by: Derek Nola <[email protected]> (cherry picked from commit 3d25e9f) Signed-off-by: Brad Davidson <[email protected]>
* Switch build target from main.go to a package. * Dont build with vcs Signed-off-by: Dan Lorenc <[email protected]> Signed-off-by: Derek Nola <[email protected]> Co-authored-by: Derek Nola <[email protected]> (cherry picked from commit 3d25e9f) Signed-off-by: Brad Davidson <[email protected]>
* Switch build target from main.go to a package. * Dont build with vcs Signed-off-by: Dan Lorenc <[email protected]> Signed-off-by: Derek Nola <[email protected]> Co-authored-by: Derek Nola <[email protected]> (cherry picked from commit 3d25e9f) Signed-off-by: Brad Davidson <[email protected]>
Proposed Changes
This changes the way go embeds versions in the binary. Today, Grype can't determine which k3s version is used in k3s itself because it's built with the file. Here's what a scan looks like:
If you make this switch, the scanner can correctly determine the version instead of (devel).
Types of Changes
Bugfix
Verification
Build k3s and scan it.
Testing
Linked Issues
User-Facing Change
Further Comments