Closed jackgopack4 closed 1 month ago
Hey @jackgopack4, I'm a bot designed to help you solve bugs, answer questions, and become a contributor. I'm here to assist you while waiting for a human maintainer. 🤖
The OCB binary on version 0.107.0 and onward shows "devel" instead of the appropriate version number because the go install
command used in the Makefile does not specify the version correctly. The -ldflags
option should include the version information, but it is currently set to -s -w
which strips debug information and reduces binary size, but does not set the version.
Here is the relevant part of the Makefile:
CGO_ENABLED=0 go install -trimpath -ldflags="-s -w" go.opentelemetry.io/collector/cmd/builder@v$(OTELCOL_BUILDER_VERSION)
To fix this, you need to modify the -ldflags
to include the version information. For example:
CGO_ENABLED=0 go install -trimpath -ldflags="-s -w -X main.version=$(OTELCOL_BUILDER_VERSION)" go.opentelemetry.io/collector/cmd/builder@v$(OTELCOL_BUILDER_VERSION)
This will embed the version number into the binary, ensuring that it shows the correct version instead of "devel" [1].
To continue talking to Dosu, mention @dosu.
I believe our goreleaser file isn't correct. It is missing:
ldflags:
- -s -w -X go.opentelemetry.io/collector/cmd/builder/internal.version={{.Version}} -X go.opentelemetry.io/collector/cmd/builder/internal.date={{.Date}}
yes @TylerHelmuth you're right; working on the PR to re-add that. Also had to submit a PR for opentelemetry-collector; some code was removed in version.go that was actually enabling setting/viewing the version number when running the binary: https://github.com/open-telemetry/opentelemetry-collector/pull/11208
https://github.com/open-telemetry/opentelemetry-collector-releases/pull/665 still needs to be merged in order to fix version before v0.111.0
After merging #608 and releasing ocb version v0.107.0, ocb binary no longer shows the version and date from v0.106.1 and earlier, instead displaying
devel
Issue first raised by @Tim Chan on the CNCF Slack: