Skip to content

Commit b5302de

Browse files
PMM-11312 --version (#8)
1 parent 61e6677 commit b5302de

File tree

3 files changed

+10
-1
lines changed

3 files changed

+10
-1
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
/bin
22
*.DS_Store
33
azure_metrics_exporter
4+
azure_exporter
45
azure.yml
56
notes.txt

Makefile

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,10 @@ DOCKER_REPO ?= robustperception
2121
DOCKER_IMAGE_NAME ?= azure_metrics_exporter
2222
DOCKER_IMAGE_TAG ?= $(subst /,-,$(shell git rev-parse --abbrev-ref HEAD))
2323

24+
GO_BUILD_LDFLAGS = -X github.com/prometheus/common/version.Version=$(shell cat VERSION) -X github.com/prometheus/common/version.Revision=$(shell git rev-parse HEAD) -X github.com/prometheus/common/version.Branch=$(shell git describe --always --contains --all) -X github.com/prometheus/common/version.BuildUser= -X github.com/prometheus/common/version.BuildDate=$(shell date +%FT%T%z) -s -w
25+
26+
export PMM_RELEASE_PATH?=.
27+
2428
all: format build test
2529

2630
test: build
@@ -56,4 +60,7 @@ promu:
5660
GOARCH=$(subst x86_64,amd64,$(patsubst i%86,386,$(shell uname -m))) \
5761
$(GO) get -u github.com/prometheus/promu
5862

59-
.PHONY: all style format build test vet tarball docker promu
63+
release:
64+
go build -ldflags="$(GO_BUILD_LDFLAGS)" -o $(PMM_RELEASE_PATH)/azure_exporter
65+
66+
.PHONY: all style format build test vet tarball docker promu

main.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -330,6 +330,7 @@ func handler(w http.ResponseWriter, r *http.Request) {
330330
func main() {
331331
kingpin.HelpFlag.Short('h')
332332
log.AddFlags(kingpin.CommandLine)
333+
kingpin.Version(version.Print("azure_exporter"))
333334
kingpin.Parse()
334335
if err := sc.ReloadConfig(*configFile); err != nil {
335336
log.Fatalf("Error loading config: %v", err)

0 commit comments

Comments
 (0)