Skip to content

Commit 278ae90

Browse files
committed
[make][pre-commit]Check CRD schema to avoid update issues
The new crd-schema-check make target compares the CRD schema of the patch with the schema on the tip of main and report errors on non backward compatible changes. This make target now also run in pre-commit both locally and in CI. This make target uses https://github.com/openshift/crd-schema-checker to do the actual checking. Related: OSPRH-11833
1 parent 5a9033c commit 278ae90

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed

.pre-commit-config.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,12 @@ repos:
2525
entry: make
2626
args: ['operator-lint']
2727
pass_filenames: false
28+
- id: make-crd-schema-check
29+
name: make-crd-schema-check
30+
language: system
31+
entry: make
32+
args: ['crd-schema-check']
33+
pass_filenames: false
2834

2935
- repo: https://github.com/pre-commit/pre-commit-hooks
3036
rev: v4.4.0

Makefile

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -358,3 +358,10 @@ force-bump: ## Force bump operator and lib-common dependencies
358358
for dep in $$(cat api/go.mod | grep openstack-k8s-operators | grep -vE -- 'indirect|test-operator|^replace' | awk '{print $$1}'); do \
359359
cd ./api && go get $$dep@$(BRANCH) && cd .. ; \
360360
done
361+
362+
CRD_SCHEMA_CHECKER_VERSION ?= release-4.16
363+
364+
PHONY: crd-schema-check
365+
crd-schema-check: manifests
366+
INSTALL_DIR=$(LOCALBIN) CRD_SCHEMA_CHECKER_VERSION=$(CRD_SCHEMA_CHECKER_VERSION) hack/build-crd-schema-checker.sh
367+
INSTALL_DIR=$(LOCALBIN) BASE_REF="$${PULL_BASE_SHA:-$(BRANCH)}" hack/crd-schema-checker.sh

0 commit comments

Comments
 (0)