From 2b70d46d95946090b5ef3e6a8ec3837fdf42232e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Charles-Edouard=20Br=C3=A9t=C3=A9ch=C3=A9?= Date: Tue, 3 Sep 2024 02:11:29 +0200 Subject: [PATCH] chore: add e2e matrix codegen and verification (#10986) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Charles-Edouard Brétéché Co-authored-by: Mariam Fahmy --- Makefile | 60 +++++++++++++++++++++++++++++++++++++++++++++----------- 1 file changed, 49 insertions(+), 11 deletions(-) diff --git a/Makefile b/Makefile index 46baa9c218..4debdf913e 100644 --- a/Makefile +++ b/Makefile @@ -697,21 +697,36 @@ codegen-helm-update-versions: ## Update helm charts versions @$(SED) -i 's/appVersion: .*/appVersion: $(APP_CHART_VERSION)/' charts/kyverno/charts/grafana/Chart.yaml @$(SED) -i 's/kubeVersion: .*/kubeVersion: $(KUBE_CHART_VERSION)/' charts/kyverno/charts/grafana/Chart.yaml +.PHONY: codegen-e2e-matrix +codegen-e2e-matrix: ## Generate e2e tests matrix + @echo Generating e2e tests matrix... >&2 + @(cd hack/chainsaw-matrix && go run . > ../../test/conformance/chainsaw/e2e-matrix.json) + .PHONY: codegen-quick -codegen-quick: codegen-deepcopy codegen-crds-all codegen-docs-all codegen-helm-all codegen-manifest-all ## Generate all generated code except client +codegen-quick: ## Generate all generated code except client +codegen-quick: codegen-deepcopy +codegen-quick: codegen-crds-all +codegen-quick: codegen-docs-all +codegen-quick: codegen-helm-all +codegen-quick: codegen-manifest-all +codegen-quick: codegen-e2e-matrix .PHONY: codegen-slow -codegen-slow: codegen-client-all ## Generate client code +codegen-slow: ## Generate client code +codegen-slow: codegen-client-all .PHONY: codegen-all -codegen-all: codegen-quick codegen-slow ## Generate all generated code +codegen-all: ## Generate all generated code +codegen-all: codegen-quick +codegen-all: codegen-slow ################## # VERIFY CODEGEN # ################## .PHONY: verify-crds -verify-crds: codegen-crds-all ## Check CRDs are up to date +verify-crds: ## Check CRDs are up to date +verify-crds: codegen-crds-all @echo Checking crds are up to date... >&2 @git --no-pager diff $(CRDS_PATH) @echo 'If this test fails, it is because the git diff is non-empty after running "make codegen-crds-all".' >&2 @@ -719,7 +734,8 @@ verify-crds: codegen-crds-all ## Check CRDs are up to date @git diff --quiet --exit-code $(CRDS_PATH) .PHONY: verify-client -verify-client: codegen-client-all ## Check client is up to date +verify-client: ## Check client is up to date +verify-client: codegen-client-all @echo Checking client is up to date... >&2 @git --no-pager diff --ignore-space-change pkg/client @echo 'If this test fails, it is because the git diff is non-empty after running "make codegen-client-all".' >&2 @@ -731,7 +747,8 @@ verify-client: codegen-client-all ## Check client is up to date @git diff --ignore-space-change --quiet --exit-code pkg/clients .PHONY: verify-deepcopy -verify-deepcopy: codegen-deepcopy ## Check deepcopy functions are up to date +verify-deepcopy: ## Check deepcopy functions are up to date +verify-deepcopy: codegen-deepcopy @echo Checking deepcopy functions are up to date... >&2 @git --no-pager diff api @echo 'If this test fails, it is because the git diff is non-empty after running "make codegen-deepcopy".' >&2 @@ -739,7 +756,8 @@ verify-deepcopy: codegen-deepcopy ## Check deepcopy functions are up to date @git diff --quiet --exit-code api .PHONY: verify-docs -verify-docs: codegen-docs-all ## Check docs are up to date +verify-docs: ## Check docs are up to date +verify-docs: codegen-docs-all @echo Checking docs are up to date... >&2 @git --no-pager diff docs/user @echo 'If this test fails, it is because the git diff is non-empty after running "make codegen-docs-all".' >&2 @@ -747,7 +765,8 @@ verify-docs: codegen-docs-all ## Check docs are up to date @git diff --quiet --exit-code docs/user .PHONY: verify-helm -verify-helm: codegen-helm-all ## Check Helm charts are up to date +verify-helm: ## Check Helm charts are up to date +verify-helm: codegen-helm-all @echo Checking helm charts are up to date... >&2 @git --no-pager diff charts @echo 'If this test fails, it is because the git diff is non-empty after running "make codegen-helm-all".' >&2 @@ -755,7 +774,8 @@ verify-helm: codegen-helm-all ## Check Helm charts are up to date @git diff --quiet --exit-code charts .PHONY: verify-manifests -verify-manifests: codegen-manifest-all ## Check manifests are up to date +verify-manifests: ## Check manifests are up to date +verify-manifests: codegen-manifest-all @echo Checking manifests are up to date... >&2 @git --no-pager diff ${INSTALL_MANIFEST_PATH} @echo 'If this test fails, it is because the git diff is non-empty after running "make codegen-manifest-all".' >&2 @@ -763,7 +783,8 @@ verify-manifests: codegen-manifest-all ## Check manifests are up to date @git diff --quiet --exit-code ${INSTALL_MANIFEST_PATH} .PHONY: verify-cli-crds -verify-cli-crds: codegen-cli-crds ## Check generated CRDs to be embedded in the CLI are up to date +verify-cli-crds: ## Check generated CRDs to be embedded in the CLI are up to date +verify-cli-crds: codegen-cli-crds @echo Checking generated CRDs to be embedded in the CLI are up to date... >&2 @git --no-pager diff cmd/cli/kubectl-kyverno/data/crds @echo 'If this test fails, it is because the git diff is non-empty after running "make codegen-cli-crds".' >&2 @@ -778,8 +799,25 @@ verify-cli-tests: ## Check CLI test files are up to date @echo 'To correct this, locally run "make codegen-fix-tests", commit the changes, and re-run tests.' >&2 @git diff --quiet --exit-code test/cli +.PHONY: verify-e2e-matrix +verify-e2e-matrix: ## Check e2e tests matrix is up to date +verify-e2e-matrix: codegen-e2e-matrix + @echo Checking e2e tests matrix is up to date... >&2 + @git --no-pager diff test/conformance/chainsaw + @echo 'If this test fails, it is because the git diff is non-empty after running "make codegen-e2e-matrix".' >&2 + @echo 'To correct this, locally run "make codegen-e2e-matrix", commit the changes, and re-run tests.' >&2 + @git diff --quiet --exit-code test/conformance/chainsaw + .PHONY: verify-codegen -verify-codegen: verify-crds verify-client verify-deepcopy verify-docs verify-helm verify-manifests verify-cli-crds ## Verify all generated code and docs are up to date +verify-codegen: ## Verify all generated code and docs are up to date +verify-codegen: verify-crds +verify-codegen: verify-client +verify-codegen: verify-deepcopy +verify-codegen: verify-docs +verify-codegen: verify-helm +verify-codegen: verify-manifests +verify-codegen: verify-cli-crds +verify-codegen: verify-e2e-matrix ############## # UNIT TESTS #