ribbybibby / ssl_exporter

Exports Prometheus metrics for TLS certificates
Apache License 2.0
520 stars 97 forks source link

Release assets don't include version info #26

Closed britcey closed 4 years ago

britcey commented 4 years ago

A minor issue, but the pre-built binaries don't include release info:

ssl_exporter_1.0.0_darwin_amd64> ./ssl_exporter --version
ssl_exporter, version  (branch: , revision: )
  build user:
  build date:
  go version:       go1.13.8

Building locally does the right thing:

github.com/ribbybibby/ssl_exporter(master|✔)> ./ssl_exporter --version
ssl_exporter, version 1.0.0 (branch: master, revision: b7cdf6249339e74aa88564c1dbc7d18e4bdbcb5e)
  build user:       britcey@imac.local
  build date:       20200513-13:35:56
  go version:       go1.14.2

So not sure what's being missed in the release process.

Thanks for this useful exporter!

ribbybibby commented 4 years ago

Hi @britcey, thanks for pointing this out!

It seems like the issue here is that the Makefile uses promu (the prometheus build tool) to generate binaries whereas the release process uses goreleaser. The former injects the version information into the binary, while the latter (currently) does not.

I should really standardise the build process to avoid these differences. Watch this space.

britcey commented 4 years ago

If it helps, I happened to have built node_exporter w/o using promu and figured out how to hack in that info - from my Makefile:

LDFLAGS := -X github.com/prometheus/common/version.Version=$(VERSION) \
             -X github.com/prometheus/common/version.Revision=$(REVISION) \
             -X github.com/prometheus/common/version.Branch=$(BRANCH) \
             -X github.com/prometheus/common/version.BuildUser=foo@example.com \
             -X github.com/prometheus/common/version.BuildDate=$(shell date +%Y%m%d-%H:%M:%S) \

go build -ldflags "$(LDFLAGS)"

HTH

ribbybibby commented 4 years ago

Fixed in v1.0.1.