Merge "Introduce semantic versioning."

This commit is contained in:
Björn Rabenstein 2014-03-11 18:34:21 +01:00 committed by Gerrit Code Review
commit b7ba349ca8
4 changed files with 23 additions and 5 deletions

View file

@ -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

View file

@ -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

1
VERSION Normal file
View file

@ -0,0 +1 @@
0.1.0

View file

@ -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}}