Skip to content

Commit e1fb94a

Browse files
authored
Verify CRDs are up to date in merge check (#3022)
* Verify CRDs are up to date in merge check * make crds
1 parent fd429b7 commit e1fb94a

File tree

3 files changed

+191
-58
lines changed

3 files changed

+191
-58
lines changed

Makefile

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,13 +162,17 @@ lint:
162162
echo "TODO"
163163

164164
.PHONY: quick-ci
165-
quick-ci: verify-versions verify-generate
165+
quick-ci: verify-versions verify-generate verify-crds
166166
echo "Done!"
167167

168168
.PHONY: verify-generate
169169
verify-generate:
170170
hack/verify-generate.sh
171171

172+
.PHONY: verify-crds
173+
verify-crds:
174+
hack/verify-crds.sh
175+
172176
.PHONY: verify-versions
173177
verify-versions:
174178
hack/verify-versions.sh

hack/verify-crds.sh

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
#!/usr/bin/env bash
2+
3+
# Copyright 2023 The Kubernetes Authors.
4+
#
5+
# Licensed under the Apache License, Version 2.0 (the "License");
6+
# you may not use this file except in compliance with the License.
7+
# You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing, software
12+
# distributed under the License is distributed on an "AS IS" BASIS,
13+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
# See the License for the specific language governing permissions and
15+
# limitations under the License.
16+
17+
set -o errexit
18+
set -o nounset
19+
set -o pipefail
20+
21+
make crds
22+
23+
changed_files=$(git status --porcelain --untracked-files=no || true)
24+
if [ -n "${changed_files}" ]; then
25+
echo "Detected that CRD generation is needed; run 'make crds'"
26+
echo "changed files:"
27+
printf "%s\n" "${changed_files}"
28+
echo "git diff:"
29+
git --no-pager diff
30+
echo "To fix: run 'make crds'"
31+
exit 1
32+
fi

0 commit comments

Comments
 (0)