mirror of
https://github.com/enix/x509-certificate-exporter.git
synced 2026-02-14 18:10:01 +00:00
feat: binaries know their build date and commit hash
Will be used for a future metric reporting exporter infos.
This commit is contained in:
@@ -19,8 +19,11 @@ ENV GOOS=${TARGETOS}
|
||||
ENV GOARCH=${TARGETARCH}
|
||||
|
||||
ARG VERSION="0.0.0"
|
||||
|
||||
RUN go build -tags netgo,osusergo -ldflags "-X \"github.com/enix/x509-certificate-exporter/v3/internal.Version=${VERSION}\"" ./cmd/x509-certificate-exporter
|
||||
-tags netgo,osusergo \
|
||||
-ldflags "-X \"github.com/enix/x509-certificate-exporter/v3/internal.Version=${VERSION}\" \
|
||||
-X \"github.com/enix/x509-certificate-exporter/v3/internal.CommitHash=${VCS_REF}\" \
|
||||
-X \"github.com/enix/x509-certificate-exporter/v3/internal.BuildDateTime=$(date -u -Iseconds)\"" \
|
||||
./cmd/x509-certificate-exporter
|
||||
|
||||
|
||||
## Production Stage
|
||||
|
||||
@@ -109,7 +109,7 @@ func main() {
|
||||
}
|
||||
}
|
||||
|
||||
log.Infof("starting %s version %s", path.Base(os.Args[0]), internal.Version)
|
||||
log.Infof("starting %s version %s (%s) (%s)", path.Base(os.Args[0]), internal.Version, internal.CommitHash, internal.BuildDateTime)
|
||||
rand.Seed(time.Now().UnixNano())
|
||||
exporter.ListenAndServe()
|
||||
}
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
package internal
|
||||
|
||||
// Version is the exporter semantic version and is set at link time
|
||||
// Version and build informations set at link time
|
||||
var Version = "0.0.0"
|
||||
var CommitHash = ""
|
||||
var BuildDateTime = ""
|
||||
|
||||
Reference in New Issue
Block a user