Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fail on make verify if generated CRDs differ #1906

Merged
merged 2 commits into from
Sep 25, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 0 additions & 5 deletions hack/update-generated-crd-code.sh
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,6 @@ ${GOPATH}/src/k8s.io/code-generator/generate-groups.sh \
--go-header-file ${GOPATH}/src/github.com/heptio/velero/hack/boilerplate.go.txt \
$@

if [[ "$@" == "--verify-only" ]]; then
# skip generating CRD manifests
exit
fi

go run ${GOPATH}/src/sigs.k8s.io/controller-tools/cmd/controller-gen/main.go \
crd \
output:dir=pkg/generated/crds/manifests \
Expand Down
10 changes: 10 additions & 0 deletions hack/verify-generated-crd-code.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,13 @@
HACK_DIR=$(dirname "${BASH_SOURCE}")

${HACK_DIR}/update-generated-crd-code.sh --verify-only
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should the --verfify-only flag here be removed, since it's not being used anymore?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@nrb since adnan's out for a week, do you want to merge this as-is now and do a followup to remove that flag? would love to get it out of the queue :)


# ensure no changes to generated CRDs
if ! git diff --exit-code pkg/generated/crds/crds.go >/dev/null; then
# revert changes to state before running CRD generation to stay consistent
# with code-generator `--verify-only` option which discards generated changes
git checkout pkg/generated/crds

echo "CRD verification - failed! Generated CRDs are out-of-date, please run 'make update'."
exit 1
fi