Skip to content

Commit 40bd993

Browse files
committed
Fix verification of generated files
Firstly, we weren't checking the go workspace in hack/codegen. Secondly, we weren't verifying generated files in the orc directory at all.
1 parent e31a757 commit 40bd993

File tree

2 files changed

+17
-5
lines changed

2 files changed

+17
-5
lines changed

Makefile

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -276,7 +276,7 @@ modules: ## Runs go mod to ensure proper vendoring.
276276
$(MAKE) -C $(REPO_ROOT)/orc modules
277277
go mod tidy
278278
cd $(TOOLS_DIR); go mod tidy
279-
cd $(REPO_ROOT)/hack/codegen; go mod tidy
279+
cd $(REPO_ROOT)/hack/codegen; go work sync; go mod tidy
280280

281281
.PHONY: generate
282282
generate: templates generate-orc generate-controller-gen generate-codegen generate-conversion-gen generate-go generate-manifests generate-api-docs ## Generate all generated code
@@ -540,25 +540,30 @@ clean-release: ## Remove the release folder
540540
rm -rf $(RELEASE_DIR)
541541

542542
.PHONY: verify
543-
verify: verify-boilerplate verify-modules verify-gen
543+
verify: verify-boilerplate verify-modules verify-gen verify-orc
544544

545545
.PHONY: verify-boilerplate
546546
verify-boilerplate:
547547
./hack/verify-boilerplate.sh
548548

549549
.PHONY: verify-modules
550550
verify-modules: modules
551-
@if !(git diff --quiet HEAD -- go.sum go.mod hack/tools/go.mod hack/tools/go.sum); then \
551+
@if !(git diff --quiet HEAD -- go.* hack/tools/go.* hack/codegen/go.*); then \
552552
git diff; \
553553
echo "go module files are out of date"; exit 1; \
554554
fi
555555

556+
.PHONY: verify-gen
556557
verify-gen: generate
557558
@if !(git diff --quiet HEAD); then \
558559
git diff; \
559560
echo "generated files are out of date, run make generate"; exit 1; \
560561
fi
561562

563+
.PHONY: verify-orc
564+
verify-orc:
565+
$(MAKE) -C $(REPO_ROOT)/orc verify-generated
566+
562567
.PHONY: compile-e2e
563568
compile-e2e: ## Test e2e compilation
564569
go test -c -o /dev/null -tags=e2e ./test/e2e/suites/conformance

orc/Makefile

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,10 +50,10 @@ manifests: controller-gen ## Generate WebhookConfiguration, ClusterRole and Cust
5050
.PHONY: modules
5151
modules:
5252
go mod tidy
53-
cd hack/codegen; go mod tidy
53+
cd hack/codegen; go work sync; go mod tidy
5454

5555
.PHONY: generate
56-
generate: manifests generate-controller-gen generate-codegen
56+
generate: modules manifests generate-controller-gen generate-codegen
5757

5858
.PHONY: generate-controller-gen
5959
generate-controller-gen: controller-gen ## Generate code containing DeepCopy, DeepCopyInto, and DeepCopyObject method implementations.
@@ -63,6 +63,13 @@ generate-controller-gen: controller-gen ## Generate code containing DeepCopy, De
6363
generate-codegen: generate-controller-gen ## codegen requires DeepCopy etc
6464
./hack/update-codegen.sh
6565

66+
.PHONY: verify-generated
67+
verify-generated: generate
68+
@if !(git diff --quiet HEAD); then \
69+
git diff; \
70+
echo "generated files are out of date, run make generate"; exit 1; \
71+
fi
72+
6673
.PHONY: fmt
6774
fmt: ## Run go fmt against code.
6875
go fmt ./...

0 commit comments

Comments
 (0)