From 1342858f36492aafbb7a7a1a55ee418fdf9e9233 Mon Sep 17 00:00:00 2001 From: Oscar Kilhed Date: Thu, 30 Oct 2025 15:31:57 +0100 Subject: [PATCH] Codegen/CI: Update makefile to also verify gen-cue (#113211) * update makefile to also verify gen-cue * update for jsonnet --- Makefile | 30 ++++++++++++++++++++++++++++-- 1 file changed, 28 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 5bf0150e047..ab2a0ae2c55 100644 --- a/Makefile +++ b/Makefile @@ -150,7 +150,19 @@ i18n-extract: i18n-extract-enterprise ##@ Building .PHONY: gen-cue -gen-cue: ## Do all CUE/Thema code generation +gen-cue: do-gen-cue + @if [ -n "$$CODEGEN_VERIFY" ]; then \ + echo "Verifying generated code is up to date..."; \ + if ! git diff --quiet; then \ + echo "Error: Generated cue files are not up to date. Please run 'make gen-cue' to regenerate."; \ + git diff --name-only; \ + exit 1; \ + fi; \ + echo "Generated cue files are up to date."; \ + fi + +.PHONY: do-gen-cue +do-gen-cue: ## Do all CUE/Thema code generation @echo "generate code from .cue files" go generate ./kinds/gen.go go generate ./public/app/plugins/gen.go @@ -223,10 +235,24 @@ fix-cue: $(cue) fix kinds/**/*.cue $(cue) fix public/app/plugins/**/**/*.cue + .PHONY: gen-jsonnet -gen-jsonnet: +gen-jsonnet: do-gen-jsonnet + @if [ -n "$$CODEGEN_VERIFY" ]; then \ + echo "Verifying generated code is up to date..."; \ + if ! git diff --quiet; then \ + echo "Error: Generated jsonnet files are not up to date. Please run 'make gen-jsonnet' to regenerate."; \ + git diff --name-only; \ + exit 1; \ + fi; \ + echo "Generated jsonnet files are up to date."; \ + fi + +.PHONY: do-gen-jsonnet +do-gen-jsonnet: go generate ./devenv/jsonnet + .PHONY: update-workspace update-workspace: gen-go @echo "updating workspace"