-
Notifications
You must be signed in to change notification settings - Fork 10
/
Makefile
71 lines (55 loc) · 1.61 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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
MAKEFLAGS += --warn-undefined-variables
SHELL := bash
.SHELLFLAGS := -eu -o pipefail -c
.DELETE_ON_ERROR:
.SUFFIXES:
# The semver version number which will be used as the Docker image tag
# Defaults to the output of git describe.
VERSION ?= $(shell git describe --tags --dirty --always)
# Docker image name parameters
IMG_NAME ?= jenting/kucero
IMG_TAG ?= ${VERSION}
IMG ?= ${IMG_NAME}:${IMG_TAG}
# Get the currently used golang install path (in GOPATH/bin, unless GOBIN is set)
ifeq (,$(shell go env GOBIN))
GOBIN=$(shell go env GOPATH)/bin
else
GOBIN=$(shell go env GOBIN)
endif
BIN := ${CURDIR}/bin
export PATH := ${BIN}:${PATH}
all: kucero
verify:
go mod tidy
go mod verify
test: verify
go test -count=1 ./...
e2e-test: docker-build
bash +x ./integration/test.sh ${IMG}
cd manifest && kustomize create --autodetect 2>/dev/null || true
kustomize build manifest | kubectl delete -f -
kucero: test
CGO_ENABLED=0 go build -ldflags "-s -w -X main.version=$(VERSION)" -o cmd/kucero/kucero cmd/kucero/*.go
# Run go fmt against code
fmt:
go fmt ./...
# Run go vet against code
vet:
go vet ./...
# Build the docker image
docker-build:
docker build --build-arg VERSION=${VERSION} -t ${IMG} .
# Push the docker image
docker-push:
docker push ${IMG}
# Deploy manifest
deploy-manifest:
cd manifest && kustomize create --autodetect 2>/dev/null || true
cd manifest && kustomize edit set image kucero=${IMG}
kustomize build manifest | kubectl apply -f -
# Destroy manifest
destroy-manifest:
cd manifest && kustomize create --autodetect 2>/dev/null || true
kustomize build manifest | kubectl delete -f -
clean:
go clean -x -i ./...