Skip to content

Commit

Permalink
Merge pull request #946 from shahulsonhal/crd-verify
Browse files Browse the repository at this point in the history
Update Verify CI job to check CRD generation
  • Loading branch information
openshift-merge-robot authored Nov 23, 2021
2 parents ff694ca + 9f1f57a commit 99f1262
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 12 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/verify.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -40,4 +40,4 @@ jobs:
run: |
make -C $GOPATH/src/github.com/shipwright-io/build \
sanity-check \
verify-codegen
verify-generate
2 changes: 1 addition & 1 deletion DEVELOPMENT.md
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ As you make changes to the code, you can redeploy your controller with:
```
You may use the following command to re-generate CRDs of build and buildrun if you change their spec:
```sh
make generate-crds
make generate
```
### Tear it down
Expand Down
9 changes: 4 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -107,9 +107,11 @@ generate:
hack/update-codegen.sh
hack/generate-fakes.sh
hack/generate-copyright.sh
hack/install-controller-gen.sh
"$(CONTROLLER_GEN)" "$(CRD_OPTIONS)" rbac:roleName=manager-role webhook paths="./..." output:crd:artifacts:config=deploy/crds

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

ginkgo:
Expand Down Expand Up @@ -299,6 +301,3 @@ kind:
./hack/install-kind.sh
./hack/install-registry.sh

generate-crds:
./hack/install-controller-gen.sh
"$(CONTROLLER_GEN)" "$(CRD_OPTIONS)" rbac:roleName=manager-role webhook paths="./..." output:crd:artifacts:config=deploy/crds
1 change: 1 addition & 0 deletions hack/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,4 @@ This directory contains several scripts useful in the development process of Shi
- `release.sh` Creates a new release of Shipwright Build.
- `update-codegen.sh` Updates auto-generated client libraries.
- `verify-codegen.sh` Verifies that auto-generated client libraries are up-to-date.
- `verify-generate.sh` Check both uncommitted/unstaged changes for CRDs and the client code.
8 changes: 4 additions & 4 deletions hack/verify-generate.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@

# Verifies if a developer has forgot to run the
# `make generate` so that all the changes in the
# clientset should also be pushed
# clientset and 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 deploy/crds)" ]]; then
echo "The pkg/client, pkg/apis package or CRDs contains changes:"
git --no-pager diff --name-only -- pkg/client pkg/apis deploy/crds
echo
echo "Run make generate to those commit changes!"
exit 1
Expand Down
1 change: 0 additions & 1 deletion 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 99f1262

Please sign in to comment.