From a1b1353b9ef6c628a02b6836adfee0559642434c Mon Sep 17 00:00:00 2001 From: 1aal Date: Fri, 10 Nov 2023 14:25:41 +0800 Subject: [PATCH] chore: support kbcli milestone and release-notes --- Makefile | 85 ++++---------------------------------------------------- 1 file changed, 5 insertions(+), 80 deletions(-) diff --git a/Makefile b/Makefile index 725ac41cd..2163502fa 100644 --- a/Makefile +++ b/Makefile @@ -93,9 +93,6 @@ endif help: ## Display this help. @awk 'BEGIN {FS = ":.*##"; printf "\nUsage:\n make \033[36m\033[0m\n"} /^[a-zA-Z_0-9-]+:.*?##/ { printf " \033[36m%-15s\033[0m %s\n", $$1, $$2 } /^##@/ { printf "\n\033[1m%s\033[0m\n", substr($$0, 5) } ' $(MAKEFILE_LIST) -##@ Development -.PHONY: generate -generate: build-kbcli-embed-chart .PHONY: fmt fmt: ## Run go fmt against code. @@ -114,19 +111,19 @@ cue-fmt: cuetool ## Run cue fmt against code. lint-fast: staticcheck vet golangci-lint # [INTERNAL] Run all lint job against code. .PHONY: lint -lint: generate ## Run default lint job against code. +lint: ## Run default lint job against code. $(MAKE) golangci-lint .PHONY: golangci-lint -golangci-lint: golangci generate ## Run golangci-lint against code. +golangci-lint: golangci ## Run golangci-lint against code. $(GOLANGCILINT) run ./... .PHONY: staticcheck -staticcheck: staticchecktool generate ## Run staticcheck against code. +staticcheck: staticchecktool ## Run staticcheck against code. $(STATICCHECK) -tags $(BUILD_TAGS) ./... .PHONY: build-checks -build-checks: generate fmt vet goimports lint-fast ## Run build checks. +build-checks: fmt vet goimports lint-fast ## Run build checks. .PHONY: mod-download mod-download: ## Run go mod download against go modules. @@ -141,7 +138,7 @@ TEST_PACKAGES ?= ./pkg/... ./cmd/... OUTPUT_COVERAGE=-coverprofile cover.out .PHONY: test -test: generate ## Run operator controller tests with current $KUBECONFIG context. if existing k8s cluster is k3d or minikube, specify EXISTING_CLUSTER_TYPE. +test: ## Run operator controller tests with current $KUBECONFIG context. if existing k8s cluster is k3d or minikube, specify EXISTING_CLUSTER_TYPE. $(GO) test -tags $(BUILD_TAGS) -p 1 $(TEST_PACKAGES) $(OUTPUT_COVERAGE) .PHONY: test-fast @@ -162,78 +159,6 @@ goimports: goimportstool ## Run goimports against code. $(GOIMPORTS) -local github.com/apecloud/kbcli -w $$(git ls-files|grep "\.go$$") -##@ CLI -K3S_VERSION ?= v1.23.8+k3s1 -K3D_VERSION ?= 5.4.4 -K3S_IMG_TAG ?= $(subst +,-,$(K3S_VERSION)) - -CLI_LD_FLAGS ="-s -w \ - -X github.com/apecloud/kbcli/version.BuildDate=`date -u +'%Y-%m-%dT%H:%M:%SZ'` \ - -X github.com/apecloud/kbcli/version.GitCommit=$(GIT_COMMIT) \ - -X github.com/apecloud/kbcli/version.GitVersion=$(GIT_VERSION) \ - -X github.com/apecloud/kbcli/version.Version=$(VERSION) \ - -X github.com/apecloud/kbcli/version.K3sImageTag=$(K3S_IMG_TAG) \ - -X github.com/apecloud/kbcli/version.K3dVersion=$(K3D_VERSION) \ - -X github.com/apecloud/kbcli/version.DefaultKubeBlocksVersion=$(VERSION)" - -bin/kbcli.%: ## Cross build bin/kbcli.$(OS).$(ARCH). - GOOS=$(word 2,$(subst ., ,$@)) GOARCH=$(word 3,$(subst ., ,$@)) $(GO) build -tags $(BUILD_TAGS) -ldflags=${CLI_LD_FLAGS} -o $@ cmd/cli/main.go - -.PHONY: fetch-addons -fetch-addons: ## fetch addons helm charts, if addons dir not exist, clone it, else pull it. - @if [ ! -d "addons" ]; then \ - git clone https://github.com/apecloud/kubeblocks-addons.git -b main addons;\ - else \ - cd addons && git pull ;\ - fi - -.PHONY: kbcli-fast -kbcli-fast: OS=$(shell $(GO) env GOOS) -kbcli-fast: ARCH=$(shell $(GO) env GOARCH) -kbcli-fast: build-kbcli-embed-chart - $(MAKE) bin/kbcli.$(OS).$(ARCH) - @mv bin/kbcli.$(OS).$(ARCH) bin/kbcli - -create-kbcli-embed-charts-dir: - mkdir -p pkg/cluster/charts/ - -build-single-kbcli-embed-chart.%: chart=$(word 2,$(subst ., ,$@)) -build-single-kbcli-embed-chart.%: - $(HELM) dependency update addons/addons/$(chart) --skip-refresh -ifeq ($(VERSION), latest) - $(HELM) package addons/addons/$(chart) -else - $(HELM) package addons/addons/$(chart) --version $(VERSION) -endif - mv $(chart)-*.tgz pkg/cluster/charts/$(chart).tgz - -.PHONY: build-kbcli-embed-chart -build-kbcli-embed-chart: helmtool fetch-addons create-kbcli-embed-charts-dir \ - build-single-kbcli-embed-chart.apecloud-mysql-cluster \ - build-single-kbcli-embed-chart.redis-cluster \ - build-single-kbcli-embed-chart.postgresql-cluster \ - build-single-kbcli-embed-chart.kafka-cluster \ - build-single-kbcli-embed-chart.mongodb-cluster \ - build-single-kbcli-embed-chart.llm-cluster \ - build-single-kbcli-embed-chart.xinference-cluster \ -# build-single-kbcli-embed-chart.neon-cluster -# build-single-kbcli-embed-chart.postgresql-cluster \ -# build-single-kbcli-embed-chart.clickhouse-cluster \ -# build-single-kbcli-embed-chart.milvus-cluster \ -# build-single-kbcli-embed-chart.qdrant-cluster \ -# build-single-kbcli-embed-chart.weaviate-cluster - -.PHONY: kbcli -kbcli: build-checks kbcli-fast ## Build bin/kbcli. - -.PHONY: clean-kbcli -clean-kbcli: ## Clean bin/kbcli*. - rm -f bin/kbcli* - -.PHONY: kbcli-doc -kbcli-doc: ## generate CLI command reference manual. - $(GO) run -tags $(BUILD_TAGS) ./hack/docgen/cli/main.go ./docs/user_docs/cli - .PHONY: install-docker-buildx install-docker-buildx: ## Create `docker buildx` builder. @if ! docker buildx inspect $(BUILDX_BUILDER) > /dev/null; then \