github.com/kubevela/workflow@v0.6.0/Makefile (about) 1 include makefiles/const.mk 2 include makefiles/dependency.mk 3 include makefiles/e2e.mk 4 5 .PHONY: all 6 all: build 7 8 ##@ General 9 10 # The help target prints out all targets with their descriptions organized 11 # beneath their categories. The categories are represented by '##@' and the 12 # target descriptions by '##'. The awk commands is responsible for reading the 13 # entire set of makefiles included in this invocation, looking for lines of the 14 # file as xyz: ## something, and then pretty-format the target and help. Then, 15 # if there's a line with ##@ something, that gets pretty-printed as a category. 16 # More info on the usage of ANSI control characters for terminal formatting: 17 # https://en.wikipedia.org/wiki/ANSI_escape_code#SGR_parameters 18 # More info on the awk command: 19 # http://linuxcommand.org/lc3_adv_awk.php 20 21 .PHONY: help 22 help: ## Display this help. 23 @awk 'BEGIN {FS = ":.*##"; printf "\nUsage:\n make \033[36m<target>\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) 24 25 ##@ Development 26 27 .PHONY: reviewable 28 reviewable: manifests fmt vet lint staticcheck helm-doc-gen 29 go mod tidy 30 31 .PHONY: check-diff 32 check-diff: reviewable ## Execute auto-gen code commands and ensure branch is clean. 33 git --no-pager diff 34 git diff --quiet || ($(ERR) please run 'make reviewable' to include all changes && false) 35 @$(OK) branch is clean 36 37 .PHONY: manifests 38 manifests: controller-gen ## Generate CustomResourceDefinition objects. 39 $(CONTROLLER_GEN) crd paths="./..." output:crd:artifacts:config=config/crd/bases 40 mv config/crd/bases/* charts/vela-workflow/crds/ 41 42 .PHONY: generate 43 generate: controller-gen ## Generate code containing DeepCopy, DeepCopyInto, and DeepCopyObject method implementations. 44 $(CONTROLLER_GEN) object:headerFile="hack/boilerplate.go.txt" paths="./..." 45 46 .PHONY: lint 47 lint: golangci 48 $(GOLANGCILINT) run ./... 49 50 .PHONY: staticcheck 51 staticcheck: staticchecktool 52 $(STATICCHECK) ./... 53 54 .PHONY: fmt 55 fmt: goimports ## Run go fmt against code. 56 go fmt ./... 57 $(GOIMPORTS) -local github.com/oam-dev/kubevela -w $$(go list -f {{.Dir}} ./...) 58 59 .PHONY: vet 60 vet: ## Run go vet against code. 61 go vet ./... 62 63 .PHONY: test 64 test: manifests generate fmt vet envtest ## Run tests. 65 KUBEBUILDER_ASSETS="$(shell $(ENVTEST) use $(ENVTEST_K8S_VERSION) -p path)" GODEBUG=x509sha1=1 go test $(shell go list ./... | grep -v e2e) -coverprofile coverage.txt 66 67 .PHONY: helm-doc-gen 68 helm-doc-gen: helmdoc 69 readme-generator -v charts/vela-workflow/values.yaml -r charts/vela-workflow/README.md 70 71 ##@ Build 72 73 .PHONY: build 74 build: generate fmt vet ## Build manager binary. 75 go build -o bin/manager ./cmd/main.go 76 77 .PHONY: run 78 run: manifests generate fmt vet ## Run a controller from your host. 79 go run ./cmd/main.go 80 81 .PHONY: docker-build 82 docker-build: ## Build docker image with the manager. 83 docker build --build-arg=VERSION=$(VELA_VERSION) --build-arg=GITVERSION=$(GIT_COMMIT) --build-arg=OS=$(OS) --build-arg=ARCH=${ARCH} -t ${IMG}:${IMG_TAG} . 84 85 # load docker image to the k3d cluster 86 image-load: 87 docker build -t ${IMG}:${IMG_TAG} -f Dockerfile.e2e . 88 k3d image import ${IMG}:${IMG_TAG} || { echo >&2 "kind not installed or error loading image: ${IMG}:${IMG_TAG}"; exit 1; } 89 90 .PHONY: docker-push 91 docker-push: ## Push docker image with the manager. 92 docker push ${IMG}:${IMG_TAG} 93 94 ##@ Deployment 95 96 ifndef ignore-not-found 97 ignore-not-found = false 98 endif 99 100 .PHONY: install 101 install: manifests kustomize ## Install CRDs into the K8s cluster specified in ~/.kube/config. 102 $(KUSTOMIZE) build config/crd | kubectl apply -f - 103 104 .PHONY: uninstall 105 uninstall: manifests kustomize ## Uninstall CRDs from the K8s cluster specified in ~/.kube/config. Call with ignore-not-found=true to ignore resource not found errors during deletion. 106 $(KUSTOMIZE) build config/crd | kubectl delete --ignore-not-found=$(ignore-not-found) -f - 107 108 .PHONY: deploy 109 deploy: manifests kustomize ## Deploy controller to the K8s cluster specified in ~/.kube/config. 110 cd config/manager && $(KUSTOMIZE) edit set image controller=${IMG}:${IMG_TAG} 111 $(KUSTOMIZE) build config/default | kubectl apply -f - 112 113 .PHONY: undeploy 114 undeploy: ## Undeploy controller from the K8s cluster specified in ~/.kube/config. Call with ignore-not-found=true to ignore resource not found errors during deletion. 115 $(KUSTOMIZE) build config/default | kubectl delete --ignore-not-found=$(ignore-not-found) -f -