-
Notifications
You must be signed in to change notification settings - Fork 520
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
🌱 remove OS and Arch info from scorecard release binary name #4520
Conversation
Previously binaries were created with their architecture and OS included as part of their binary name. Removing the `binary: scorecard-<linux|darwin|windows>-{{ .Arch }}` line allows us to collapse all of the different build configs into a single universal build that caters for [linux,darwin,windos]*[arm64,amd64] `- -buildmode=exe` was not needed on the windows builds and was also removed. closes ossf#4517 Signed-off-by: Tim Sparg <[email protected]>
As per https://goreleaser.com/deprecations#snapshotname_template `snapshot.name_template` has been replaced with `snapshot.version_template` Signed-off-by: Tim Sparg <[email protected]>
After change
|
I'm not well versed in that option, can you elaborate on this change? I'm not saying we need it, just trying to understand. It slightly changes the size of
It seems like |
Although in both cases (with and without specifying the flag) I see the binary is build with go version -m scorecard.exe | grep buildmode
build -buildmode=exe |
I could claim omniscience and say I expected it to do that, but really I'm just left scratching my head. I tried to get a better understanding of what was going on with the different buildmodes, and I now just feel like I'm missing something. current goreleaser output (default buildmode)Steps to recreate
Expectation
Output
Updated goreleaser outputSteps to recreate
Expectation
Output
Updated goreleaser output using pie buildmodeSteps to recreate
Expectation
Output
Duh momentWhat I realised at this point is that the buildmode wasn't making any difference 🙄 I took a step back and had a looked at the goreleaser docs and saw that - id: universal
flags:
- -trimpath
- -tags=netgo
mod_timestamp: '{{ .CommitTimestamp }}'
goos:
- linux
- darwin
- windows
goarch:
- amd64
- arm64
ldflags:
- -s {{.Env.VERSION_LDFLAGS}}
buildmode: pie given this configuration I now get the following output
Thoughts
Are there any reason we shouldn't just set the buildmode to pie? |
It is though, hence the size difference. file scorecard.exe
scorecard.exe: PE32+ executable (console) x86-64, for MS Windows, 8 sections with file scorecard.exe
scorecard.exe: PE32+ executable (console) x86-64, for MS Windows, 7 sections The missing PE section is
It produces dynamic libraries instead of static on linux. Let's keep the default buildmode for now. |
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.
Looks good thanks, appreciate the deduplication.
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #4520 +/- ##
==========================================
+ Coverage 66.80% 68.46% +1.65%
==========================================
Files 230 246 +16
Lines 16602 18444 +1842
==========================================
+ Hits 11091 12627 +1536
- Misses 4808 4991 +183
- Partials 703 826 +123 |
@spencerschrock 🤦 I was fixated on why I wasn't seeing pie vs exe in the builder and completely stopped looking at the numbers... talk about missing the forest for the trees! |
* feat: create binary without OS and arch in name Previously binaries were created with their architecture and OS included as part of their binary name. Removing the `binary: scorecard-<linux|darwin|windows>-{{ .Arch }}` line allows us to collapse all of the different build configs into a single universal build that caters for [linux,darwin,windos]*[arm64,amd64] `- -buildmode=exe` was not needed on the windows builds and was also removed. closes ossf#4517 Signed-off-by: Tim Sparg <[email protected]> * fix: resolve name_template deprecation As per https://goreleaser.com/deprecations#snapshotname_template `snapshot.name_template` has been replaced with `snapshot.version_template` Signed-off-by: Tim Sparg <[email protected]> --------- Signed-off-by: Tim Sparg <[email protected]> Signed-off-by: balteravishay <[email protected]>
What kind of change does this PR introduce?
release config
What is the current behavior?
scorecard_5.0.0_darwin_amd64
scorecard_5.0.0_darwin_arm64
scorecard_5.0.0_linux_amd64
scorecard_5.0.0_linux_arm64
scorecard_5.0.0_windows_amd64.exe
scorecard_5.0.0_windows_arm64.exe
What is the new behavior (if this is a feature change)?**
There will be a single binary called
scorecard
, or for windowsscorecard.exe
Which issue(s) this PR fixes
Fixes #4517
Special notes for your reviewer
Does this PR introduce a user-facing change?
For user-facing changes, please add a concise, human-readable release note to
the
release-note
(In particular, describe what changes users might need to make in their
application as a result of this pull request.)