kubevela/Makefile

135 lines
4.2 KiB
Makefile
Raw Permalink Normal View History

Refactor: align velaux env and CLI env, they both use K8s namespace as (#2975) * Refactor: use createOrUpdateNamespace as a common util function Signed-off-by: Jianbo Sun <jianbo.sjb@alibaba-inc.com> * Feat: add ENV webservice handelr * Fix: fix Env usecase logic * Feat: Add Delete Env API Signed-off-by: Jianbo Sun <jianbo.sjb@alibaba-inc.com> * Fix: filter empty addon data Signed-off-by: Jianbo Sun <jianbo.sjb@alibaba-inc.com> * Feat: split makefiels and make it clear * Feat: add k8s utils test * Feat: Add env update interface Signed-off-by: Jianbo Sun <jianbo.sjb@alibaba-inc.com> * Feat: change env implementation Signed-off-by: barnettZQG <barnett.zqg@gmail.com> * Fix: minor fix * Revert "Fix: minor fix" This reverts commit 9cafefa65a384795315924cb18e48681dd7086a1. * Fix: use appusecase as parameter Signed-off-by: Jianbo Sun <jianbo.sjb@alibaba-inc.com> * Refactor: align CLI vela env with new env design Signed-off-by: Jianbo Sun <jianbo.sjb@alibaba-inc.com> * Fix: minor fix Signed-off-by: Jianbo Sun <jianbo.sjb@alibaba-inc.com> * Feat: add page index and alias of env Signed-off-by: Jianbo Sun <jianbo.sjb@alibaba-inc.com> * Fix: fix tests and licence header * Fix: fix makefile and add default target Signed-off-by: Jianbo Sun <jianbo.sjb@alibaba-inc.com> * Fix: update build swagger.json Signed-off-by: Jianbo Sun <jianbo.sjb@alibaba-inc.com> * Fix: change update env api Signed-off-by: barnettZQG <barnett.zqg@gmail.com> * Feat: list env with alias * Feat: add log to env delete * Fix: can not get app status Signed-off-by: barnettZQG <barnett.zqg@gmail.com> * Feat: support update workflow and refactor code * Fix: lint * Fix: remove swagger check Signed-off-by: Jianbo Sun <jianbo.sjb@alibaba-inc.com> * Fix: fix cli vela delete * Fix: update test Signed-off-by: Jianbo Sun <jianbo.sjb@alibaba-inc.com> * Fix: update test Signed-off-by: Jianbo Sun <jianbo.sjb@alibaba-inc.com> * Fix: app deploy unit test case Signed-off-by: barnettZQG <barnett.zqg@gmail.com> * Fix: SortOrderDescending is not effective Signed-off-by: barnettZQG <barnett.zqg@gmail.com> * Fix: e2e test case Signed-off-by: barnettZQG <barnett.zqg@gmail.com> * Feat: support default project/target/env * Fix: make test and add swagger * Fix: use separated datasource for unit test * Fix: app rollback bug Signed-off-by: barnettZQG <barnett.zqg@gmail.com> * Fix: fix e2e test * Fix: kubeapi driver sort bug Signed-off-by: barnettZQG <barnett.zqg@gmail.com> * Fix: e2e test * Fix: api e2e test Signed-off-by: barnettZQG <barnett.zqg@gmail.com> * Fix: e2e test fix * Fix: try fix e2e test * Fix: api e2e test Signed-off-by: barnettZQG <barnett.zqg@gmail.com> Co-authored-by: barnettZQG <barnett.zqg@gmail.com>
2021-12-25 10:36:54 +08:00
include makefiles/const.mk
include makefiles/dependency.mk
include makefiles/release.mk
include makefiles/develop.mk
include makefiles/build.mk
include makefiles/e2e.mk
.DEFAULT_GOAL := all
2020-07-31 12:04:16 +08:00
all: build
2020-07-06 23:45:29 +08:00
# Run tests
test: unit-test-core test-cli-gen
@$(OK) unit-tests pass
2020-07-06 23:45:29 +08:00
test-cli-gen:
mkdir -p ./bin/doc
2022-07-18 19:22:55 +08:00
go run ./hack/docgen/cli/gen.go ./bin/doc
unit-test-core:
go test -coverprofile=coverage.txt $(shell go list ./pkg/... ./cmd/... ./apis/... | grep -v apiserver | grep -v applicationconfiguration)
go test $(shell go list ./references/... | grep -v apiserver)
unit-test-apiserver:
go test -gcflags=all=-l -coverprofile=coverage.txt $(shell go list ./pkg/... ./cmd/... | grep -E 'apiserver|velaql')
# Build vela cli binary
build: vela-cli kubectl-vela
@$(OK) build succeed
2020-09-10 15:44:05 +08:00
build-cleanup:
rm -rf _bin
2020-07-06 23:45:29 +08:00
# Run go fmt against code
fmt: goimports installcue
2020-07-06 23:45:29 +08:00
go fmt ./...
$(GOIMPORTS) -local github.com/oam-dev/kubevela -w $$(go list -f {{.Dir}} ./...)
$(CUE) fmt ./vela-templates/definitions/internal/*
$(CUE) fmt ./vela-templates/definitions/deprecated/*
$(CUE) fmt ./vela-templates/definitions/registry/*
$(CUE) fmt ./pkg/stdlib/pkgs/*
$(CUE) fmt ./pkg/stdlib/op.cue
$(CUE) fmt ./pkg/workflow/tasks/template/static/*
2020-07-06 23:45:29 +08:00
# Run go vet against code
vet:
go vet ./...
staticcheck: staticchecktool
$(STATICCHECK) ./...
2020-09-10 14:57:36 +08:00
lint: golangci
$(GOLANGCILINT) run ./...
2020-09-10 13:10:08 +08:00
reviewable: manifests fmt vet lint staticcheck helm-doc-gen
go mod tidy
# Execute auto-gen code commands and ensure branch is clean.
check-diff: reviewable
git --no-pager diff
git diff --quiet || ($(ERR) please run 'make reviewable' to include all changes && false)
@$(OK) branch is clean
2020-07-06 23:45:29 +08:00
# Push the docker image
docker-push:
docker push $(VELA_CORE_IMAGE)
2020-07-06 23:45:29 +08:00
build-swagger:
go run ./cmd/apiserver/main.go build-swagger ./docs/apidoc/swagger.json
Refactor: align velaux env and CLI env, they both use K8s namespace as (#2975) * Refactor: use createOrUpdateNamespace as a common util function Signed-off-by: Jianbo Sun <jianbo.sjb@alibaba-inc.com> * Feat: add ENV webservice handelr * Fix: fix Env usecase logic * Feat: Add Delete Env API Signed-off-by: Jianbo Sun <jianbo.sjb@alibaba-inc.com> * Fix: filter empty addon data Signed-off-by: Jianbo Sun <jianbo.sjb@alibaba-inc.com> * Feat: split makefiels and make it clear * Feat: add k8s utils test * Feat: Add env update interface Signed-off-by: Jianbo Sun <jianbo.sjb@alibaba-inc.com> * Feat: change env implementation Signed-off-by: barnettZQG <barnett.zqg@gmail.com> * Fix: minor fix * Revert "Fix: minor fix" This reverts commit 9cafefa65a384795315924cb18e48681dd7086a1. * Fix: use appusecase as parameter Signed-off-by: Jianbo Sun <jianbo.sjb@alibaba-inc.com> * Refactor: align CLI vela env with new env design Signed-off-by: Jianbo Sun <jianbo.sjb@alibaba-inc.com> * Fix: minor fix Signed-off-by: Jianbo Sun <jianbo.sjb@alibaba-inc.com> * Feat: add page index and alias of env Signed-off-by: Jianbo Sun <jianbo.sjb@alibaba-inc.com> * Fix: fix tests and licence header * Fix: fix makefile and add default target Signed-off-by: Jianbo Sun <jianbo.sjb@alibaba-inc.com> * Fix: update build swagger.json Signed-off-by: Jianbo Sun <jianbo.sjb@alibaba-inc.com> * Fix: change update env api Signed-off-by: barnettZQG <barnett.zqg@gmail.com> * Feat: list env with alias * Feat: add log to env delete * Fix: can not get app status Signed-off-by: barnettZQG <barnett.zqg@gmail.com> * Feat: support update workflow and refactor code * Fix: lint * Fix: remove swagger check Signed-off-by: Jianbo Sun <jianbo.sjb@alibaba-inc.com> * Fix: fix cli vela delete * Fix: update test Signed-off-by: Jianbo Sun <jianbo.sjb@alibaba-inc.com> * Fix: update test Signed-off-by: Jianbo Sun <jianbo.sjb@alibaba-inc.com> * Fix: app deploy unit test case Signed-off-by: barnettZQG <barnett.zqg@gmail.com> * Fix: SortOrderDescending is not effective Signed-off-by: barnettZQG <barnett.zqg@gmail.com> * Fix: e2e test case Signed-off-by: barnettZQG <barnett.zqg@gmail.com> * Feat: support default project/target/env * Fix: make test and add swagger * Fix: use separated datasource for unit test * Fix: app rollback bug Signed-off-by: barnettZQG <barnett.zqg@gmail.com> * Fix: fix e2e test * Fix: kubeapi driver sort bug Signed-off-by: barnettZQG <barnett.zqg@gmail.com> * Fix: e2e test * Fix: api e2e test Signed-off-by: barnettZQG <barnett.zqg@gmail.com> * Fix: e2e test fix * Fix: try fix e2e test * Fix: api e2e test Signed-off-by: barnettZQG <barnett.zqg@gmail.com> Co-authored-by: barnettZQG <barnett.zqg@gmail.com>
2021-12-25 10:36:54 +08:00
image-cleanup:
ifneq (, $(shell which docker))
# Delete Docker images
ifneq ($(shell docker images -q $(VELA_CORE_TEST_IMAGE)),)
docker rmi -f $(VELA_CORE_TEST_IMAGE)
endif
ifneq ($(shell docker images -q $(VELA_RUNTIME_ROLLOUT_TEST_IMAGE)),)
docker rmi -f $(VELA_RUNTIME_ROLLOUT_TEST_IMAGE)
endif
endif
# load docker image to the k3d cluster
image-load:
docker build -t $(VELA_CORE_TEST_IMAGE) -f Dockerfile.e2e .
k3d image import $(VELA_CORE_TEST_IMAGE) || { echo >&2 "kind not installed or error loading image: $(VELA_CORE_TEST_IMAGE)"; exit 1; }
image-load-runtime-cluster:
/bin/sh hack/e2e/build_runtime_rollout.sh
docker build -t $(VELA_RUNTIME_ROLLOUT_TEST_IMAGE) -f runtime/rollout/e2e/Dockerfile.e2e runtime/rollout/e2e/
rm -rf runtime/rollout/e2e/tmp
k3d image import $(VELA_RUNTIME_ROLLOUT_TEST_IMAGE) || { echo >&2 "kind not installed or error loading image: $(VELA_RUNTIME_ROLLOUT_TEST_IMAGE)"; exit 1; }
k3d cluster get $(RUNTIME_CLUSTER_NAME) && k3d image import $(VELA_RUNTIME_ROLLOUT_TEST_IMAGE) --cluster=$(RUNTIME_CLUSTER_NAME) || echo "no worker cluster"
# Run tests
core-test:
go test ./pkg/... -coverprofile cover.out
# Build vela core manager and apiserver binary
manager:
$(GOBUILD_ENV) go build -o bin/manager -a -ldflags $(LDFLAGS) ./cmd/core/main.go
$(GOBUILD_ENV) go build -o bin/apiserver -a -ldflags $(LDFLAGS) ./cmd/apiserver/main.go
vela-runtime-rollout-manager:
$(GOBUILD_ENV) go build -o ./runtime/rollout/bin/manager -a -ldflags $(LDFLAGS) ./runtime/rollout/cmd/main.go
# Generate manifests e.g. CRD, RBAC etc.
manifests: installcue kustomize
go generate $(foreach t,pkg apis,./$(t)/...)
# TODO(yangsoon): kustomize will merge all CRD into a whole file, it may not work if we want patch more than one CRD in this way
$(KUSTOMIZE) build config/crd -o config/crd/base/core.oam.dev_applications.yaml
./hack/crd/cleanup.sh
go run ./hack/crd/dispatch/dispatch.go config/crd/base charts/vela-core/crds runtime/ charts/vela-minimal/crds
rm -f config/crd/base/*
./vela-templates/gen_definitions.sh
Refactor: align velaux env and CLI env, they both use K8s namespace as (#2975) * Refactor: use createOrUpdateNamespace as a common util function Signed-off-by: Jianbo Sun <jianbo.sjb@alibaba-inc.com> * Feat: add ENV webservice handelr * Fix: fix Env usecase logic * Feat: Add Delete Env API Signed-off-by: Jianbo Sun <jianbo.sjb@alibaba-inc.com> * Fix: filter empty addon data Signed-off-by: Jianbo Sun <jianbo.sjb@alibaba-inc.com> * Feat: split makefiels and make it clear * Feat: add k8s utils test * Feat: Add env update interface Signed-off-by: Jianbo Sun <jianbo.sjb@alibaba-inc.com> * Feat: change env implementation Signed-off-by: barnettZQG <barnett.zqg@gmail.com> * Fix: minor fix * Revert "Fix: minor fix" This reverts commit 9cafefa65a384795315924cb18e48681dd7086a1. * Fix: use appusecase as parameter Signed-off-by: Jianbo Sun <jianbo.sjb@alibaba-inc.com> * Refactor: align CLI vela env with new env design Signed-off-by: Jianbo Sun <jianbo.sjb@alibaba-inc.com> * Fix: minor fix Signed-off-by: Jianbo Sun <jianbo.sjb@alibaba-inc.com> * Feat: add page index and alias of env Signed-off-by: Jianbo Sun <jianbo.sjb@alibaba-inc.com> * Fix: fix tests and licence header * Fix: fix makefile and add default target Signed-off-by: Jianbo Sun <jianbo.sjb@alibaba-inc.com> * Fix: update build swagger.json Signed-off-by: Jianbo Sun <jianbo.sjb@alibaba-inc.com> * Fix: change update env api Signed-off-by: barnettZQG <barnett.zqg@gmail.com> * Feat: list env with alias * Feat: add log to env delete * Fix: can not get app status Signed-off-by: barnettZQG <barnett.zqg@gmail.com> * Feat: support update workflow and refactor code * Fix: lint * Fix: remove swagger check Signed-off-by: Jianbo Sun <jianbo.sjb@alibaba-inc.com> * Fix: fix cli vela delete * Fix: update test Signed-off-by: Jianbo Sun <jianbo.sjb@alibaba-inc.com> * Fix: update test Signed-off-by: Jianbo Sun <jianbo.sjb@alibaba-inc.com> * Fix: app deploy unit test case Signed-off-by: barnettZQG <barnett.zqg@gmail.com> * Fix: SortOrderDescending is not effective Signed-off-by: barnettZQG <barnett.zqg@gmail.com> * Fix: e2e test case Signed-off-by: barnettZQG <barnett.zqg@gmail.com> * Feat: support default project/target/env * Fix: make test and add swagger * Fix: use separated datasource for unit test * Fix: app rollback bug Signed-off-by: barnettZQG <barnett.zqg@gmail.com> * Fix: fix e2e test * Fix: kubeapi driver sort bug Signed-off-by: barnettZQG <barnett.zqg@gmail.com> * Fix: e2e test * Fix: api e2e test Signed-off-by: barnettZQG <barnett.zqg@gmail.com> * Fix: e2e test fix * Fix: try fix e2e test * Fix: api e2e test Signed-off-by: barnettZQG <barnett.zqg@gmail.com> Co-authored-by: barnettZQG <barnett.zqg@gmail.com>
2021-12-25 10:36:54 +08:00
2020-09-10 14:57:36 +08:00
HOSTOS := $(shell uname -s | tr '[:upper:]' '[:lower:]')
HOSTARCH := $(shell uname -m)
ifeq ($(HOSTARCH),x86_64)
HOSTARCH := amd64
endif
2020-09-10 13:10:08 +08:00
check-license-header:
./hack/licence/header-check.sh
def-install:
./hack/utils/installdefinition.sh
helm-doc-gen: helmdoc
readme-generator -v charts/vela-core/values.yaml -r charts/vela-core/README.md
readme-generator -v charts/vela-minimal/values.yaml -r charts/vela-minimal/README.md