From f9d9967419975c20ed7a44bcca4c5f6603ae1e9e Mon Sep 17 00:00:00 2001 From: Takeshi Yoneda Date: Mon, 13 Jan 2025 14:45:18 -0800 Subject: [PATCH 1/6] Adds make help target Signed-off-by: Takeshi Yoneda --- CONTRIBUTING.md | 4 ++-- Makefile | 22 +++++++++++++++++++--- 2 files changed, 21 insertions(+), 5 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index d72352b4a..d4e184c71 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -2,9 +2,9 @@ We welcome contributions from the community. Please read the following guidelines carefully to maximize the chances of your PR being merged. -## Coding Style +## Development -To ensure your change passes format checks, run `make precommit` and ensure all checks pass. +See `make help`. ## DCO diff --git a/Makefile b/Makefile index 784a3fe7d..3b58416d5 100644 --- a/Makefile +++ b/Makefile @@ -56,13 +56,12 @@ apigen: controller-gen # This runs all necessary steps to prepare for a commit. .PHONY: precommit -precommit: tidy codespell apigen format lint +precommit: tidy codespell apigen format lint editorconfig-checker helm-lint # This runs precommit and checks for any differences in the codebase, failing if there are any. .PHONY: check -check: editorconfig-checker +check: @$(MAKE) precommit - @$(MAKE) helm-package --version ${HELM_CHART_VERSION} @echo "running editorconfig-checker" @$(EDITORCONFIG_CHECKER) @if [ ! -z "`git status -s`" ]; then \ @@ -202,3 +201,20 @@ helm-package: helm-lint helm-push: helm-package @echo "helm-push => .${HELM_DIR}" @helm push ${OUTPUT_DIR}/ai-gateway-helm-${HELM_CHART_VERSION}.tgz oci://${OCI_REGISTRY} + + +help: + @echo "Usage: make " + @echo "" + @echo "All core targets needed for contributing:" + @echo " precommit Run all necessary steps to prepare for a commit." + @echo " check Run precommit and check for any differences in the codebase." + @echo " test Run the unit tests for the codebase." + @echo " test-cel Run the integration tests of CEL validation rules in API definitions with envtest." + @echo " This will be needed when changing API definitions." + @echo " test-extproc Run the integration tests for extproc without controller or k8s at all." + @echo " Note that this requires some credentials." + @echo " test-controller Run the integration tests for the controller with envtest." + @echo "" + @echo "For example, 'make precommit test' should be enough for initial iterations, and later 'make test-cel' etc." + @echo "" From 857b5aa6a567561f6e44121c3320d5ecc7f1c45d Mon Sep 17 00:00:00 2001 From: Takeshi Yoneda Date: Mon, 13 Jan 2025 18:03:05 -0800 Subject: [PATCH 2/6] more Signed-off-by: Takeshi Yoneda --- Makefile | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 3b58416d5..e53f8f178 100644 --- a/Makefile +++ b/Makefile @@ -60,8 +60,7 @@ precommit: tidy codespell apigen format lint editorconfig-checker helm-lint # This runs precommit and checks for any differences in the codebase, failing if there are any. .PHONY: check -check: - @$(MAKE) precommit +check: precommit @echo "running editorconfig-checker" @$(EDITORCONFIG_CHECKER) @if [ ! -z "`git status -s`" ]; then \ From b46cd469f28a9063cadcc247e6a116a13bab3371 Mon Sep 17 00:00:00 2001 From: Takeshi Yoneda Date: Mon, 13 Jan 2025 18:04:44 -0800 Subject: [PATCH 3/6] more Signed-off-by: Takeshi Yoneda --- Makefile | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/Makefile b/Makefile index e53f8f178..ca4614ef3 100644 --- a/Makefile +++ b/Makefile @@ -18,6 +18,23 @@ TAG ?= latest ENABLE_MULTI_PLATFORMS ?= false HELM_CHART_VERSION ?= v0.0.0-latest +# This will print out the help message for contributing to the project. +help: + @echo "Usage: make " + @echo "" + @echo "All core targets needed for contributing:" + @echo " precommit Run all necessary steps to prepare for a commit." + @echo " check Run precommit and check for any differences in the codebase." + @echo " test Run the unit tests for the codebase." + @echo " test-cel Run the integration tests of CEL validation rules in API definitions with envtest." + @echo " This will be needed when changing API definitions." + @echo " test-extproc Run the integration tests for extproc without controller or k8s at all." + @echo " Note that this requires some credentials." + @echo " test-controller Run the integration tests for the controller with envtest." + @echo "" + @echo "For example, 'make precommit test' should be enough for initial iterations, and later 'make test-cel' etc." + @echo "" + # This runs the linter, formatter, and tidy on the codebase. .PHONY: lint lint: golangci-lint @@ -200,20 +217,3 @@ helm-package: helm-lint helm-push: helm-package @echo "helm-push => .${HELM_DIR}" @helm push ${OUTPUT_DIR}/ai-gateway-helm-${HELM_CHART_VERSION}.tgz oci://${OCI_REGISTRY} - - -help: - @echo "Usage: make " - @echo "" - @echo "All core targets needed for contributing:" - @echo " precommit Run all necessary steps to prepare for a commit." - @echo " check Run precommit and check for any differences in the codebase." - @echo " test Run the unit tests for the codebase." - @echo " test-cel Run the integration tests of CEL validation rules in API definitions with envtest." - @echo " This will be needed when changing API definitions." - @echo " test-extproc Run the integration tests for extproc without controller or k8s at all." - @echo " Note that this requires some credentials." - @echo " test-controller Run the integration tests for the controller with envtest." - @echo "" - @echo "For example, 'make precommit test' should be enough for initial iterations, and later 'make test-cel' etc." - @echo "" From 7ddb8e1049650529473cb073389c99b850a1b456 Mon Sep 17 00:00:00 2001 From: Takeshi Yoneda Date: Mon, 13 Jan 2025 20:26:29 -0800 Subject: [PATCH 4/6] more Signed-off-by: Takeshi Yoneda --- Makefile | 1 - 1 file changed, 1 deletion(-) diff --git a/Makefile b/Makefile index ca4614ef3..34b5225c4 100644 --- a/Makefile +++ b/Makefile @@ -24,7 +24,6 @@ help: @echo "" @echo "All core targets needed for contributing:" @echo " precommit Run all necessary steps to prepare for a commit." - @echo " check Run precommit and check for any differences in the codebase." @echo " test Run the unit tests for the codebase." @echo " test-cel Run the integration tests of CEL validation rules in API definitions with envtest." @echo " This will be needed when changing API definitions." From 99b86b1525216dfe907b9f34e31072760b113d82 Mon Sep 17 00:00:00 2001 From: Takeshi Yoneda Date: Mon, 13 Jan 2025 20:29:23 -0800 Subject: [PATCH 5/6] more Signed-off-by: Takeshi Yoneda --- Makefile | 1 + 1 file changed, 1 insertion(+) diff --git a/Makefile b/Makefile index 34b5225c4..73d31f8d2 100644 --- a/Makefile +++ b/Makefile @@ -19,6 +19,7 @@ ENABLE_MULTI_PLATFORMS ?= false HELM_CHART_VERSION ?= v0.0.0-latest # This will print out the help message for contributing to the project. +.PHONY: help help: @echo "Usage: make " @echo "" From 5d662c218f7e62ee75fc10de9ed0529aa18dd7a4 Mon Sep 17 00:00:00 2001 From: Takeshi Yoneda Date: Mon, 13 Jan 2025 20:33:03 -0800 Subject: [PATCH 6/6] more Signed-off-by: Takeshi Yoneda --- Makefile | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index 73d31f8d2..28f6ef2b4 100644 --- a/Makefile +++ b/Makefile @@ -73,18 +73,21 @@ apigen: controller-gen # This runs all necessary steps to prepare for a commit. .PHONY: precommit -precommit: tidy codespell apigen format lint editorconfig-checker helm-lint +precommit: tidy codespell apigen format lint editorconfig helm-lint # This runs precommit and checks for any differences in the codebase, failing if there are any. .PHONY: check check: precommit - @echo "running editorconfig-checker" - @$(EDITORCONFIG_CHECKER) @if [ ! -z "`git status -s`" ]; then \ echo "The following differences will fail CI until committed:"; \ git diff --exit-code; \ fi +# This runs the editorconfig-checker on the codebase. +editorconfig: editorconfig-checker + @echo "running editorconfig-checker" + @$(EDITORCONFIG_CHECKER) + # This runs the unit tests for the codebase. .PHONY: test test: