Skip to content

Commit

Permalink
Makefile: Generate OpenAPI only when building Metrics Adapter (#1515)
Browse files Browse the repository at this point in the history
Signed-off-by: Zbynek Roubalik <zroubali@redhat.com>
  • Loading branch information
zroubalik authored Jan 20, 2021
1 parent 2b8be4b commit 27f90ff
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ adapter: adapter-dockerfile gofmt govet
# are already in CI, we don't need to run them every
# time we build the image
.PHONY: adapter-dockerfile
adapter-dockerfile: generate
adapter-dockerfile: generate adapter/generated/openapi/zz_generated.openapi.go
${GO_BUILD_VARS} go build \
-ldflags "-X=github.com/kedacore/keda/version.GitCommit=$(GIT_COMMIT) -X=github.com/kedacore/keda/version.Version=$(VERSION)" \
-o bin/keda-adapter adapter/main.go
Expand All @@ -173,9 +173,10 @@ manifests: controller-gen

# Generate code (API)
.PHONY: generate
generate: controller-gen adapter/generated/openapi/zz_generated.openapi.go
generate: controller-gen
$(CONTROLLER_GEN) object:headerFile="hack/boilerplate.go.txt" paths="./..."

# Generate OpenAPI for Metrics Adapter
adapter/generated/openapi/zz_generated.openapi.go: go.mod go.sum
@OPENAPI_PATH=`go list -mod=readonly -m -f '{{.Dir}}' k8s.io/kube-openapi`; \
go run $${OPENAPI_PATH}/cmd/openapi-gen/openapi-gen.go --logtostderr \
Expand Down

0 comments on commit 27f90ff

Please sign in to comment.