-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathMakefile
55 lines (41 loc) · 1.37 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
GIT_VER := $(shell git describe --tags --always --dirty="-dev")
all: clean build
v:
@echo "Version: ${GIT_VER}"
clean:
rm -rf sync-proxy build/
build:
go build -ldflags "-X main.version=${GIT_VER}" -v -o sync-proxy .
test:
go test ./...
test-race:
go test -race ./...
lint:
gofmt -d ./
go vet ./...
staticcheck ./...
cover:
go test -coverprofile=/tmp/go-sim-lb.cover.tmp ./...
go tool cover -func /tmp/go-sim-lb.cover.tmp
unlink /tmp/go-sim-lb.cover.tmp
cover-html:
go test -coverprofile=/tmp/go-sim-lb.cover.tmp ./...
go tool cover -html=/tmp/go-sim-lb.cover.tmp
unlink /tmp/go-sim-lb.cover.tmp
build-for-docker:
GOOS=linux go build -ldflags "-X main.version=${GIT_VER}" -v -o sync-proxy .
test-coverage:
go test -race -v -covermode=atomic -coverprofile=coverage.out ./...
go tool cover -func coverage.out
docker-image:
DOCKER_BUILDKIT=1 docker build . -t sync-proxy
docker tag sync-proxy:latest ${ECR_URI}:${GIT_VER}
docker tag sync-proxy:latest ${ECR_URI}:latest
docker-push:
docker push ${ECR_URI}:${GIT_VER}
docker push ${ECR_URI}:latest
k8s-deploy:
@echo "Checking if Docker image ${ECR_URI}:${GIT_VER} exists..."
@docker manifest inspect ${ECR_URI}:${GIT_VER} > /dev/null || (echo "Docker image not found" && exit 1)
kubectl set image deploy/deployment-sync-proxy app-sync-proxy=${ECR_URI}:${GIT_VER}
kubectl rollout status deploy/deployment-sync-proxy