Add release tar ball support.

This commit is contained in:
Random-Liu
2017-01-13 11:13:59 -08:00
parent 7dbff0d82e
commit 6637139441
5 changed files with 39 additions and 15 deletions
+1 -1
View File
@@ -1 +1 @@
/node-problem-detector
/bin/node-problem-detector
+4 -1
View File
@@ -5,6 +5,9 @@ dist: trusty
language: go
go:
- 1.6
- 1.7
services:
- docker
before_install:
- sudo apt-get -qq update
- sudo apt-get install -y libsystemd-journal-dev
@@ -14,4 +17,4 @@ install:
- cd $HOME/gopath/src/k8s.io/node-problem-detector
script:
- make test
- make node-problem-detector
- make
+1 -1
View File
@@ -14,6 +14,6 @@
FROM alpine:3.4
MAINTAINER Random Liu <lantaol@google.com>
ADD ./node-problem-detector /node-problem-detector
ADD ./bin/node-problem-detector /node-problem-detector
ADD config /config
ENTRYPOINT ["/node-problem-detector", "--kernel-monitor=/config/kernel-monitor.json"]
+32 -11
View File
@@ -1,17 +1,25 @@
.PHONY: all container push clean node-problem-detector vet fmt version
.PHONY: all build-container build-tar build push-container push-tar push clean vet fmt version
all: push
all: build
VERSION := $(shell git describe --tags --dirty)
TAG ?= $(VERSION)
PROJ = google_containers
UPLOAD_PATH ?= gs://kubernetes-release
# Trim the trailing '/' in the path
UPLOAD_PATH := $(shell echo $(UPLOAD_PATH) | sed '$$s/\/*$$//')
PROJ ?= google_containers
PKG := k8s.io/node-problem-detector
PKG_SOURCES := $(shell find pkg cmd -name '*.go')
TARBALL := node-problem-detector-$(VERSION).tar.gz
IMAGE := gcr.io/$(PROJ)/node-problem-detector:$(TAG)
vet:
go list ./... | grep -v "./vendor/*" | xargs go vet
@@ -21,19 +29,32 @@ fmt:
version:
@echo $(VERSION)
node-problem-detector: $(PKG_SOURCES) fmt vet
GOOS=linux go build -o node-problem-detector \
./bin/node-problem-detector: $(PKG_SOURCES)
GOOS=linux go build -o bin/node-problem-detector \
-ldflags '-w -extldflags "-static" -X $(PKG)/pkg/version.version=$(VERSION)' \
cmd/node_problem_detector.go
test:
test: vet fmt
go test -timeout=1m -v -race ./pkg/...
container: node-problem-detector
docker build -t gcr.io/$(PROJ)/node-problem-detector:$(TAG) .
build-container: ./bin/node-problem-detector
docker build -t $(IMAGE) .
push: container
gcloud docker push gcr.io/$(PROJ)/node-problem-detector:$(TAG)
build-tar: ./bin/node-problem-detector
tar -zcvf $(TARBALL) bin/ config/
sha1sum $(TARBALL)
md5sum $(TARBALL)
build: build-container build-tar
push-container: build-container
gcloud docker push $(IMAGE)
push-tar: build-tar
gsutil cp $(TARBALL) $(UPLOAD_PATH)/node-problem-detector/
push: push-container push-tar
clean:
rm -f node-problem-detector
rm -f bin/node-problem-detector
rm -f node-problem-detector-*.tar.gz
+1 -1
View File
@@ -15,7 +15,7 @@ package version
import "fmt"
// version defines the version
// version defines node-problem-detector version string.
var version string = "UNKNOWN"
func PrintVersion() {