Skip to content

Commit

Permalink
chore: move cli in cmd/cli (#125)
Browse files Browse the repository at this point in the history
Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>
  • Loading branch information
eddycharly authored Oct 19, 2023
1 parent 4013531 commit 34612a0
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ KO_REGISTRY := ko.local
KO_PLATFORMS := all
KO_TAGS := $(GIT_SHA)
KO_CACHE ?= /tmp/ko-cache
CLI_DIR := cmd/cli
CLI_BIN := kyverno-json

#########
# TOOLS #
Expand Down Expand Up @@ -101,7 +103,6 @@ clean-tools: ## Remove installed tools
# BUILD #
#########

CLI_BIN := kyverno-json
CGO_ENABLED ?= 0
ifdef VERSION
LD_FLAGS := "-s -w -X $(PACKAGE)/pkg/version.BuildVersion=$(VERSION)"
Expand All @@ -121,7 +122,7 @@ vet: ## Run go vet

$(CLI_BIN): fmt vet
@echo Build cli binary... >&2
@CGO_ENABLED=$(CGO_ENABLED) GOOS=$(GOOS) go build -o ./$(CLI_BIN) -ldflags=$(LD_FLAGS) .
@CGO_ENABLED=$(CGO_ENABLED) GOOS=$(GOOS) go build -o ./$(CLI_BIN) -ldflags=$(LD_FLAGS) ./$(CLI_DIR)

.PHONY: build
build: $(CLI_BIN) ## Build
Expand All @@ -140,7 +141,7 @@ serve-playground: $(CLI_BIN) ## Serve playground
ko-build: $(KO) ## Build image (with ko)
@echo Build image with ko... >&2
@LDFLAGS=$(LD_FLAGS) KOCACHE=$(KO_CACHE) KO_DOCKER_REPO=$(KO_REGISTRY) \
$(KO) build . --preserve-import-paths --tags=$(KO_TAGS) --platform=$(LOCAL_PLATFORM)
$(KO) build ./$(CLI_DIR) --preserve-import-paths --tags=$(KO_TAGS) --platform=$(LOCAL_PLATFORM)

###########
# CODEGEN #
Expand Down Expand Up @@ -327,14 +328,14 @@ kind-delete: $(KIND) ## Delete kind cluster
.PHONY: kind-load
kind-load: $(KIND) ko-build ## Build image and load in kind cluster
@echo Load image... >&2
@$(KIND) load docker-image --name $(KIND_NAME) $(KO_REGISTRY)/$(PACKAGE):$(GIT_SHA)
@$(KIND) load docker-image --name $(KIND_NAME) $(KO_REGISTRY)/$(PACKAGE)/$(CLI_DIR):$(GIT_SHA)

.PHONY: kind-install
kind-install: $(HELM) kind-load ## Build image, load it in kind cluster and deploy helm chart
@echo Install chart... >&2
@$(HELM) upgrade --install kyverno-json --namespace kyverno-json --create-namespace --wait ./charts/kyverno-json \
--set image.registry=$(KO_REGISTRY) \
--set image.repository=$(PACKAGE) \
--set image.repository=$(PACKAGE)/$(CLI_DIR) \
--set image.tag=$(GIT_SHA)

###########
Expand Down
File renamed without changes.

0 comments on commit 34612a0

Please sign in to comment.