diff --git a/Makefile b/Makefile index b187d896b..f2b7c7ff0 100644 --- a/Makefile +++ b/Makefile @@ -34,8 +34,19 @@ build: config dependencies model preparation tools web docker: build docker build -t prometheus:$(REV) . -tarball: build - tar -C $(BUILD_PATH)/package -czf prometheus.tar.gz . +tarball: $(ARCHIVE) + +$(ARCHIVE): build + tar -C $(BUILD_PATH)/package -czf $(ARCHIVE) . + +release: REMOTE ?= $(error "can't upload, REMOTE not set") +release: REMOTE_DIR ?= $(error "can't upload, REMOTE_DIR not set") +release: $(ARCHIVE) + scp $< $(REMOTE):$(REMOTE_DIR)/ + +tag: + git tag $(VERSION) + git push --tags $(BUILD_PATH)/cache/$(GOPKG): curl -o $@ $(GOURL)/$(GOPKG) @@ -101,4 +112,4 @@ update: web: config dependencies model preparation $(MAKE) -C web -.PHONY: advice binary build clean config dependencies documentation format model package preparation race_condition_binary race_condition_run run search_index tarball test tools update +.PHONY: advice binary build clean config dependencies documentation format model preparation race_condition_binary race_condition_run release run search_index tag tarball test tools update diff --git a/Makefile.INCLUDE b/Makefile.INCLUDE index 856449359..0c98b75a7 100644 --- a/Makefile.INCLUDE +++ b/Makefile.INCLUDE @@ -78,12 +78,14 @@ BREW_INSTALL := brew install # Set WGET_OPTIONS to include ``--no-use-server-timestamps`` to alleviate this. WGET := wget $(WGET_OPTIONS) -c +VERSION := $(shell cat VERSION) REV := $(shell git rev-parse --short HEAD) BRANCH := $(shell git rev-parse --abbrev-ref HEAD) HOSTNAME := $(shell hostname -f) BUILD_DATE := $(shell date +%Y%m%d-%H:%M:%S) BUILDFLAGS := -ldflags \ - " -X main.buildVersion $(REV)\ + " -X main.buildVersion $(VERSION)\ + -X main.buildRevision $(REV)\ -X main.buildBranch $(BRANCH)\ -X main.buildUser $(USER)@$(HOSTNAME)\ -X main.buildDate $(BUILD_DATE)\ @@ -93,3 +95,5 @@ BUILDFLAGS := -ldflags \ -X main.snappyVersion $(SNAPPY_VERSION)" PROTOC := $(LOCAL_BINARIES)/protoc + +ARCHIVE := prometheus-$(VERSION).$(GOOS)-$(GOARCH).tar.gz diff --git a/VERSION b/VERSION new file mode 100644 index 000000000..6e8bf73aa --- /dev/null +++ b/VERSION @@ -0,0 +1 @@ +0.1.0 diff --git a/build_info.go b/build_info.go index 52cd47686..3d3fb3e45 100644 --- a/build_info.go +++ b/build_info.go @@ -20,6 +20,7 @@ import ( // Build information. Populated by Makefile. var ( buildVersion string + buildRevision string buildBranch string buildUser string buildDate string @@ -33,6 +34,7 @@ var ( // via go tool ld such that this can be reported on-demand. var BuildInfo = map[string]string{ "version": buildVersion, + "revision": buildRevision, "branch": buildBranch, "user": buildUser, "date": buildDate, @@ -43,7 +45,7 @@ var BuildInfo = map[string]string{ } var versionInfoTmpl = template.Must(template.New("version").Parse( - `prometheus, version {{.version}} ({{.branch}}) + `prometheus, version {{.version}} (branch: {{.branch}}, revision: {{.revision}}) build user: {{.user}} build date: {{.date}} go version: {{.go_version}}