Skip to content

Commit

Permalink
Update Verify CI job to check CRD generation
Browse files Browse the repository at this point in the history
We have a Verify CI job that runs the basic static analysis, like code linting. This step should also ensure that CRD definitions for the Build APIs are aligned with what is in the golang code.
Fixes shipwright-io#943

Update hack/verify-generate.sh to check CRD generation
Update deep copy generation file not in sync
  • Loading branch information
Shahul authored and Shahul committed Nov 22, 2021
1 parent 03d96e2 commit 9cb1aa3
Show file tree
Hide file tree
Showing 3 changed files with 100 additions and 6 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ generate:
hack/generate-copyright.sh

.PHONY: verify-codegen
verify-codegen: generate
verify-codegen: generate generate-crds
@hack/verify-generate.sh

ginkgo:
Expand Down
18 changes: 13 additions & 5 deletions hack/verify-generate.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,21 @@
# SPDX-License-Identifier: Apache-2.0

# Verifies if a developer has forgot to run the
# `make generate` so that all the changes in the
# clientset should also be pushed
# `make generate` or `make generate-crd` so that all the changes in the
# clientset and CRD (deploy/crds) should also be pushed

if [[ -n "$(git status --porcelain -- pkg/client)" ]]; then
echo "The pkg/client package contains changes:"
git --no-pager diff --name-only -- pkg/client
if [[ -n "$(git status --porcelain -- pkg/client pkg/apis)" ]]; then
echo "The pkg/client or pkg/apis package contains changes:"
git --no-pager diff --name-only -- pkg/client pkg/apis
echo
echo "Run make generate to those commit changes!"
exit 1
fi

if [[ -n "$(git status --porcelain -- deploy/crds)" ]]; then
echo "The deploy/crds contains changes:"
git --no-pager diff --name-only -- deploy/crds
echo
echo "Run make generate-crds to those commit changes!"
exit 1
fi
86 changes: 86 additions & 0 deletions pkg/apis/build/v1alpha1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 9cb1aa3

Please sign in to comment.