Skip to content

Commit 1202ed0

Browse files
authored
Merge pull request #74 from Random-Liu/add-tarball-release
Add release tarball
2 parents 7dbff0d + 6637139 commit 1202ed0

File tree

5 files changed

+39
-15
lines changed

5 files changed

+39
-15
lines changed

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
/node-problem-detector
1+
/bin/node-problem-detector

.travis.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@ dist: trusty
55
language: go
66
go:
77
- 1.6
8+
- 1.7
9+
services:
10+
- docker
811
before_install:
912
- sudo apt-get -qq update
1013
- sudo apt-get install -y libsystemd-journal-dev
@@ -14,4 +17,4 @@ install:
1417
- cd $HOME/gopath/src/k8s.io/node-problem-detector
1518
script:
1619
- make test
17-
- make node-problem-detector
20+
- make

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,6 @@
1414

1515
FROM alpine:3.4
1616
MAINTAINER Random Liu <[email protected]>
17-
ADD ./node-problem-detector /node-problem-detector
17+
ADD ./bin/node-problem-detector /node-problem-detector
1818
ADD config /config
1919
ENTRYPOINT ["/node-problem-detector", "--kernel-monitor=/config/kernel-monitor.json"]

Makefile

Lines changed: 32 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,25 @@
1-
.PHONY: all container push clean node-problem-detector vet fmt version
1+
.PHONY: all build-container build-tar build push-container push-tar push clean vet fmt version
22

3-
all: push
3+
all: build
44

55
VERSION := $(shell git describe --tags --dirty)
66

77
TAG ?= $(VERSION)
88

9-
PROJ = google_containers
9+
UPLOAD_PATH ?= gs://kubernetes-release
10+
# Trim the trailing '/' in the path
11+
UPLOAD_PATH := $(shell echo $(UPLOAD_PATH) | sed '$$s/\/*$$//')
12+
13+
PROJ ?= google_containers
1014

1115
PKG := k8s.io/node-problem-detector
1216

1317
PKG_SOURCES := $(shell find pkg cmd -name '*.go')
1418

19+
TARBALL := node-problem-detector-$(VERSION).tar.gz
20+
21+
IMAGE := gcr.io/$(PROJ)/node-problem-detector:$(TAG)
22+
1523
vet:
1624
go list ./... | grep -v "./vendor/*" | xargs go vet
1725

@@ -21,19 +29,32 @@ fmt:
2129
version:
2230
@echo $(VERSION)
2331

24-
node-problem-detector: $(PKG_SOURCES) fmt vet
25-
GOOS=linux go build -o node-problem-detector \
32+
./bin/node-problem-detector: $(PKG_SOURCES)
33+
GOOS=linux go build -o bin/node-problem-detector \
2634
-ldflags '-w -extldflags "-static" -X $(PKG)/pkg/version.version=$(VERSION)' \
2735
cmd/node_problem_detector.go
2836

29-
test:
37+
test: vet fmt
3038
go test -timeout=1m -v -race ./pkg/...
3139

32-
container: node-problem-detector
33-
docker build -t gcr.io/$(PROJ)/node-problem-detector:$(TAG) .
40+
build-container: ./bin/node-problem-detector
41+
docker build -t $(IMAGE) .
42+
43+
build-tar: ./bin/node-problem-detector
44+
tar -zcvf $(TARBALL) bin/ config/
45+
sha1sum $(TARBALL)
46+
md5sum $(TARBALL)
47+
48+
build: build-container build-tar
49+
50+
push-container: build-container
51+
gcloud docker push $(IMAGE)
52+
53+
push-tar: build-tar
54+
gsutil cp $(TARBALL) $(UPLOAD_PATH)/node-problem-detector/
3455

35-
push: container
36-
gcloud docker push gcr.io/$(PROJ)/node-problem-detector:$(TAG)
56+
push: push-container push-tar
3757

3858
clean:
39-
rm -f node-problem-detector
59+
rm -f bin/node-problem-detector
60+
rm -f node-problem-detector-*.tar.gz

pkg/version/version.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ package version
1515

1616
import "fmt"
1717

18-
// version defines the version
18+
// version defines node-problem-detector version string.
1919
var version string = "UNKNOWN"
2020

2121
func PrintVersion() {

0 commit comments

Comments
 (0)