-
Notifications
You must be signed in to change notification settings - Fork 56
/
Makefile
34 lines (26 loc) · 1.21 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
BUILDINFO = github.com/prometheus/common/version
VERSION = $(shell git describe --always --tags --dirty=-dirty)
REVISION = $(shell git rev-parse HEAD)
BRANCH = $(shell git rev-parse --abbrev-ref HEAD)
DOCKER_REPO = carlpett
DOCKER_IMAGE_NAME = zookeeper_exporter
DOCKER_IMAGE_TAG = ${VERSION}
all: build
build:
@echo ">> building zookeeper_exporter"
@CGO_ENABLED=0 go build -ldflags "\
-X ${BUILDINFO}.Version=${VERSION} \
-X ${BUILDINFO}.Revision=${REVISION} \
-X ${BUILDINFO}.Branch=${BRANCH} \
-X ${BUILDINFO}.BuildUser=$(USER)@$(HOSTNAME) \
-X ${BUILDINFO}.BuildDate=$(shell date +%Y-%m-%dT%T%z)"
docker:
@echo ">> building docker image ${DOCKER_REPO}/${DOCKER_IMAGE_NAME}:${DOCKER_IMAGE_TAG}"
@docker build -t ${DOCKER_REPO}/${DOCKER_IMAGE_NAME}:${DOCKER_IMAGE_TAG} .
release: build bin/github-release
@echo ">> uploading release ${VERSION}"
@./bin/github-release upload -t ${VERSION} -n zookeeper_exporter -f zookeeper_exporter
bin/github-release:
@mkdir -p bin
@curl -sL 'https://github.com/aktau/github-release/releases/download/v0.6.2/linux-amd64-github-release.tar.bz2' | tar xjf - --strip-components 3 -C bin
.PHONY: all build docker release