Makefile
PREFIX ?= registry.cn-hangzhou.aliyuncs.com/rdc-incubatorTAG ?= devSHADOW_IMAGE = kt-connect-shadowSHADOW_BASE_IMAGE = shadow-baseROUTER_IMAGE = kt-connect-routerNAVIGATOR_IMAGE = kt-connect-navigator # run mod tidymod: go mod tidy -compat=1.17 # run unit testtest: mkdir -p artifacts/report/coverage go test -v -cover -coverprofile artifacts/report/coverage/c.out ./... go tool cover -html=artifacts/report/coverage/c.out -o artifacts/report/coverage/index.html # build kt release packagerelease: goreleaser --snapshot --skip-publish --rm-dist # check the stylecheck: go vet ./pkg/... ./cmd/... # build ktctlktctl: go mod download GOARCH=amd64 GOOS=linux go build -ldflags "-s -w -X main.version=${TAG}" -o artifacts/linux/ktctl ./cmd/ktctl GOARCH=amd64 GOOS=darwin go build -ldflags "-s -w -X main.version=${TAG}" -o artifacts/macos/ktctl ./cmd/ktctl GOARCH=amd64 GOOS=windows go build -ldflags "-s -w -X main.version=${TAG}" -o artifacts/windows/ktctl.exe ./cmd/ktctl # minimize binary sizeupx: upx -9 artifacts/linux/ktctl artifacts/macos/ktctl artifacts/windows/ktctl.exe # build this image before shadowshadow-base: docker build -t $(PREFIX)/$(SHADOW_BASE_IMAGE):$(TAG) -f build/docker/shadow/Dockerfile_base . # build shadow imageshadow: GOARCH=amd64 GOOS=linux go build -gcflags "all=-N -l" -o artifacts/shadow/shadow-linux-amd64 cmd/shadow/main.go docker build -t $(PREFIX)/$(SHADOW_IMAGE):$(TAG) -f build/docker/shadow/Dockerfile . # shadow with dlvshadow-dlv: make shadow TAG=latest scripts/build-shadow-dlv # shadow for local debugshadow-local: go build -gcflags "all=-N -l" -o artifacts/shadow/shadow-local cmd/shadow/main.go # build router imagerouter: GOARCH=amd64 GOOS=linux go build -gcflags "all=-N -l" -o artifacts/router/router-linux-amd64 cmd/router/main.go docker build -t $(PREFIX)/$(ROUTER_IMAGE):$(TAG) -f build/docker/router/Dockerfile . # build this image before navigatornavigator-base: docker build -t $(PREFIX)/$(NAVIGATOR_BASE_IMAGE):$(TAG) -f build/docker/navigator/Dockerfile_base . # build navigator imagenavigator: GOARCH=amd64 GOOS=linux go build -gcflags "all=-N -l" -o artifacts/navigator/navigator-linux-amd64 cmd/navigator/main.go docker build -t $(PREFIX)/$(NAVIGATOR_IMAGE):$(TAG) -f build/docker/navigator/Dockerfile . # navigator for local debugnavigator-local: go build -gcflags "all=-N -l" -o artifacts/navigator/navigator cmd/navigator/main.go # clean up workspaceclean: rm -fr artifacts output dist