fix(release): wire version into release builds#388
Open
omribz156 wants to merge 1 commit into
Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #360
Proposed Changes
The release builds were passing
-X github.com/checkmarx/2ms/cmd.Version=$VERSION, but the module path isgithub.com/checkmarx/2ms/v5, so the linker never updated the actualcmd.Versionvariable and released binaries kept the default0.0.0.This PR:
github.com/checkmarx/2ms/v5/cmd.Version,cmd.Versionvariable, andtarget_commitishexpression to usegithub.shainstead of a missing step output, so the touched workflow passesactionlint.Verification:
go test ./cmd -run TestVersionFlagExitZero -count=1go build -buildvcs=false -ldflags "-s -w -X github.com/checkmarx/2ms/v5/cmd.Version=9.8.7" -o artifacts-2ms-version-test.exe main.go; .\artifacts-2ms-version-test.exe --version->2ms version 9.8.7go build -buildvcs=false -ldflags "-s -w -X github.com/checkmarx/2ms/cmd.Version=9.8.7" -o artifacts-2ms-version-wrong-path.exe main.go; .\artifacts-2ms-version-wrong-path.exe --version->2ms version 0.0.0actionlint .github\workflows\release.ymlgit diff --checkI also tried
go test ./.... It still fails locally in Windows/environment-sensitive scan/e2e tests (pkgoutput ordering/expectation mismatch andteststemp2msexecutable lookup), while the packages unrelated to those checks pass. I did not run a Docker image build locally to avoid the heavier image download/build path.Checklist
I submit this contribution under the Apache-2.0 license.
This was implemented with Codex assistance, with the source trace and final diff manually reviewed before sending.