Skip to content

fix(release): wire version into release builds#388

Open
omribz156 wants to merge 1 commit into
Checkmarx:masterfrom
omribz156:codex/release-version-wiring
Open

fix(release): wire version into release builds#388
omribz156 wants to merge 1 commit into
Checkmarx:masterfrom
omribz156:codex/release-version-wiring

Conversation

@omribz156
Copy link
Copy Markdown

Closes #360

Proposed Changes

The release builds were passing -X github.com/checkmarx/2ms/cmd.Version=$VERSION, but the module path is github.com/checkmarx/2ms/v5, so the linker never updated the actual cmd.Version variable and released binaries kept the default 0.0.0.

This PR:

  • updates the release workflow linker paths to github.com/checkmarx/2ms/v5/cmd.Version,
  • passes the computed release version into the Docker build,
  • wires the Dockerfile build to set the same cmd.Version variable, and
  • fixes the release workflow target_commitish expression to use github.sha instead of a missing step output, so the touched workflow passes actionlint.

Verification:

  • go test ./cmd -run TestVersionFlagExitZero -count=1
  • go 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.7
  • go 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.0
  • actionlint .github\workflows\release.yml
  • git diff --check

I also tried go test ./.... It still fails locally in Windows/environment-sensitive scan/e2e tests (pkg output ordering/expectation mismatch and tests temp 2ms executable 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 covered my changes with tests.
  • I Updated the documentation that is affected by my changes:
    • Change in the CLI arguments
    • Change in the configuration file

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.

@omribz156 omribz156 requested a review from a team as a code owner May 21, 2026 13:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

bug(unix): missing version number for unix

1 participant