File tree Expand file tree Collapse file tree 4 files changed +50
-0
lines changed Expand file tree Collapse file tree 4 files changed +50
-0
lines changed Original file line number Diff line number Diff line change @@ -25,6 +25,12 @@ repos:
25
25
entry : make
26
26
args : ['operator-lint']
27
27
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
28
34
29
35
- repo : https://github.com/pre-commit/pre-commit-hooks
30
36
rev : v4.4.0
Original file line number Diff line number Diff line change @@ -358,3 +358,10 @@ force-bump: ## Force bump operator and lib-common dependencies
358
358
for dep in $$ (cat api/go.mod | grep openstack-k8s-operators | grep -vE -- ' indirect|test-operator|^replace' | awk ' {print $$1}' ); do \
359
359
cd ./api && go get $$ dep@$(BRANCH ) && cd .. ; \
360
360
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
Original file line number Diff line number Diff line change
1
+ #! /bin/bash
2
+ set -euxo pipefail
3
+
4
+ if [ -f " $INSTALL_DIR /crd-schema-checker" ]; then
5
+ exit 0
6
+ fi
7
+
8
+ mkdir -p " $INSTALL_DIR /git-tmp"
9
+ git clone https://github.com/openshift/crd-schema-checker.git \
10
+ -b " $CRD_SCHEMA_CHECKER_VERSION " " $INSTALL_DIR /git-tmp"
11
+ pushd " $INSTALL_DIR /git-tmp"
12
+ GOWORK=off make
13
+ cp crd-schema-checker " $INSTALL_DIR /"
14
+ popd
15
+ rm -rf " $INSTALL_DIR /git-tmp"
Original file line number Diff line number Diff line change
1
+ #! /bin/bash
2
+ set -euxo pipefail
3
+
4
+ CHECKER=$INSTALL_DIR /crd-schema-checker
5
+
6
+ TMP_DIR=$( mktemp -d)
7
+
8
+ function cleanup {
9
+ rm -rf " $TMP_DIR "
10
+ }
11
+
12
+ trap cleanup EXIT
13
+
14
+
15
+ for crd in config/crd/bases/* .yaml; do
16
+ mkdir -p " $( dirname " $TMP_DIR /$crd " ) "
17
+ if git show " $BASE_REF :$crd " > " $TMP_DIR /$crd " ; then
18
+ $CHECKER check-manifests \
19
+ --existing-crd-filename=" $TMP_DIR /$crd " \
20
+ --new-crd-filename=" $crd "
21
+ fi
22
+ done
You can’t perform that action at this time.
0 commit comments